PrestaShop Forum

The best place in the world to ask questions about PrestaShop and get advice from our passionate community!

PrestaShop Forum

Jump to content

[MODULE] Force Currency

18 replies to this topic
#1
clokwise

    PrestaShop Apprentice

  • Members
  • PipPip
  • 40 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.

Attached Files



#2
Marghoob Suleman

    PrestaShop Apprentice

  • Members
  • PipPip
  • 134 posts
Thanks for sharing... I'll check this...
Now Online (23rd May 2009): Gift Le Lo
Marghoob Suleman
Guys please do not make any test order on my site. You are welcome to visit and shop :)

#3
hieloiceberg

    PrestaShop Apprentice

  • Members
  • PipPip
  • 480 posts
Thanks for sharing clokwise
FarmVille Addict ;-)

#4
Hungnh

    PrestaShop Apprentice

  • Members
  • PipPip
  • 36 posts
Thanks for sharing everyone.

MERRY CHRISTMAS!


#5
clokwise

    PrestaShop Apprentice

  • Members
  • PipPip
  • 40 posts
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).

#6
noexperience

    PrestaShop Apprentice

  • Members
  • PipPip
  • 83 posts
not working under COD module (Cash on delivery )
Need help

#7
Dio

    PrestaShop Apprentice

  • Members
  • PipPip
  • 134 posts
Thanks for sharing…

#8
supness

    PrestaShop Newbie

  • Members
  • Pip
  • 4 posts
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

#9
Paul Bogdan

    PrestaShop Apprentice

  • Members
  • PipPip
  • 27 posts
this module have a lot of bugs

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

#10
Paul Bogdan

    PrestaShop Apprentice

  • Members
  • PipPip
  • 27 posts
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');
}

}


#11
likeminded

    PrestaShop Apprentice

  • Members
  • PipPip
  • 43 posts
This Module Didnt work for me just sent my page in to a refresh loop after configuring

#12
Radu

    PrestaShop Addict

  • Moderators
  • 572 posts
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.

#13
Fabrice

    PrestaShop Fanatic

  • Moderators
  • 3147 posts
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...
Fabrice
http://www.my-deco-shop.com
Projet en cours de lancement - New fantastic module: Checkout-Pro
le meilleur outil de gestion pour Prestashop que j'utilise - best tool I use: Store Commander

#14
ugur onur

    PrestaShop Apprentice

  • Members
  • PipPip
  • 423 posts
Thanks Radu..
Uğur Onur Urhan
uguronur.eu

#15
betch

    PrestaShop Newbie

  • Members
  • Pip
  • 4 posts
thanks Radu... just what i needed for my shop

#16
ugur onur

    PrestaShop Apprentice

  • Members
  • PipPip
  • 423 posts

From 1252086220:

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..

Attached Files


Uğur Onur Urhan
uguronur.eu

#17
antonescu

    PrestaShop Newbie

  • Members
  • Pip
  • 2 posts
hello Ugur Onur, do you have solved the problem with order email?

#18
ugur onur

    PrestaShop Apprentice

  • Members
  • PipPip
  • 423 posts

From 1282849712:

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...
Uğur Onur Urhan
uguronur.eu

#19
antonescu

    PrestaShop Newbie

  • Members
  • Pip
  • 2 posts
Ok, thanks for the reply. I hope we can solve this problem!