PDA

View Full Version : Force display of other currency than default?


Kennett Square
2016-08-13, 08:20 PM
Hi there ladies! , I have scoured the vast ocean of zen cart related posts and cannot find the answer to this relatively simple problem:

What I hope to achieve:

Default/base currency: GBP
(currency in which I buy from the supplier and base my pricing on)

Displayed currency: Only EURO
(customers only in euro zone)

I dont want the customer to have the choice to select currencies, so I have gotten rid of the currency drop down. How do I get zen cart to always automatically display EURO when the a customer visits the store and not the default GBP.

Seems simple enough, maybe I have been a bit of a noon and missed this one!

Thanks in advanced

Oak View
2016-08-13, 08:21 PM
Well, you need to set the variable $_SESSION['currency'] to the right value.

So basically you need to have GBP and EURO enabled. THis would normally mean that the user could choose between the two. When they choose it sets $_SESSION['currency']. Instead of letting them choose you force that variable to be what you want.

If that is all greek to you just add this line

$_SESSION['currency'] = 'EUR';


At the bottom of the file includes/init_includes/init_currencies.php. It needs to go just above the '?>' at the end of the file.

And you need to check that you have euros enabled.

Oakwood Hills
2016-08-13, 08:23 PM
Just got to say niccol, you've saved me a lot of heartache. I was having big difficulties in getting different currencies to work with subdomains on a single template with the multi-site mod, the currency kept getting 'stuck' on the main domain. Your helpful tip was exactly what I needed. Wish I had found it sooner.

Thank you

Ocean Pines
2016-08-13, 08:24 PM
Hi,

This thing actually work but if I implement this, it is restricting the user to change to any other currency even if it is available in currency drop down menu. It just refuse to change.

Can anyone please suggest on how to manage non default currency on website but at the same time customers can still change if they want some other currency to show.

Thanking you in advance.

Oglala
2016-08-13, 08:27 PM
Try changing this line:


// If no currency is set, use appropriate default
if (!isset($_SESSION['currency']) && !isset($_GET['currency']) ) $_SESSION['currency'] = DEFAULT_CURRENCY;

to this:

// If no currency is set, use appropriate default
if (!isset($_SESSION['currency']) && !isset($_GET['currency']) ) $_SESSION['currency'] = 'EUR';

And getting rid of the other edit. Probably a better solution.