Post by Xellz » Tue Feb 28, 2012 5:13 pm

I was thinking of a way, how to display price in default and selected currency and checkout with only default currency. Realized there was simple solution to my problem, it works on local copy of opencart. However i'm not sure if it will cause some unexpected problems or even abuse, a bit scary to apply to live shop :) I'm missing something here?

Here is what i did:
1. In system\library\currency.php i added a default value to $currency, instead of ' '.

Code: Select all

format($number, $currency = 'JPY', $value = '', $format = true)
2. In catalog\controller\payment\pp_standard.php changed this (i'm using only paypal):

Code: Select all

			
if (in_array($order_info['currency_code'], $currencies)) {
	$currency = $order_info['currency_code'];
} else {
	$currency = 'USD';
	}
to simply

Code: Select all

$currency = 'JPY';
3. To display price in selected currency i'm simply adding this code in template files where i need

Code: Select all

<?php echo $this->currency->format($product_info['price'], $this->currency->getCode()); ?>

Japanese green tea


New member

Posts

Joined
Fri Feb 11, 2011 8:55 pm

Post by Qphoria » Tue Feb 28, 2012 10:32 pm

Not quite sure I fully understand what you are trying to do, but might be an easier way. You simply want to force your default currency for checkout, but want to show the customer selected currency on the site? Then the change you made in step 2 should be enough.

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by Xellz » Wed Feb 29, 2012 12:31 am

Qphoria wrote:Not quite sure I fully understand what you are trying to do, but might be an easier way. You simply want to force your default currency for checkout, but want to show the customer selected currency on the site? Then the change you made in step 2 should be enough.
Thanks, seems i can apply this change without worry. I made 1 and 3 steps, so customers won't be confused on checkout, why currency changed again etc. I want to show something like this:
Price: ¥8,000 ($100)

Japanese green tea


New member

Posts

Joined
Fri Feb 11, 2011 8:55 pm

Post by Qphoria » Wed Feb 29, 2012 12:54 am

Well if it works then that is all that matters.
Tho you should make it as a vQmod script to avoid the code from being overwritten from and upgrade

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am
Who is online

Users browsing this forum: sammysomerset and 39 guests