Jump to content
olea

[TIPS] Quantity discount per combination in 1.4

Recommended Posts

Between presta1.3 and presta1.4, there is a difference in the way to apply the quantity discount on a product with combination.

 

For example, on the default shop, suppose you apply a discount on 10 items and for 20 items for the iPod Shuffle

 

In your cart, you have : 5 blue, 5 pink and 10 green.

 

In presta 1.3, the blue and the pink hve the normal price and the green have the discount price for 10

In Presta1.4, both of them have the discount price for 20 (5+5+10)

 

In your prestashop 1.4, if you want the same behaviour than in prestashop 1.3, you have to modify the following lines at the beginning of the Product::getPriceStatic() method (modification are given in red) :

if (0 AND  (int)($id_cart))  /* 0 CONDITION TO BE ADDED */
{
 if (!isset(self::$_cart_quantity[(int)($id_cart).'_'.(int)($id_product)]) OR self::$_cart_quantity[(int)($id_cart).'_'.(int)($id_product)] !=  (int)($quantity))
	self::$_cart_quantity[(int)($id_cart).'_'.(int)($id_product)] = DB::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
			SELECT SUM(`quantity`)
FROM `'._DB_PREFIX_.'cart_product`
  WHERE `id_product` = '.(int)($id_product).' AND `id_cart` = '.(int)($id_cart)
 );
 $cart_quantity = self::$_cart_quantity[(int)($id_cart).'_'.(int)($id_product)];
}
$cart_quantity = 0;   /* LINE TO BE ADDED */

Share this post


Link to post
Share on other sites

i also need this ... i m using prestashop 1.4.8.2 ... can you please tell me in which file i have to edit this code ?

 

Thanks

Share this post


Link to post
Share on other sites

Perfectly working Thanks you .... its in Classes -> product.php

Share this post


Link to post
Share on other sites

lol I just found this post after hours of going crazy because the discount was applied to the amount of products when I had different prices depending on product dimensions so THANK YOU very much!!! :)

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More