I am currently getting an error on login page:
Warning: Division by zero in /includes/modules/order_total/ot_group_pricing.php on line 79
Line 79:
PHP Code:
$ratio = $od_amount['total']/$order_total;
I am currently getting an error on login page:
Warning: Division by zero in /includes/modules/order_total/ot_group_pricing.php on line 79
Line 79:
PHP Code:
$ratio = $od_amount['total']/$order_total;
I temporarily removed Group Discount from Module - Order Total to disable this error from the login page. We currently do not have any group discount in place. Can someone please clarify if this is needed by another function? I just want to make sure I am not making things worse. Thanks!
What version of Zen Cart?
.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole
Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.
Okay, I've seen this, but never on the login page.
Will research it as a minor bug.
Disabling group discounts for now should be fine, since, as you say, you don't use them.
.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole
Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.
Trouble is, you won't see it in PHP5. I got bit by a similar thing in Gift Wrap because I don't test in PHP4 anymore. Fix is straightforward: change
$ratio = $od_amount['total']/$order_total;
to
$ratio = 1;
if ($order_total != 0) {
$ratio = $od_amount['total']/$order_total;
}
That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.
sw_guy is correct.
I suggest this approach, which saves some CPU cycles and database queries:
/includes/modules/order_total/ot_group_pricing.php
around line 67 you'll see this section of code.
Add the line highlighted:Code:function calculate_deductions($order_total) { global $db, $order; $od_amount = array(); if ($order_total == 0) return $od_amount; $orderTotal = $this->get_order_total();
.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole
Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.
DrByte, I think I follow now, instead of using SWGuy's code fix you're instructing me to apply your approach because it's an optimized approach using SWGuy's code logic.
I applied your changes (instead of SWGuy's) and that solved the problem.
Thanks to both of you for helping with this.
Bookmarks