NorPrice. Second currency of any type. V4.03.

V12 Version using European Central Bank data for SellerDeck V10.
Requires PHP to be available on the web server.

Uses FancyBox V1 / JQuery for popup.

Converts a catalog to displaying a second price in another currency.  
This currency can be selected from a large list and is automatically updated daily.
This uses the European Central Bank public dataset.

INSTALLATION


This patch replaces the following file (in Site1) so back it up first.
It would be prudent to make a Snapshot first and back up all of Site1 as well.

ActinicOrder.pm

Once you've backed up these files, unzip this zipfile into Site1 (or your current Site folder),
overwriting the file ActinicOrder.pm.

Run SellerDeck and do File / Snapshot / Import Design.

Choose the file NorPriceV4-ECB.acd (from your Site folder) and proceed with the import.
SellerDeck may erroneously warn you that the import is not a design snapshot.  Ignore and OK this.

The import should have a description:

NorPrice. ECB Datafeed. Partial Site Design.
Safe to import into existing Site.
(c) 2007-2014 drillpine.biz


Go to Design / Library / Layouts / JavaScript Header Functions / Standard Javascript Header Functions
Scroll to the bottom and after all existing code add the line:

	<actinic:variable name="NorPriceSupport" />

OK out.


Go to Design / Additional File and click Add.  Set File of Type to All Files...
Look in your SellerDeck Site folder and select "norpricepopup.html" and hit Open.
Repeat for file "norpricejs.php".
Repeat for file "norpricenames.php".
Repeat for file "norpricegetecbrates.php".

OK out.

Close and restart SellerDeck and that's installation done.  
However you still have to decide how to call the price converter.



CUSTOMISATION

You will need to decide where and how you want the price selection to be done.
It can appear as a link to a popup on every page, or be put on a Brochure Fragment as embedded HTML.


DIALOGUE on POPUP PAGE

You can call a lightbox popup routine to set the currency.  This pops-up a drop-down list of available currencies. 
 
The easiest way to do this is to paste the following into Settings / Site Options / General /  Header Text

!!<<a href="javascript:norpricepopup();">Choose an alternate currency <img src="norpriceflags.gif" width=179 height=17 border=0></a>>!!


Alternatively you can use an image link (in your overall layout) like

<a href="javascript:norpricepopup();">Choose an alternate currency <img src="norpriceflags.gif" width=179 height=17 border=0></a>



DIALOGUE INLINE

You can display a drop-down list that selects a currency when it is changed.

To display the drop-down on every page, put the following into Settings / Site Options / General /  Header Text: 

	<select class="npinlinedd" onchange="npinlinedropdown(this)"><option value="">Choose a currency</option><script>generateecboptionnames();</script></select>

Or put the following code into any Layout: 

	<actinic:variable name="NorPriceDropDown" />

You can also put this into a Product or Fragment description via:

	!!<[NorPriceDropDown]>!!


	NOTES

Changing Look of the displayed price.  
This is done via Design / Library / Layouts / NorPrice / NorPrice Support.
Look there for the line:

.altprice {font-size: xx-small; color: blue;}

And change to suit your requirements.


UPGRADING SELLERDECK

The file ActinicOrder.pm is specific to each version of SellerDeck and will need to be replaced
with the appropriate NorPrice patched one if you upgrade SellerDeck.  
Contact info@drillpine.biz for this.  Or see www.drillpine.biz/actinicstuff


PREVIEWING

The currency control will show on Preview pages, but will only work after you've Uploaded at least once
and the system is connected to the internet.


RESTRICTING AVAILABLE CURRENCIES

If you want to show only a few currencies then go to Settings / Site Options / Properties, expand NorPrice
Set SHOWONLY to the range of ISO codes of currencies you wish to display.  Use a hyphen as separator.  E.g. EUR-JPY-USD
You don't need to include your home currency as this will be automatically added.


SHOWING THREE CURRENCIES

This patch will even work with a second currency set in SellerDeck (Design / Options / Miscellaneous / Price Display).
In this case you'll always get two currencies displayed, with a third being optional.  
You should inhibit the dynamic generated third currency from being set to the same as the alternate currency
Go to Settings / Site Options / Properties, expand NorPrice and set ALTCURRENCY to e.g. EUR
To re-enable this currency set ALTCURRENCY to null (empty).



SELECTING SPECIFIC CURRENCIES

You can make links that automatically switch on a particular currency.  The format is e.g.

<a href="javascript:norpricepopup('GBP');">UK</a>
<a href="javascript:norpricepopup('USD');">US$</a>
<a href="javascript:norpricepopup('EUR');">Euro</a>
<a href="javascript:norpricepopup();">Choose another currency</a>


will produce 3 links that when clicked will set the appropriate currency without a popup appearing.
The final link will open a normal popup where you can choose the required currency.



PRICES IN CHOICES

If you use prices in the descriptions of your Choices then you can install an optional
set of patches that will show a currency conversion on these choices.   This makes your pages
a little bigger so is left as optional.  Only install it if you need it.  
See NorPriceV4-PricesInChoicesSupplementalReadMe.txt for information and additional files.



UNINSTALLATION


Go to Design / Library / Layouts / JavaScript Header Functions / Standard Javascript Header Functions
Scroll to the bottom and remove the line:

	<actinic:variable name="NorPriceSupport" />


Go to Design / Library / Layouts / Prices

Right-click Product Price Excluding Tax and choose Revert To Factory Settings.

Right-click Product Price Including Tax and choose Revert To Factory Settings.

OK out


Copy ActinicOrder.pm from C:\Program Files (x86)\SellerDeck 2013\Original into your Site folder.



SNAPSHOT CONTENTS

Variables (* Selectors): 
	NorPriceDropDown *
	NorPriceSupport *
	HIDEFRACTIONRATE
	SHOWONLY
	ALTCURRENCY
	MAINCURRENCYSYMBOL
	MAINCURRENCY

Layouts : 
	Product Price Excluding Tax
	Product Price Including Tax
	NorPrice Drop Down
	NorPrice Support



CHANGE LOG

19-02-14 V4.03	Improvement.  Using jQuery for windows message to close Fancybox.  Better on IE8 and lower.
		Changes:
			norpricesupport.js					(fabcy_close)

02-10-13 V4.02	Popup now auto-closes in Preview on all browsers except Chrome (Chrome gets warning message).
		Added new feature - inline drop-down that immediately changes currency.
		Changes:
		    Variables:
			NorPriceDropDown *					(new)
		    Layouts:
			NorPrice Drop Down					(new)
		    Files:
			norpricejs.php						(added header)
			norpricepopup.html
			norpricesupport.js

01-10-13 V4.01	Dynamically load rates when Previewing.  No helper JS file generated.
		Changes:
		    Layouts:
			NorPrice Support
		    Files:	
			norpricepopup.html
			norpricejs.php
			norpricesupport.js

30-09-13 V4.00	All new ECB version using curl and SimpleXML.
		Changes:
		    everything.


02-11-10 V3.04	Bugfix.  Dollar based sites were not working on Product pages.
		Changes:
		    Files:
			norpricesupport.js
		    
29-07-10 V3.03	Bugfix.  Begnign misnamed variable in NorPrice Support ( $ missing from rates).
		Added Indian Rupee to norpricenames.php.
		Changes:
		    Layouts:
			NorPrice Support
		    Files:
			norpricenames.php

06-11-09 V3.02	Update.	Moved all </head> code to NorPrice Support.  
		Conditional loading of jQuery library (in case already in use by other add-on).
		Changes:
		    Layouts:
			NorPrice Support
		    Files:
			jquery.min.js 	(new - replaces jquery-1.3.2.min.js)

01-05-09 V3.01G	Greybox Redux variant.
		Use Greybox Redux / JQuery for popup page.
		Changes:
		    Files:
			norpricepopup.html
			this ReadMe (code above </head> area)
			blank.gif		(new)
			close.gif		(new)
			greybox.css		(new)
			greybox.js		(new)
			jquery-1.3.2.min.js	(new)
			overlay.png		(new)
		
		    Layouts:
			NorPrice Support

11-12-08 V3.01	Bugfix.  Prices above 999.00 were being misconverted due to embedded comma.  
		Changes:
		    Files:
			norpricesupport.js

28-09-08 V3.00	Based on V2.00 but uses European Central Bank datafeed instead of Textor.
		Requires PHP on server.
		Uses same cookie format as previous versions so should be upgradeable with no disruption.
		Changes:
			Everything (ActinicOrder.pm unchanged).

17-09-08 V2.00	Major update.  
		Now use class="NorPrice" tags throughout (no inline JavaScript).
		Use DOM loaded to activate conversion.
		Pass aruments to popup page via URL.
		Changes:
			Everything.

20-03-08  1.25  V9 Version.  No code changes.
		Files changed:
			NorPriceReadMe.txt (moved norpricesupport.js to above </head>)

08-03-07  1.25  Bugfix in Choices not working on logged in customers.
		Added text-only popup link to this Readme.
		Files changed:
			norpricesupport.js

08-03-07  1.24  Prices in Choices capability added.
		Files changed:
			norpricesupport.js
		Files created:
			V8NorPrice-PricesInChoicesReadMeV124.txt

06-03-07  1.23  No code changes.  V8 Installation made simpler.
		Files changed:
			This ReadMe (replaced manual install with Snapshot).  
		Files added:
			NorPrice.acd

06-10-06  1.22  V8 Version.

27-09-06  1.22  Price being displayed twice on logged-in pages if Use Relative CGI Url's set.
		Files changed:  
			norpricesupport.js

08-08-06  1.21  No code changes.  Moved Brochure info to separate document for clarity.
		Files changed:  
			NorPriceReadMe.txt
		Files added:
			NorPriceBrochurePageReadMe.txt

06-04-06  1.20	Amendment.  Workaround for Cart Refresh adding extra items.
		Files changed:
			norpricepopup.html

06-04-06  1.19	New feature.  Added comma separator every 3 digits.
		Files changed:
			norpricesupport.js
			ActinicOrder.pm

08-03-06  1.18	Simplification.  Amended Prices in Choices add-on to reduce size
		of generated code.
		Files changed:
			norpricesupport.js
			Act_VariantListHeader.html (in NorPrice-PricesInChoices.zip)
			Act_VariantListChoice.html (in NorPrice-PricesInChoices.zip)
			Act_VariantListFooter.html (in NorPrice-PricesInChoices.zip)

24-12-05  1.17  New feature.  Can pass desired country's ISO code to popup routine.
		routine will then preset that currency and automatically close.
		Also changed popup close timeout from 3000ms to 2000ms.
		Files changed:  
			norpricepopup.html
			NorPriceReadMe.txt (Act_primary.html code changed)

19-12-05  1.16  Updated Euro countries (Finland / Luxembourg were missing).
		Added optional (disabled) code to show non EU currencies ex-VAT.
		Files changed:  
			norpricesupport.js
			norpricepopup.html
			NorPriceReadMe.txt

30-05-05  1.15  Amended ActinicOrder.pm so that badly defined Customvars won't cause script errors.
		Files changed:  
			ActinicOrder.pm
			NorPriceReadMe.txt 

13-02-05  1.14  Added Custom Property SHOWONLY.  If set restricts currencies to defined ones.
		E.g. EUR-JPY-USD (use a "-" as separator).
		Also tidied up cookie code and maintaining of current selection.
		Made Brochure and Popup code the same. 
		Files changed:  norpricepopup.js, this ReadMe 
		all Primary Templates (additional CUSTOMVAR:SHOWONLY - from this readme)
                Brochure Fragment conversion code (from this readme).

26-01-05  1.13  Added additional currency pattern for choices like n.nn 
		(with optional leading + or -) e.g.  12.34  -12.34  +12.34
		Files changed:  norpricesupport.js, this ReadMe 
		all Primary Templates (additional CUSTOMVAR:MAINCURRENCYSYMBOL)

26-01-05  1.12  Added optional code to convert prices in Choices HTML for Name field.
		Any price within round brackets e.g. (n.nn) will be converted.
		Files changed: norpricesupport.js.
		New Files: Act_VariantCheckBox.html, Act_VariantRadioButton.html,
		Act_VariantListHeader.html, Act_VariantListChoice.html, Act_VariantListFooter.html 


22-01-05  1.11  Added cgiurl detection for systems who have weird cgi-bin locations.
		Replaced .toFixed(2) with own code as Safari doesn't support it.
		Files Changes: norpricesupport.js, patch to Primary Templates (in this readme). 

20-01-05  1.10  Shipping Version.   All new files start with "norprice"

17-01-05  1.05  Added Custom Property HIDEPENCERATE. 
		If exchange rate is > hidepencerate then don't show pennies. 
		Files changed: multipricesupport.js, ActinicOrder.pm, all Primary Templates. 

17-01-05  1.04	DKK was erronously in Euro list.
		Files changed: setcurrencypopup.html, brochure code (this readme)

17-01-05  1.03	Popup auto closes 3 seconds after changing currency.  Popup font Arial.
		Files changed: setcurrencypopup.html 

16-01-05  1.02	Amended multipricesupport.js to disable price generation on Cart Pages.
		Prevents duplicate alt price showing on Quantity on Confirmation Page.
		Files changed: multipricesupport.js

16-01-05  1.01  Amended to use MAINCURRENCY as inital value instead of hard coded GBP.
	 	Renamed HIDEALTCURRENCY to ALTCURRENCY.

16-01-05  1.00  Initial Release

