lat9 / edit_orders

Edit Orders: Updates for continued operation on Zen Cart v1.5.8 and later
GNU General Public License v2.0
5 stars 9 forks source link

Request for notifier in ot_group_pricing.php #237

Closed daphilli224 closed 3 months ago

daphilli224 commented 3 months ago

If the ot_group_pricing.php optional override file in edit_orders 4.7.0 gets incorporated in core eventually, could you please include a notifier in function calculate_deduction() just before: foreach ($discount_tax_groups as $key => $value) { $discount_tax_groups[$key] *= $discount_percentage; } which is located just before return from the function.

The use case is that some products (only a few), both taxable and non-taxable, are not discountable for members of the discount group. The associated observer would adjust $discount_total, $discount_tax, and discount_tax_groups[$key]. This assumes that order_total files remain non-overridable in future versions of zen-cart.

lat9 commented 3 months ago

Oy! I'd forgotten how much I'd changed that file. calculate_deductions's returned-array's "signature" contains additional elements, too. Let me give that a closer look, as zc200 is nearing release to see if I can wangle some form of notifier that will serve your request.

lat9 commented 3 months ago

While that notification isn't exactly what you requested, I've provided all the elements used to perform the in-module deduction calculation, with the opportunity to override the array of deduction-related information returned for display.

Let me know if that serves your needs.

lat9 commented 3 months ago

@daphilli224, please let me know if that notification works for you. I'd like to get this release of EO "out" this week.

daphilli224 commented 3 months ago

Sorry, 157c problems have delayed my testing. I'll get it done today. Thanks for the update!

daphilli224 commented 3 months ago

I need $order->products rather than $order->info since I need to go through each product in the order to see if it's discountable or not. If a product in the order is non-discountable, I need to adjust $discount. Dave

lat9 commented 3 months ago

I need $order->products rather than $order->info since I need to go through each product in the order to see if it's discountable or not. If a product in the order is non-discountable, I need to adjust $discount. Dave

Would it suffice to pass the full $order in the notification's first parameter instead of just $order->info?

proseLA commented 3 months ago

could one just add global $order to their observer? or is that so cliche now?

lat9 commented 3 months ago

could one just add global $order to their observer? or is that so cliche now?

True, that.

daphilli224 commented 3 months ago

Passing $order would work fine.