Forums / Bug Reports / [Done v1.3.9] Quantity Discounts Don't Apply with PHP 5.2.5

[Done v1.3.9] Quantity Discounts Don't Apply with PHP 5.2.5

Locked

Started by absolute on 18 Jan 2008, 7:45 PM · Views: 2,335

Results 1 to 3 of 3
This thread is locked. New replies are disabled.
18 Jan 2008, 7:45 PM
#1
absolute avatar

absolute

Totally Zenned

Join Date:
May 2005
Location:
Bath, Somerset
Posts:
1,054
Plugin Contributions:
2

[Done v1.3.9] Quantity Discounts Don't Apply with PHP 5.2.5

The bug can be re-created following these steps:

  • Run your store using PHP 5.2.5
  • Set up a product with attrbiutes
  • Set up a product with Quantity Group Discounts eg 1-2 $100 : 3-10 $50.00
  • Allow the products to mix attribute quantities when applying the discounts.
  • Order a mixed selection of products.

The bug results in the first group of products ordered being full price, when buying 1 or 2 products. If you then add enough products to go over the threshold, the original products added to cart remain at full price, and the next set are shown at reduced price.

FIX:

includes/classes/shopping_cart.php - function get_products()

LINE 1059-1060

Replace

    reset($this->contents);
    while (list($products_id, ) = each($this->contents)) {

with

    reset($this->contents);
    $tmp_cart_contents = $this->contents;
    while (list($products_id, ) = each($tmp_cart_contents)) {

I think the reason for this bug is the inclusion of the function zen_get_products_discount_price_qty which also iterates through the $this->contents variable.

Hope this helps,

Absolute

Back, after a 4 year absence! Did you miss me?
Absolute Web Solutions Ltd
Interested in our work? Take a look at one of our sites - The Tech Store

18 Jan 2008, 8:35 PM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: [Done v1.3.9] Quantity Discounts Don't Apply with PHP 5.2.5

Thanks Absolute.

Seems to be the same issue discussed here:
http://www.zen-cart.com/forum/showpost.php?p=484232&postcount=9

Fix will be included in v1.4.0

.
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.

18 Jan 2008, 8:39 PM
#3
absolute avatar

absolute

Totally Zenned

Join Date:
May 2005
Location:
Bath, Somerset
Posts:
1,054
Plugin Contributions:
2

Re: [Done v1.3.9] Quantity Discounts Don't Apply with PHP 5.2.5

I knew you'd be on top of the bug!

Absolute

Back, after a 4 year absence! Did you miss me?
Absolute Web Solutions Ltd
Interested in our work? Take a look at one of our sites - The Tech Store