Jump to content

[SOLVED] Price in EURO & DOLLARS in product.tpl


NexusFred

Recommended Posts

Hello !!

I have a shop only who accept only Euro currency.

But for the foreigners customers I would like to show just below the price in EURO the dollars converted price, just for information.

With the version 1.2.5 of Prestashop I was using this code >>>

{convertPriceWithCurrency price=$product->getPrice(true, $smarty.const.NULL, 2) currency=$currencies.0} 



But with the version 1.3.10 this code doesn't work any more !!

Somebody have a clue why ?

Thanks

PS(sorry for my bad english I'm french lol)

Best Regards

Nexus

Link to comment
Share on other sites

Ok I find what change on the 1.3.10 !!

In the file Tools.php of the 1.2.5 version we find this function

Line 172

static public function displayPrice($price, $currency, $no_utf8 = false, $convert = true)
/* if you modified this function, don't forget to modify the Javascript function formatCurrency (in tools.js) */
       if ($convert)
           $price = self::convertPrice($price, $currency);
....



But in the new 1.3.10 the same function have change

Line 214 :

static public function displayPrice($price, $currency = NULL, $no_utf8 = false)
   {
       if ($currency === NULL)
           $currency = Currency::getCurrent();
...



We see the var $convert is not present anymore and the if($convert) so.

If we change the displayPrice function like this

   static public function displayPrice($price, $currency = NULL, $no_utf8 = false, $convert)
   {
       if ($convert)
           $price = self::convertPrice($price, $currency);
       if ($currency === NULL)
           $currency = Currency::getCurrent();
...



And next in the product.tpl we use this code

{convertPriceWithCurrency price=$product->getPrice(true, $smarty.const.NULL, 2) currency=$currencies.0 convert=true}



everything work like in the 1.2.5 version


What i hope is this change will not causing some bug elsewhere !!

Link to comment
Share on other sites

  • 3 months later...
  • 2 weeks later...
  • 1 year later...
  • 2 years later...

hi can you tell the description for this code :

 

{convertPriceWithCurrency price=$product->getPrice(true, $smarty.const.NULL, 2) currency=$currencies.0 convert=true}

 

i want to choose euro or dollar where i have give the id of the currency whether is 2 .

 

How to make it for PS version 1.5.6

Edited by karthiiiiiiiiiik (see edit history)
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...