Desamedia Posted September 30, 2015 Share Posted September 30, 2015 Hi all, I need to show the "volume discounts" in product-list.tpl. This is very easy to manage in product.tpl using $quantity_discounts, but this is not possible in the product-list.tpl. I have been searching in /controllers/front/ProductController.php and /classes/Product.php but I can not see how call $quantity_discounts in product-list.tpl Does anyone know the solution? Thank you very much. Link to comment Share on other sites More sharing options...
Desamedia Posted October 6, 2015 Author Share Posted October 6, 2015 Nobody? I found solutions for 1.4 or 1.5 but no for 1.6 Link to comment Share on other sites More sharing options...
Desamedia Posted October 6, 2015 Author Share Posted October 6, 2015 I found the solution. 1) Go to /controllers/front/CategoryController.php In line 232 you can read: foreach ($this->cat_products as &$product) if (isset($product['id_product_attribute']) && $product['id_product_attribute'] && isset($product['product_attribute_minimal_quantity'])) $product['minimal_quantity'] = $product['product_attribute_minimal_quantity']; You must change by: foreach($this->cat_products as &$cat_product) $cat_product['quantity_discount'] = SpecificPrice::getQuantityDiscounts((int)$cat_product['id_product'], (int)Shop::getCurrentShop(), (int)self::$cookie->id_currency, $id_country, $id_group); 2) Go to product-list.tpl Now you can use $product.quantity_discount With <pre>{$product.quantity_discount|print_r}</pre> you can get the array with the volume discounts and use them. Link to comment Share on other sites More sharing options...
ghizlanebel Posted October 13, 2015 Share Posted October 13, 2015 Hi Desamedia thanx for the help i tryed the code but it's not working any idea plz Link to comment Share on other sites More sharing options...
lochot Posted November 6, 2017 Share Posted November 6, 2017 Thank you Desamedia, i search this foreach ($this->cat_products as &$product) if (isset($product['id_product_attribute']) && $product['id_product_attribute'] && isset($product['product_attribute_minimal_quantity'])) $product['minimal_quantity'] = $product['product_attribute_minimal_quantity']; and i add that : foreach ($this->cat_products as &$product) $product['quantity_discount'] = SpecificPrice::getQuantityDiscounts((int)$product['id_product'], (int)Shop::getCurrentShop(), (int)self::$cookie->id_currency, $id_country, $id_group); if (isset($product['id_product_attribute']) && $product['id_product_attribute'] && isset($product['product_attribute_minimal_quantity'])) $product['minimal_quantity'] = $product['product_attribute_minimal_quantity']; Now i can use $product.quantity_discount With <pre>{$product.quantity_discount|print_r}</pre> i get the array with the volume discounts and use them in my product list.tpl i use it just like that : <ul> {foreach from=$product.quantity_discount item='zediscount'} <li> <span style="color: #00a2ea;">{convertPrice price = $zediscount.price*1.2|floatval}</span> for <b>{$zediscount.from_quantity}</b> </li> {/foreach} </ul> Link to comment Share on other sites More sharing options...
MyDesignAr Posted April 8, 2019 Share Posted April 8, 2019 hi @lochot can you update your response for prestashop 1.7? i'm looking for a solution like that, but for the new version of prestashp :S Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now