Croatia decided to switch their currenct currency (HRK) to Euro. This brings changes in law. Prime Minister Andrej Plenković announced recently a dual display of prices in Croatia, both in kuna and in euro, from 5 September through the whole of 2023. Law requires to show prices in both kuna and euro as of 5 September to raise awareness of the euro even before its adoption, for which the target date has been set at 1 January 2023. The dual display of prices will continue throughout 2023. How to achieve dual price display in PrestaShop?
It can be done with our " multi price " module that gives possibility to dual display prices in PrestaShop - on product pages, category pages and rest. Module has easy in use configuration page where you just decide about currencies that you want to display. As you can see on the screenshot below:
Module is flexible.If your shop's default currency will be Euro, module will display Croatian Kunas as an additional currency. If your shop's default currency will be Croatian Kuna, module will display Euros as an additioanl currency. You do not have to do anything, module will switch its workflow automatically once you will switch default currency in shop.
Our module to display prices in various currencies by default allows to display dual prices on:
- product page
- catalog pages (search results, products listing in category, featured products on homepage, manufacturer's products etc.)
How to display dual prices on cart page and on order's history page and other pages in prestashop ?
But how to display prices in second currency on other pages related to products/orders that customer place in shop? Below you can find tutorial where i explain what to do and point files to change. This will require some minor customization of theme because prestashop themes are not ready for dual price display. Do not worry. Change will be super easy because our module is flexible and ready for such prestashop's law incompability. So, let's start with cart page.
Table of contents in this guide:
1. Dual price display on cart page
Cart page has two sections. First - is a product list, second - is a cart summary. As i show on the screenshot below:
How to modify list of products in cart to show dual prices
We need to alter the cart-detailed-product-line.tpl file, where you can find code:
<div class="col-md-6 col-xs-2 price"> <span class="product-price"> <strong> {if !empty($product.is_gift)} <span class="gift">{l s='Gift' d='Shop.Theme.Checkout'}</span> {else} {$product.total} {/if} </strong> </span> </div>
below the
{$product.total}
paste the shortcode to display our module:
{hook h='displayMultiPrice' price=$product.total_wt}
The Final code should be:
<div class="col-md-6 col-xs-2 price"> <span class="product-price"> <strong> {if !empty($product.is_gift)} <span class="gift">{l s='Gift' d='Shop.Theme.Checkout'}</span> {else} {$product.total} {hook h='displayMultiPrice' price=$product.total_wt} {/if} </strong> </span> </div>
Thanks to this we will include total price of product near each product on cart page. If you expect to show also unit price - verify if your theme file has code (classic themes has it)
{hook h='displayProductPriceBlock' product=$product type="unit_price"}
This code displays unit price of product. If your theme file does not have it - just add it. And do not forget to select "unit_price" as a module's position on its configuration page:
How to modify cart summary to display dual prices
To alter cart summary it will be required to alter /themes/your-theme/templates/checkout/_partials/cart-detailed-totals.tpl file.
There is a code:
{$subtotal.value}
add after
{hook h='displayMultiPrice' price=$subtotal.amount}
Thanks to this we will display subtotals in many currencies. To alter Total cart value we need to change file: cart-summary-top.tpl located in the same directory. There is a code:
{$cart.totals.total.value}
add after:
{hook h='displayMultiPrice' price=$cart.totals.total.amount}
There is a code:
{$cart.totals.total_including_tax.value}
add after:
{hook h='displayMultiPrice' price=$cart.totals.total_including_tax.amount}
There is a code:
{$cart.totals.total.value}
add after:
{hook h='displayMultiPrice' price=$cart.totals.total.amount}
Law requires to show
Law requirements says that you - as a merchant have to display price in both currencies also on order confirmation page. Because of this it is required to store the history of conversion rates of currencies available in your shop. Module is ready for this. To make order confirmation page compliant with legal requirements we need to alter theme file: /themes/your-theme/templates/checkout/_partials/order-confirmation-table.tpl
There is a code:
{$product.price}
Right after it add this:
<br/>{hook h='displayMultiPrice' price=$product.total_wt/$product.quantity order=Tools::getValue('id_order', 'false')}
There is a code:
{$product.total}
Right after it add:
<br/>{hook h='displayMultiPrice' price=$product.total_wt order=Tools::getValue('id_order', 'false')}
There is a code:
{$totals.total.value}
Right after it add this:
<br/>{hook h='displayMultiPrice' price=$totals.total.amount order=Tools::getValue('id_order', 'false')}
There is a code:
{$subtotal.value}
Right after it add this:
<br/>{hook h='displayMultiPrice' price=$subtotal.amount order=Tools::getValue('id_order', 'false')}
As you can see - the shortcode is a little different than previously. It has parameter "order" that points an order that is behind the price. Thanks to this module will get price calculated with archival conversion rates.
To change the way of how price appear on order historu page (customer account area) we have to alter file: /themes/your-theme/templates/customer/history.tpl and /themes/your-theme/templates/customer/_partials/order-detail-no-return.tpl.
Let's start with history.tpl file.
There is a code:
{$order.totals.total.value}
Right after it add this:
<br/>{hook h='displayMultiPrice' price=$order.totals.total.amount order=$order.details.id}
Then modify the order-detail-no-return.tpl
There is a code:
{$product.price}
Right after it add:
<br/>{hook h='displayMultiPrice' price=$product.total_wt/$product.quantity order=$order.details.id}
There is a code:
{$line.value}
Right after it add this:
<br/>{hook h='displayMultiPrice' price=$line.amount order=$order.details.id}
There is a code:
{$product.total}
Right after it add this:
<br/>{hook h='displayMultiPrice' price=$product.total_wt order=$order.details.id}
There is a code:
{$order.totals.total.value}
Right after it add code:
<br/>{hook h='displayMultiPrice' price=$product.amount order=$order.details.id}
Croatian law requires Kunas and Euros also on invoices. It is possible with our module as well. And it will use correct currency rate to display euros/kunas on invoice. To apply module to invoices it will be required to alter .tpl files that are behind the invoice. All files mentioned below are located in /pdf/ directory of prestashop.
invoice.product-tab.tpl
This file is responsible for list of products that appear on invoice. We have to display here price in second currency as well. To achieve this below the code:
{displayPrice currency=$order->id_currency price=$footer.products_before_discounts_tax_excl}
add:
<br/>{hook h='displayMultiPrice' price=$footer.products_before_discounts_tax_excl order=$order->id}
and below the code:
{displayPrice currency=$order->id_currency price=$order_detail.unit_price_tax_excl_before_specific_price}
add:
<br/>{hook h='displayMultiPrice' price=$order_detail.unit_price_tax_excl_before_specific_price order=$order->id}
and below the code:
{displayPrice currency=$order->id_currency price=$order_detail.unit_price_tax_excl_including_ecotax}
add:
<br/>{hook h='displayMultiPrice' price=$order_detail.unit_price_tax_excl_including_ecotax order=$order_detail.id_order}
and below the code:
{displayPrice currency=$order->id_currency price=$order_detail.total_price_tax_excl_including_ecotax}
add:
{hook h='displayMultiPrice' price=$order_detail.total_price_tax_excl_including_ecotax order=$order->id}
and below the code:
{displayPrice currency=$order->id_currency price=$footer.total_paid_tax_excl}
add:
<br/>{hook h='displayMultiPrice' price=$footer.total_paid_tax_excl order=$order->id}
and below the code:
{displayPrice currency=$order->id_currency price=$footer.total_taxes}
add:
<br/>{hook h='displayMultiPrice' price=$footer.total_taxes order=$order->id}
and below the code:
displayPrice currency=$order->id_currency price=$footer.total_paid_tax_incl}
add:
<br/>{hook h='displayMultiPrice' price=$footer.total_paid_tax_incl order=$order->id}
invoice.total-tab.tpl
This file is responsible for order summary values. To type there price in second currency below the code:
- {displayPrice currency=$order->id_currency price=$footer.product_discounts_tax_excl}
add:
<br/>{hook h='displayMultiPrice' price=$footer.product_discounts_tax_excl order=$order_detail.id_order}
and below the code:
{displayPrice currency=$order->id_currency price=$footer.shipping_tax_excl}
add:
<br/>{hook h='displayMultiPrice' price=$footer.shipping_tax_excl order=$order->id}
and after the code:
{displayPrice currency=$order->id_currency price=$footer.wrapping_tax_excl}
add:
<br/>{hook h='displayMultiPrice' price=$footer.wrapping_tax_excl order=$order->id}
Invoice.tax-tab.tpl
This file is responsible for table with taxes summary. To type there price in second currency below the code:
{displayPrice currency=$order->id_currency price=$line.total_tax_excl}
add:
{hook h='displayMultiPrice' order=$order->id price=$line.total_tax_excl}
and below the code:
{displayPrice currency=$order->id_currency price=$line.total_amount}
add:
{hook h='displayMultiPrice' order=$order->id price=$line.total_amount}
The result of invoice change will be like:
PrestaShop 1.6 changes
Guide above is about changing PrestaShop 1.7. How to do the same in PrestaShop 1.6 ?
Almost the same - just the files are differnt.PrestaShop "classic" theme has different structure of files. Generally speaking "default bootstrap" theme has different file system than themes in PrestaShop 1.7.
shopping cart page - product line
the file to edit is: /themes/theme-name/shopping-cart-product-line.tpl
<br/>{hook h='displayMultiPrice' price=$product.price_wt}
{convertPrice price=$product.price_wt}
<br/>{hook h='displayMultiPrice' price=$product.total_wt}
{displayPrice price=$product.total_wt}
shopping cart page - total values
the file to edit is: /themes/theme-name/shopping-cart.tpl
<br/>{hook h='displayMultiPrice' price=$total_products}
{displayPrice price=$total_products}
<br/>{hook h='displayMultiPrice' price=$total_products_wt}
{displayPrice price=$total_products_wt}
<br/>{displayPrice price=$total_wrapping_tax_exc}
{displayPrice price=$total_wrapping_tax_exc}
<br/>{displayPrice price=$total_wrapping}
{displayPrice price=$total_wrapping}
<br/>{displayPrice price=$total_wrapping_tax_exc}
{displayPrice price=$total_wrapping_tax_exc}
<br/>{displayPrice price=$total_shipping_tax_exc
}{displayPrice price=$total_shipping_tax_exc}
<br/>{displayPrice price=$total_shipping}
{displayPrice price=$total_shipping}
<br/>{displayPrice price=$total_shipping_tax_exc}
{displayPrice price=$total_shipping_tax_exc}
<br/>{hook h='displayMultiPrice' price=$total_tax}
{displayPrice price=$total_tax}
<br/>{hook h='displayMultiPrice' price=$total_price_without_tax}
{displayPrice price=$total_price_without_tax}
<br/>{hook h='displayMultiPrice' price=$total_price}
{displayPrice price=$total_price}
<br/>{hook h='displayMultiPrice' price=$total_price_without_tax}
{displayPrice price=$total_price_without_tax}