Page 1 of 1

[FIX] Invoice Email in default currency

Posted: Tue Dec 14, 2010 12:03 pm
by Martin
Up until now all invoice views (printable, completed/pending, etc.. ) were in the customer chosen currency except the emailed invoice. This removes the inconsistency.



Compatibility: developed for 6.1.1 (probably applicable with minor variation to $order_row field value for earlier versions)
Note: Currently untested (will confirm shortly).

Open: /lib/orders.php

Find:

Code: Select all

// All prices in the emailed invoices will be shown in the default currency of the store
Replace with:

Code: Select all

// MOD: All prices in the emailed invoices will be shown in the customers preferred currency (Not the default)
Find:

Code: Select all

	$GLOBALS['TotalCost'] = FormatPrice($order_row['total_inc_tax'], false, true, false, $defaultCurrency, true);
Replace with:

Code: Select all

// MOD Currency values shown (Not default)
	//$GLOBALS['TotalCost'] = FormatPrice($order_row['total_inc_tax'], false, true, false, $defaultCurrency, true);
	$GLOBALS['TotalCost'] = CurrencyConvertFormatPrice($order_row['total_inc_tax'], $order_row['ordcurrencyid'], $order_row['ordcurrencyexchangerate'], true);
// MOD END

Find:

Code: Select all

		$GLOBALS['ProductPrice'] = FormatPrice($product_row[$itemPriceColumn], false, true, false, $defaultCurrency, true);
		$GLOBALS['ProductTotal'] = FormatPrice($product_row[$itemTotalColumn], false, true, false, $defaultCurrency, true);
Replace with:

Code: Select all

// MOD Currency values shown (Not default)
		//$GLOBALS['ProductPrice'] = FormatPrice($product_row[$itemPriceColumn], false, true, false, $defaultCurrency, true);
		$GLOBALS['ProductPrice'] = CurrencyConvertFormatPrice($product_row[$itemPriceColumn], $order_row['ordcurrencyid'], $order_row['ordcurrencyexchangerate'], true);
		//$GLOBALS['ProductTotal'] = FormatPrice($product_row[$itemTotalColumn], false, true, false, $defaultCurrency, true);
		$GLOBALS['ProductTotal'] = CurrencyConvertFormatPrice($product_row[$itemTotalColumn], $order_row['ordcurrencyid'], $order_row['ordcurrencyexchangerate'], true);
// MOD END

Find:

Code: Select all

		$emailTemplate->assign('value', formatPrice($row['value'], false, true, false, $defaultCurrency, true));
Replace with:

Code: Select all

// MOD Currency values shown (Not default)
		//$emailTemplate->assign('value', formatPrice($row['value'], false, true, false, $defaultCurrency, true));
		$emailTemplate->assign('value', CurrencyConvertFormatPrice($row['value'], $order_row['ordcurrencyid'], $order_row['ordcurrencyexchangerate'], true));
// MOD END

Re: [FIX] Invoice Email in default currency

Posted: Tue Dec 14, 2010 2:50 pm
by Tony Barnes
Nice, bonkers that it wouldn't be like this anyway..!!

Re: [FIX] Invoice Email in default currency

Posted: Tue Dec 14, 2010 10:52 pm
by Martin
Gets a lot more interesting later on and there's a few extra files to modify but interestingly the notification email (send to admins) is hard coded to the default currency which makes for interesting mod'ing fun.

I have to say the short sighted remit on the code is still shining through, with no thought given for multi-currency transaction ability, just lip service.

Frustrating but thankfully I've found most of my way around it...

Re: [FIX] Invoice Email in default currency

Posted: Sun Mar 06, 2011 3:18 pm
by pbanks
Thanks for that brilliant "mod" Martin. I sell in Euro, Sterling and US dollars (via eBay in particular) and yet in admin panel ALL order values are shown in the default current (Euro) despite the order being made in a different currency. Stupid or what?

This is an excellent forum that I only discovered yesterday after a year or so of using ISC. Great product but lousy "official" support ...

Re: [FIX] Invoice Email in default currency

Posted: Thu Mar 10, 2011 11:32 pm
by Snooper
Has this mod been tested on an older version of ISC?

Because if it works it is clearly a 'proper' addition to have for customers and ourselves on site!