Show prices in Croatian Kunas and Euros in PrestaShop

2022-08-09 cart, currency, law, prices, product

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:

dual price display currencies in prestashop

 

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. How to display price in two currencies on cart page
  2. How to display price in two currencies on order confirmation page
  3. How to display price in two currencies on order history page
  4. How to display price in two currencies on invoice 

 

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:

cart product list cart summary

 

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: 

dual price currencies

 

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}

 

2. Order confirmation page

Law requires to show 

order confirmation page dual currencies display

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.

 

3. Order history

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.

orders history various currencies


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} 

 

4. Invoices

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:

two currencies on invoice in prestashop

 

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
 

  • the code to add are: <br/>{hook h='displayMultiPrice' price=$product.price_wt}
  • after coode {convertPrice price=$product.price_wt}

 

  • and add code:<br/>{hook h='displayMultiPrice' price=$product.total_wt}
  • after code:{displayPrice price=$product.total_wt}


shopping cart page - total values
the file to edit is: /themes/theme-name/shopping-cart.tpl

  • the code to add: <br/>{hook h='displayMultiPrice' price=$total_products}
  • add it after: {displayPrice price=$total_products}

 

  • the code to add: <br/>{hook h='displayMultiPrice' price=$total_products_wt}
  • add it after: {displayPrice price=$total_products_wt}

 

  • the code to add: <br/>{displayPrice price=$total_wrapping_tax_exc}
  • add it after: {displayPrice price=$total_wrapping_tax_exc}

 

  • the code to add: <br/>{displayPrice price=$total_wrapping}
  • add it after: {displayPrice price=$total_wrapping}

 

  • the code to add: <br/>{displayPrice price=$total_wrapping_tax_exc}
  • add it after: {displayPrice price=$total_wrapping_tax_exc}

 

  • the code to add: <br/>{displayPrice price=$total_shipping_tax_exc}
  • add it after: {displayPrice price=$total_shipping_tax_exc}

 

  • the code to add: <br/>{displayPrice price=$total_shipping}
  • add it after: {displayPrice price=$total_shipping}

 

  • the code to add: <br/>{displayPrice price=$total_shipping_tax_exc}
  • add it after: {displayPrice price=$total_shipping_tax_exc}

 

  • the code to add: <br/>{hook h='displayMultiPrice' price=$total_tax}
  • add it after: {displayPrice price=$total_tax}

 

  • the code to add: <br/>{hook h='displayMultiPrice' price=$total_price_without_tax}
  • add it after: {displayPrice price=$total_price_without_tax}

 

  • the code to add: <br/>{hook h='displayMultiPrice' price=$total_price}
  • add it after: {displayPrice price=$total_price}

 

  • the code to add: <br/>{hook h='displayMultiPrice' price=$total_price_without_tax}
  • add it after: {displayPrice price=$total_price_without_tax}
author milos myszczuk
Article by Milosz Myszczuk PrestaShop expert, official PrestaShop community moderator. PHP developer, specialist in relative and spatial databases management, GIS Analyst, CEO & founder of VEKIA interactive agency. Read more about VEKIA company
If you like my articles and want much more valuable tips, feel free to send me donation
1.4 version 1.4.11 1.6 404 addon admin advertise ahref ajax alpha animation api app application authentication back office backup badge banner basics block bootstrap button cache carrier cart catalog category certificate changelog chat class clear client clip cms code colors columns comments configuration contact container content controller cookie counter country coupon css csv currency customer dashboard database debug default delete delivery desktop developer device disable discount displayNav displayTop download dynamic editor effect empty encrypt engine error exchange exclude export facebook faceshop fade fancoupon fancybox fanpage fatal feature feed field file fix fixed font footer free friendly url front ftp full gallery generate gift global godaddy google google+ gray grid groupon header help hide highlight homefeatured homepage hook hosting hover howto htaccess html html5 ID image import include input instagram installation integration iPhone issue javascript jquery kgb knowhow languages law left likebox link list livingsocial loading log login logo loyality mail mailing maintenance manufacturer marketing marquee mcrypt menu meta mobile modification module movie moving multilanguage multiupload must have mysql news newsletter notification number open graph order override page password performance PHP phpmyadmin picture pinterest plugin popup post prestashop prestashop 1.0 prestashop 1.1 prestashop 1.2 prestashop 1.3 prestashop 1.4 prestashop 1.5 price rules problem product profile promotion proslider purifier quantity query quick tip random rates register reinsurance release reporting reset responsive restore results ribbon rich text right sales search security seo service shadow share shipping shop shopmania slider smarty social networks SQL SSL statistics stock store style subcategory superuser support switcher tab tablet tag tax template text theme tinyMCE tips and tricks tpl tracking translations tree trends trigger tumblr tutorial twitter update upgrade upload variables video visits voucher vulnerability web2print wide widget width window wishlist wysiwyg youtube zip zopim