Shad86 Posted April 10, 2014 Share Posted April 10, 2014 (edited) Hey guys, I hope you can help me. In the attached screenshot you see my quantity discount list. On the right is the price that gets off from the single product price. But I want the single price for 100 pieces for example in the list. Is this possible? Edited May 27, 2014 by Shad86 (see edit history) Link to comment Share on other sites More sharing options...
PascalVG Posted April 12, 2014 Share Posted April 12, 2014 Hi Shad, This will give problems if you have attributes that have impact on the price. The table should then also be updated, which isn't the case when showing the discounts (and this updating isn't currently done) For example, in demo database: iPod Nano comes in version 8GB hard disk and 16GB, each with different price. When showing the discount (for example -5%,or -$20) this info is all the same for both 8 and 16GB. If you change it into a "Price to pay" value, you need to update this table when changing from 8 -> 16GB because the base price changes. Of course can be done, but is much more work... (extra json/ajax code needed, calculations made etc) My 2 cents, pascal. Link to comment Share on other sites More sharing options...
PascalVG Posted April 12, 2014 Share Posted April 12, 2014 (edited) Shad, if you DON'T have any attribute that impacts the price, you might try to edit the function: protected function formatQuantityDiscounts in /controllers/front/ProductController.php (Make backup! And best would be to override the file instead of directly edit this one. See developers guide on how to do this) Code snippet from 1.5.6.2: protected function formatQuantityDiscounts($specific_prices, $price, $tax_rate, $ecotax_amount) { foreach ($specific_prices as $key => &$row) { $row['quantity'] = &$row['from_quantity']; if ($row['price'] >= 0) // The price may be directly set { $cur_price = (Product::$_taxCalculationMethod == PS_TAX_EXC ? $row['price'] : $row['price'] * (1 + $tax_rate / 100)) + (float)$ecotax_amount; if ($row['reduction_type'] == 'amount') $cur_price -= (Product::$_taxCalculationMethod == PS_TAX_INC ? $row['reduction'] : $row['reduction'] / (1 + $tax_rate / 100)); else $cur_price *= 1 - $row['reduction']; $row['real_value'] = $price - $cur_price; } else { if ($row['reduction_type'] == 'amount') $row['real_value'] = Product::$_taxCalculationMethod == PS_TAX_INC ? $row['reduction'] : $row['reduction'] / (1 + $tax_rate / 100); else $row['real_value'] = $row['reduction'] * 100; } $row['nextQuantity'] = (isset($specific_prices[$key + 1]) ? (int)$specific_prices[$key + 1]['from_quantity'] : -1); } return $specific_prices; } Here you should then change the calculation/showing from discount -> fixed price value. (Can be that you have to add a function parameter $baseprice or so as well...) My 2 more cents, pascal Edited April 12, 2014 by PascalVG (see edit history) Link to comment Share on other sites More sharing options...
Shad86 Posted May 14, 2014 Author Share Posted May 14, 2014 Hi Pascal, sorry for the late reply, holidays I´ve done it like this and it runs for me perfectly. Thank you. Link to comment Share on other sites More sharing options...
PascalVG Posted May 15, 2014 Share Posted May 15, 2014 Good to hear! (Maybe you can copy the final code you used, so others can use it.) Please change the topic title to [sOLVED] (see my footer text on how to do this) Happy selling, pascal. Link to comment Share on other sites More sharing options...
Shad86 Posted May 27, 2014 Author Share Posted May 27, 2014 I´m sorry, I don´t work on it every day. If someone need it, I try to help but i can´t really find the code I´ve changed. 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