BofastGlobal Posted September 21, 2019 Share Posted September 21, 2019 (edited) Hello, I set up a quantity discount for some of the products but the table on the frontend shows "You save up to ****". What I need is to show unit price after discount instead. This is what i get: Počet means PCs, Sleva means Discount, Ušetříte means You save up to.. (which i need to change to Unit price after discount) Edited September 21, 2019 by BofastGlobal (see edit history) Link to comment Share on other sites More sharing options...
BofastGlobal Posted September 23, 2019 Author Share Posted September 23, 2019 (edited) No one? I really need this to work that way. Edited September 23, 2019 by BofastGlobal (see edit history) Link to comment Share on other sites More sharing options...
renatototo Posted January 7, 2021 Share Posted January 7, 2021 This question is very old, but since I needed it today and couldn't find a solution I will share it here : 1- Edit \classes\product\SpecificPriceFormatter.php After $this->specificPrice['save'] = $priceFormatter->format((($initialPrice * $this->specificPrice['quantity']) - ($discountPrice * $this->specificPrice['quantity']))); Add : $this->specificPrice['unit_price'] = $priceFormatter->format($discountPrice); 2- Edit \themes\yourtheme\templates\catalog\_partials\product-discounts.tpl Replace : "<td>{$quantity_discount.save}</td>" with "<td>{$quantity_discount.unit_price}</td>" and of course edit the column name. Yes, I know we should not edit class files but that's the way I could do it. 1 Link to comment Share on other sites More sharing options...
ItriWeb Posted February 25, 2021 Share Posted February 25, 2021 On 1/7/2021 at 5:44 PM, renatototo said: This question is very old, but since I needed it today and couldn't find a solution I will share it here : 1- Edit \classes\product\SpecificPriceFormatter.php After $this->specificPrice['save'] = $priceFormatter->format((($initialPrice * $this->specificPrice['quantity']) - ($discountPrice * $this->specificPrice['quantity']))); Add : $this->specificPrice['unit_price'] = $priceFormatter->format($discountPrice); 2- Edit \themes\yourtheme\templates\catalog\_partials\product-discounts.tpl Replace : "<td>{$quantity_discount.save}</td>" with "<td>{$quantity_discount.unit_price}</td>" and of course edit the column name. Yes, I know we should not edit class files but that's the way I could do it. Hello, There is no "product" folder in the "classes" directory. I'm using ps 1.7.6.7, can you help ? thank you Link to comment Share on other sites More sharing options...
renatototo Posted April 29, 2021 Share Posted April 29, 2021 @ItriWeb Sorry for delay. Didn't received notification. Before 1.7.7.0 you have to modify file \controllers\front\ProductController.php After line $row['save'] = $priceFormatter->format((($price * $row['quantity']) - ($discountPrice * $row['quantity']))); Add $row['unit_price'] = $priceFormatter->format($discountPrice); And in file \themes\yourtheme\templates\catalog\_partials\product-discounts.tpl it is the same as I suggested. Link to comment Share on other sites More sharing options...
lunaroja Posted August 27, 2021 Share Posted August 27, 2021 En 7/1/2021 a las 5:44 PM, renatototo dijo: This question is very old, but since I needed it today and couldn't find a solution I will share it here : 1- Edit \classes\product\SpecificPriceFormatter.php After $this->specificPrice['save'] = $priceFormatter->format((($initialPrice * $this->specificPrice['quantity']) - ($discountPrice * $this->specificPrice['quantity']))); Add : $this->specificPrice['unit_price'] = $priceFormatter->format($discountPrice); 2- Edit \themes\yourtheme\templates\catalog\_partials\product-discounts.tpl Replace : "<td>{$quantity_discount.save}</td>" with "<td>{$quantity_discount.unit_price}</td>" and of course edit the column name. Yes, I know we should not edit class files but that's the way I could do it. I tried on 1.7.7.3 but do not work Link to comment Share on other sites More sharing options...
lunaroja Posted August 27, 2021 Share Posted August 27, 2021 (edited) I wrote in \classes\product\SpecificPriceFormatter.php: $this->specificPrice['save'] = $priceFormatter->format((($initialPrice * $this->specificPrice['quantity']) - ($discountPrice * $this->specificPrice['quantity']))); $this->specificPrice['unit_price'] = $priceFormatter->format($discountPrice); return $this->specificPrice; But not work. Edited August 28, 2021 by lunaroja (see edit history) Link to comment Share on other sites More sharing options...
renatototo Posted September 9, 2021 Share Posted September 9, 2021 On 8/27/2021 at 8:37 PM, lunaroja said: I tried on 1.7.7.3 but do not work Hello lunaroja, I did it using the 1.7.73 so it should work. Did you also edit the tpl file as described in the point #2? "2- Edit \themes\yourtheme\templates\catalog\_partials\product-discounts.tpl Replace : "<td>{$quantity_discount.save}</td>" with "<td>{$quantity_discount.unit_price}</td>" and of course edit the column name." Link to comment Share on other sites More sharing options...
lunaroja Posted September 9, 2021 Share Posted September 9, 2021 Thanks for reply. I do it. Result with 4 and 3 columns: Link to comment Share on other sites More sharing options...
lunaroja Posted September 9, 2021 Share Posted September 9, 2021 Product-discounts.tpl <section class="product-discounts"> {if $product.quantity_discounts} <p class="h6 product-discounts-title">{l s='Volume discounts' d='Shop.Theme.Catalog'}</p> {block name='product_discount_table'} <table class="table-product-discounts"> <thead> <tr> <th>{l s='Quantity' d='Shop.Theme.Catalog'}</th> <th>{$configuration.quantity_discount.label}</th> <th>{l s='You Save' d='Shop.Theme.Catalog'}</th> <th>{l s='Price' d='Shop.Theme.Catalog'}</th> </tr> </thead> <tbody> {foreach from=$product.quantity_discounts item='quantity_discount' name='quantity_discounts'} <tr data-discount-type="{$quantity_discount.reduction_type}" data-discount="{$quantity_discount.real_value}" data-discount-quantity="{$quantity_discount.quantity}"> <td>{$quantity_discount.quantity}</td> <td>{$quantity_discount.discount}</td> <td>{$quantity_discount.save}</td> <td>{$quantity_discount.unit_price}</td> </tr> {/foreach} </tbody> </table> {/block} {/if} </section> SpecificPriceFormatter.php $this->specificPrice['discount'] = $this->specificPrice['real_value'] . '%'; } } } $this->specificPrice['save'] = $priceFormatter->format((($initialPrice * $this->specificPrice['quantity']) - ($discountPrice * $this->specificPrice['quantity']))); $this->specificPrice['unit_price'] = $priceFormatter->format($discountPrice); return $this->specificPrice; } Link to comment Share on other sites More sharing options...
renatototo Posted September 9, 2021 Share Posted September 9, 2021 Stange, I don't see anythnig wrong. Sorry 1 Link to comment Share on other sites More sharing options...
lunaroja Posted September 9, 2021 Share Posted September 9, 2021 Works better with: $this->specificPrice['unit_price'] = $priceFormatter->format($discountPrice * $this->specificPrice['quantity']); Link to comment Share on other sites More sharing options...
lunaroja Posted September 9, 2021 Share Posted September 9, 2021 hace 6 horas, lunaroja dijo: Works better with: $this->specificPrice['unit_price'] = $priceFormatter->format($discountPrice * $this->specificPrice['quantity']); Works, but I prefer a % discount hace 8 horas, renatototo dijo: Stange, I don't see anythnig wrong. Sorry Thanks renatototo for your help Link to comment Share on other sites More sharing options...
carrasco Posted January 29, 2023 Share Posted January 29, 2023 (edited) Hi guys, can i get your help. my problem is itry to delete Save table but value dont apear but all table steel here. But if i Change the quantity of product go away can you help me plz, and if better, my website is www.amanhecer.com.pt Edited January 29, 2023 by carrasco (see edit history) Link to comment Share on other sites More sharing options...
Daniel Santana Posted July 26, 2023 Share Posted July 26, 2023 On 1/7/2021 at 1:44 PM, renatototo said: This question is very old, but since I needed it today and couldn't find a solution I will share it here : 1- Edit \classes\product\SpecificPriceFormatter.php After $this->specificPrice['save'] = $priceFormatter->format((($initialPrice * $this->specificPrice['quantity']) - ($discountPrice * $this->specificPrice['quantity']))); Add : $this->specificPrice['unit_price'] = $priceFormatter->format($discountPrice); 2- Edit \themes\yourtheme\templates\catalog\_partials\product-discounts.tpl Replace : "<td>{$quantity_discount.save}</td>" with "<td>{$quantity_discount.unit_price}</td>" and of course edit the column name. Yes, I know we should not edit class files but that's the way I could do it. Thank you Link to comment Share on other sites More sharing options...
Un_Tal_Iban Posted March 11 Share Posted March 11 In PS 1.7 was added this feature 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