Shira7 Posted April 22, 2020 Share Posted April 22, 2020 I'm trying to display item prices excluding tax, I have accomplished that in the category listings and product details, editing /themes/classic/templates/catalog/_partials/product-prices.tpl + miniatures/product.tpl and changing ($product.price} to {Tools::displayPrice($product.price_tax_exc)} however the same does not work for the cart checkout in /themes/classic/templates/checkout/_partials/cart-summary-product-line.tpl neither {$product.price_tax_exc} nor {Tools::displayPrice($product.price_tax_exc)} seems to do the trick here, it's just blank where the price should be. How can I do it? Link to comment Share on other sites More sharing options...
taniacr Posted September 21, 2020 Share Posted September 21, 2020 Hi, Did you manage to solve this? 1 Link to comment Share on other sites More sharing options...
Shira7 Posted September 21, 2020 Author Share Posted September 21, 2020 22 minutes ago, taniacr said: Hi, Did you manage to solve this? Nope, I switched to OpenCart. 1 Link to comment Share on other sites More sharing options...
Guest Posted September 22, 2020 Share Posted September 22, 2020 12 hours ago, taniacr said: Hi, Did you manage to solve this? If you make a screen page where you want to edit, I will advise. 😉 Link to comment Share on other sites More sharing options...
taniacr Posted September 29, 2020 Share Posted September 29, 2020 On 9/22/2020 at 6:47 AM, Guest said: If you make a screen page where you want to edit, I will advise. 😉 I managed to create a tiny module where I show both prices (with and without tax) using: $priceWithTax = Tools::displayPrice($product->getPrice(true, null, 6, null, false, false), $this->context->currency); $priceWithoutTax = Tools::displayPrice($product->getPrice(false, null, 6, null, false, false), $this->context->currency); Just need to find out how to display the discounted prices with and without tax 1 Link to comment Share on other sites More sharing options...
Guest Posted September 29, 2020 Share Posted September 29, 2020 😁 I have my own module and I need someone to write the whole module for them ... Use the hooks to display the price without VAT. The following hooks are available: {hook h='displayProductPriceBlock' product=$product type="old_price"} {hook h='displayProductPriceBlock' product=$product type="before_price"} {hook h='displayProductPriceBlock' product=$product type="after_price"} {hook h='displayProductPriceBlock' product=$product type="price"} {hook h='displayProductPriceBlock' product=$product type="unit_price"} {hook h='displayProductPriceBlock' product=$product type="weight"} In the module you will use eg: public function hookHeader($params) { $page_name = Dispatcher::getInstance()->getController(); // or create JavaScript and override original price if (Tools::getValue('id_product') && $page_name == 'product'){ // change only product page $product = new Product((int)Tools::getValue('id_product'); $priceWithTax = Tools::displayPrice($product->getPrice(true, null, 6, null, false, false), $this->context->currency); $priceWithoutTax = Tools::displayPrice($product->getPrice(false, null, 6, null, false, false), $this->context->currency); Media::addJsDef(array( 'priceWithTax' => $priceWithTax, 'priceWithoutTax' => $priceWithoutTax, )); $this->context->controller->addJS(_PS_MODULE_DIR_.$this->name.'/js/custom.js'); // add custom javascript /** $(document).ready(function() { $('.product-unit-price').html(priceWithTax+'<br><p class="price-without-tax">'+priceWithoutTax+'</p>'); }); */ } $this->context->controller->addCSS(_PS_MODULE_DIR_.$this->name.'/css/product.css'); // add custom css style } public function hookDisplayProductPriceBlock($params) { $product = new Product((int)Tools::getValue('id_product'); $priceWithTax = Tools::displayPrice($product->getPrice(true, null, 6, null, false, false), $this->context->currency); $priceWithoutTax = Tools::displayPrice($product->getPrice(false, null, 6, null, false, false), $this->context->currency); if ($params['type'] == 'before_price'){ return '<p class="price-with-tax">'.$priceWithTax.'</p>'; } if ($params['type'] == 'after_price'){ return '<p class="price-without-tax">'.$priceWithoutTax.'</p>'; } } It's just an outline of how to do it. Link to comment Share on other sites More sharing options...
taniacr Posted September 30, 2020 Share Posted September 30, 2020 Thank you @Guest for your detailed answer but isn't your solution for the product page? That we managed to do. What we need is to show prices with and without tax in the cart/ checkout Link to comment Share on other sites More sharing options...
Guest Posted September 30, 2020 Share Posted September 30, 2020 But it's so simple !!! ./themes/classic/templates/checkout/_partials/cart-detailed-product-line.tpl <div class="col-md-6 col-xs-2 price"> <span class="product-price"> <strong> {if isset($product.is_gift) && $product.is_gift} <span class="gift">{l s='Gift' d='Shop.Theme.Checkout'}</span> {else} {$product.total} yyy {/if} </strong> </span> </div> <div class="current-price"> <span class="price">{$product.price} xxx</span> {if $product.unit_price_full} <div class="unit-price-cart">{$product.unit_price_full}</div> {/if} </div> change to xxx: <div class="current-price"> <span class="price">{$product.price}</span> {hook h='displayProductPriceBlock' product=$product type="after_price"} {if $product.unit_price_full} <div class="unit-price-cart">{$product.unit_price_full}</div> {/if} </div> and change to yyy: <div class="col-md-6 col-xs-2 price"> <span class="product-price"> <strong> {if isset($product.is_gift) && $product.is_gift} <span class="gift">{l s='Gift' d='Shop.Theme.Checkout'}</span> {else} {$product.total} {/if} </strong> </span> {hook h='displayProductPriceBlock' product=$product type="after_price"} </div> </div> Link to comment Share on other sites More sharing options...
Guest Posted September 30, 2020 Share Posted September 30, 2020 You can use an existing hook anywhere. If it's not in the tpl template, I'll ask Colombo and rediscover America, or read the documentation and insert our own hook. I've already given instructions on how to insert your own hook into the tpl template. There is a search bar on the forum. I recommend using !!! Link to comment Share on other sites More sharing options...
taniacr Posted September 30, 2020 Share Posted September 30, 2020 Thank you Link to comment Share on other sites More sharing options...
Matis75 Posted December 16, 2020 Share Posted December 16, 2020 If you need price without tax in a cart overview (./themes/classic/templates/checkout/_partials/cart-detailed-product-line.tpl) {Tools::displayPrice($product.price_without_reduction_without_tax)} or {Tools::displayPrice($product.price_with_reduction_without_tax)} PS 1.7.6.9 1 1 Link to comment Share on other sites More sharing options...
Roger SA Posted May 11, 2022 Share Posted May 11, 2022 (edited) On 9/29/2020 at 6:19 PM, taniacr said: I managed to create a tiny module where I show both prices (with and without tax) using: $priceWithTax = Tools::displayPrice($product->getPrice(true, null, 6, null, false, false), $this->context->currency); $priceWithoutTax = Tools::displayPrice($product->getPrice(false, null, 6, null, false, false), $this->context->currency); Just need to find out how to display the discounted prices with and without tax I know where I want to show $priceWithTax, but I don't know where to declare it first. If I do it in the same TPL the page breaks. Can you help me? Edited May 11, 2022 by Roger SA (see edit history) 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