Page 1 of 1

Core files mod, will this cause unexpected errors?

Posted: Tue Feb 28, 2012 5:13 pm
by Xellz
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()); ?>

Re: Core files mod, will this cause unexpected errors?

Posted: Tue Feb 28, 2012 10:32 pm
by Qphoria
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.

Re: Core files mod, will this cause unexpected errors?

Posted: Wed Feb 29, 2012 12:31 am
by Xellz
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)

Re: Core files mod, will this cause unexpected errors?

Posted: Wed Feb 29, 2012 12:54 am
by Qphoria
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