Jump to content
Sign in to follow this  
clokwise

[MODULE] Force Currency

Recommended Posts

This module allows your store to manage inventory in one currency, and sell in another. For example your default currency is Euros, but you want to sell your products to the USA, in Dollars. So add US Dollars as a currency to your shop, then install this module and configure US Dollars as the forced currency. Even if you have the Currency Block module installed, your customers will not be able to select another currency. Your currency in the Back Office will remain the default currency, Euros, in this example.

Limitations:
Obviously you can only use one default shop currency and one forced currency. If you have other currencies installed they will not be able to be used.

On the first page load, you may notice a page refresh. This is the only way I could manage to refresh the currency cookie and reload the currencies. If anyone has a better solution please feel free to update this code. Likewise, you will see a refresh after configuring the module. If there is a better solution - please contribute.

Installation:
After installing the module, for best performance, you must use the Module "Positions" sub-tab and move this module to the very first position in the "Top of pages" block.

About:
I built this module for my own business use, and am freely sharing it. This module however is totally unsupported! Do not expect me to make fixes, or answer any questions by email or in the Prestashop forum. I just don't have time. If I make any updates to this code, I will post them, but that's it. Sorry.

forcecurrency.zip

  • Like 1

Share this post


Link to post
Share on other sites

One additional note: You also need to go to the Payments tab and under "Payment module restrictions" select the same currency you forced with the module for each payment method. Otherwise your customers will instead see your default currency when they pay (at PayPal or wherever).

Share this post


Link to post
Share on other sites

i dont think the problem is solved. the module just changes the frontend currency, how about backend? i did install your module, but the admin control panel is still euro, how can i use pounds in the admin panel? thanks

Share this post


Link to post
Share on other sites

this module have a lot of bugs

first one is that the forced currency is not working on featured products EVER

Share this post


Link to post
Share on other sites

I think that the problem is from the homefeatured module, I found this code in homefeatured.php this one could be the problem.

if anyone knows how to figured out this... many 10x

    function hookHome($params)
   {
       global $smarty;
       $category = new Category(1);
       $nb = intval(Configuration::get('HOME_FEATURED_NBR'));
       $products = $category->getProducts(intval($params['cookie']->id_lang), 1, ($nb ? $nb : 10), 'date_add', 'DESC');
       $smarty->assign(array(
           'allow_buy_when_out_of_stock' => Configuration::get('PS_ORDER_OUT_OF_STOCK', false),
           'max_quantity_to_allow_display' => Configuration::get('PS_LAST_QTIES'),
           'category' => $category,
           'products' => $products,
           'currency' => new Currency(intval($params['cart']->id_currency)),
           'lang' => Language::getIsoById(intval($params['cookie']->id_lang)),
           'productNumber' => sizeof($products)
       ));
       return $this->display(__FILE__, 'homefeatured.tpl');
   }

}

Share this post


Link to post
Share on other sites

if you don't want to use a module make this modifications:

in init.php before:

$currency = Tools::setCurrency();


add:

$cookie->id_currency = intval(Configuration::get('PS_CURRENCY_FRONT_DEFAULT'));



in admin/tabs/AdminCurrencies.php after:

'PS_CURRENCY_DEFAULT' => array('title' => $this->l('Default currency:'), 'desc' => $this->l('The default currency used in shop'), 'cast' => 'intval', 'type' => 'select', 'identifier' => 'id_currency', 'list' => Currency::getCurrencies()),


add:

'PS_CURRENCY_FRONT_DEFAULT' => array('title' => $this->l('Default currency front:'), 'desc' => $this->l('The default currency used in front shop'), 'cast' => 'intval', 'type' => 'select', 'identifier' => 'id_currency', 'list' => Currency::getCurrencies()),



that's it! now go to admin->payment->currencies and set up your default shop currency. Customer CAN change the currency if needed.

Share this post


Link to post
Share on other sites

Hi !

I am looking for another function : how may I change the decimal parameter, but ONLY on product.tpl pages ?

I am searching for that since 4 hours now, and I despair...
want to get 200,00 to 200 - so without decimals (but only in product.tpl page)

many tks in advance...

Share this post


Link to post
Share on other sites

thanks Radu... just what i needed for my shop

Share this post


Link to post
Share on other sites
if you don't want to use a module make this modifications:

in init.php before:
$currency = Tools::setCurrency();


add:

$cookie->id_currency = intval(Configuration::get('PS_CURRENCY_FRONT_DEFAULT'));



in admin/tabs/AdminCurrencies.php after:

'PS_CURRENCY_DEFAULT' => array('title' => $this->l('Default currency:'), 'desc' => $this->l('The default currency used in shop'), 'cast' => 'intval', 'type' => 'select', 'identifier' => 'id_currency', 'list' => Currency::getCurrencies()),


add:

'PS_CURRENCY_FRONT_DEFAULT' => array('title' => $this->l('Default currency front:'), 'desc' => $this->l('The default currency used in front shop'), 'cast' => 'intval', 'type' => 'select', 'identifier' => 'id_currency', 'list' => Currency::getCurrencies()),



that's it! now go to admin->payment->currencies and set up your default shop currency. Customer CAN change the currency if needed.



when I use this forcecurrency module all store order email effected. For example after the shopping prestashop sending order mail correct amount to customer, but another order email which is store owner getting has a wrong amount... would you tell me how can i fix this..

25177_K5dbckzfHpaSdrd2ChVm_t

25178_W0EO6Y0eHXB3wGyq1962_t

Share this post


Link to post
Share on other sites
hello Ugur Onur, do you have solved the problem with order email?


Nope, unfortunately I could nor solve this problem... If I solve I will let you know How I did...

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More