[FIX] Invoice Email in default currency

For articles specific to version 6.x
Post Reply
Martin
Site Admin
Site Admin
Posts: 1854
Joined: Wed Jun 17, 2009 6:30 pm
Location: South Yorkshire UK
Contact:

[FIX] Invoice Email in default currency

Post 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
Tony Barnes
Posts: 744
Joined: Thu Jun 18, 2009 8:59 am

Re: [FIX] Invoice Email in default currency

Post by Tony Barnes »

Nice, bonkers that it wouldn't be like this anyway..!!
Martin
Site Admin
Site Admin
Posts: 1854
Joined: Wed Jun 17, 2009 6:30 pm
Location: South Yorkshire UK
Contact:

Re: [FIX] Invoice Email in default currency

Post 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...
pbanks
Posts: 8
Joined: Sat Mar 05, 2011 10:35 pm
Location: Ireland

Re: [FIX] Invoice Email in default currency

Post 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 ...
Snooper
Posts: 264
Joined: Sat Jun 26, 2010 9:22 pm

Re: [FIX] Invoice Email in default currency

Post 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!
ISC 5.5.4 Ultimate : Being used here -- http://www.kdklondon.com
Post Reply