Jump to content

Error inter version? Product.php and Quantity_discount


Laproteina

Recommended Posts

Hello , sorry poor english
I download svn to my computer.
I saw in version 1373 of Product.php(made by mBiart) that includes this code to fix discount quantity when ordering different combinations

$totalQuantity = intval(Db::getInstance()->getValue('
           SELECT SUM(`quantity`)
           FROM `'._DB_PREFIX_.'cart_product`
           WHERE `id_product` = '.intval($id_product).' AND `id_cart` = '.intval($cookie->id_cart))
       ) + intval($quantity);
       if ($totalQuantity > 1 AND ($qtyD = QuantityDiscount::getDiscountFromQuantity($id_product, $totalQuantity)))
           $price -= QuantityDiscount::getValue($price, $qtyD->id_discount_type, $qtyD->value);


Introduces the var $totalQuantity

But in actual version on this file anybody's do something with this var
I saw version 1589(made by rGaillard) changes this code

            if ($totalQuantity > 1 AND ($qtyD = QuantityDiscount::getDiscountFromQuantity($id_product, $totalQuantity)))
               $price -= QuantityDiscount::getValue($price, $qtyD->id_discount_type, $qtyD->value);


by

        if ($quantity > 1 AND ($qtyD = QuantityDiscount::getDiscountFromQuantity($id_product, $quantity)))
       {
           $discount_qty_price =  QuantityDiscount::getValue($price, $qtyD->id_discount_type, $qtyD->value);
           if (!$usetax)
               $discount_qty_price /= (1 + ($tax / 100));
           $price -= $discount_qty_price;
       }


It's a error? the var totalQuantity not used at this moment, the different combinations dont work or not?
This var not used in 1.3 RC3 released

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...