Toeareg Posted July 10, 2013 Share Posted July 10, 2013 Hi, I am looking for a way to prevent voucher discounts to be calculated on products that already have a special price. To attract customers we always do have a few products with special price. But we do NOT want additional voucher discounts to be calculated. Is it possible to make this work in Prestashop? Link to comment Share on other sites More sharing options...
nimloth Posted November 11, 2013 Share Posted November 11, 2013 Hi have you found a solution? I'd like the same behaviour.... Link to comment Share on other sites More sharing options...
nimloth Posted November 12, 2013 Share Posted November 12, 2013 I solved in this way: In classes/Cart.php I copied the "public function getOrderTotal" and I called it "getOrderTotalWithoutOnSaleProducts". In this new method I changed those lines adding a control to skip on_sale ones: foreach ($products as $product) // products refer to the cart details { if (!$product['on_sale']) { etc. etc. Then in classes/CartRule.php I used it instead of the old one: // Discount (%) on the whole order if ($this->reduction_percent && $this->reduction_product == 0) { // Do not give a reduction on free products! $order_total = $context->cart->getOrderTotalWithoutOnSaleProducts($use_tax, Cart::ONLY_PRODUCTS, $package_products); I made this change only for percentage discount on the whole order. Hope that helps! nimloth Link to comment Share on other sites More sharing options...
Toeareg Posted November 20, 2013 Author Share Posted November 20, 2013 Sorry for my late reply Nimloth and thanks for the code. I need to take it a step further though and I am currently working on that. I need to be able to create customer groups with specific discounts and those discounts should ALWAYS be calculated as a % of the base-price. Then I need to find out what price is lowest: group-price or special-price or (base-price -/- voucher) and then use that lowest price. And in product-list.tpl I need to be able to show the base-price, the discount (as a %) and the final-price. In product.tpl that's no problem since I have all prices and discounts available there, but not so in product-list.tpl So my current struggle is to find out where I can extract the base-price and the group-discount so that I can add them to the smarty array and display them in product-list.tpl. If anybody can give me a hint where to extract the base-price and group-discount-percentage I would be very glad. Link to comment Share on other sites More sharing options...
Recommended Posts