Completely replacing original price with alt price?

Automatic multi currency display on entire catalog.

Run your catalog in a main currency (or a main and alternate) with the customer having the option to turn on an additional currency throughout the Catalog, Cart and Checkout.
Post Reply
chrisdicken
Posts: 25
Joined: Wed May 28, 2008 5:30 pm

Completely replacing original price with alt price?

Post by chrisdicken »

Hi Norman

I have a customer who doesn't want to show the old price at all when customers choose to see the new alt price. Is there a way to completely replace it? Or hide the original with CSS? it would also require removing the brackets from around the alt price.

Thanks

Chris DIcken
norman
Site Admin
Posts: 1252
Joined: Sat Feb 07, 2004 9:55 pm

Re: Completely replacing original price with alt price?

Post by norman »

The prices on the Product layouts shouldn't be too hard. Try this:

Edit norpricesupport.js (in your Site folder - back it up first).

Replace line:

Code: Select all

			return prefix + ' (' + optplus + CommaFormatted(Math.round(altprice)) + ' ' + isoname + ')' + suffix;
With:

Code: Select all

			return prefix + ' ' + optplus + CommaFormatted(Math.round(altprice)) + ' ' + isoname + '' + suffix;
Replace line:

Code: Select all

			return prefix + ' (' + optplus + CommaFormatted(altprice.toFixed(2)) + ' ' + isoname + ')' + suffix;
With:

Code: Select all

			return prefix + ' ' + optplus + CommaFormatted(altprice.toFixed(2)) + ' ' + isoname + '' + suffix;
Replace line:

Code: Select all

		return val[1] + val[2] + val[3] + getalt(thisval, formatted) + val[4];		// return potentially converted text
With:

Code: Select all

		return val[1] + getalt(thisval, formatted) + val[4];		// return potentially converted text
The Cart needs ActinicOrder.pm tweaked (in your Site folder - back it up first). Try this:

Replace line:

Code: Select all

				$sFormattedPrice .= ' (' . CommaFormatted(int($nNorprice + .5 * ($nNorprice <=> 0))) . " $iso)";
With:

Code: Select all

				$sFormattedPrice = CommaFormatted(int($nNorprice + .5 * ($nNorprice <=> 0))) . " $iso";
Replace line:

Code: Select all

				$sFormattedPrice .= ' (' . CommaFormatted(sprintf("%1.2f", $nNorprice)) . " $iso)";
With:

Code: Select all

				$sFormattedPrice = CommaFormatted(sprintf("%1.2f", $nNorprice)) . " $iso";
Minor quirk is that the Cart Summary will only update when a Perl based page is called.
Norman
chrisdicken
Posts: 25
Joined: Wed May 28, 2008 5:30 pm

Re: Completely replacing original price with alt price?

Post by chrisdicken »

Thanks so much for the help Norman.

This works great in the store pages, but unfortunately in the basket the prices both appear and are just run together like this:

£44.5071.42 USD

Any suggestions gratefully received!

Thanks

Chris Dicken
norman
Site Admin
Posts: 1252
Joined: Sat Feb 07, 2004 9:55 pm

Re: Completely replacing original price with alt price?

Post by norman »

Apologies. Typo in the very last Replace / With, above.

Now corrected. Redo that last line.
Norman
chrisdicken
Posts: 25
Joined: Wed May 28, 2008 5:30 pm

Re: Completely replacing original price with alt price?

Post by chrisdicken »

Hi Norman

Having upgraded to v5 of NorPrice, we've only just realised the prices in the cart and checkout at http://www.anythinglefthanded.co.uk/ no longer update and show the changed currency.

I'm guessing the JavaScript change (to hide the original price) doesn't affect the cart and checkout. Any suggestions of what changes need to me made to a 14.0.3 perl script to make it all happen?

Thanks

Chris Dicken
norman
Site Admin
Posts: 1252
Joined: Sat Feb 07, 2004 9:55 pm

Re: Completely replacing original price with alt price?

Post by norman »

Confused. You mention NorPrice V5 (which I sent you in January 2015) but seem to be using NorPrice V4.
Norman
chrisdicken
Posts: 25
Joined: Wed May 28, 2008 5:30 pm

Re: Completely replacing original price with alt price?

Post by chrisdicken »

A HA - that explains one of my issues! I'll set up a test site and upgrade the plugin to v5 and see how I get on.

I assume that I can make the same change as mentioned before to the js file to hide the original price?
norman
Site Admin
Posts: 1252
Joined: Sat Feb 07, 2004 9:55 pm

Re: Completely replacing original price with alt price?

Post by norman »

Hi, Chris

NorPrice V5 doesn't need any patched Perl scripts and should be able to convert all prices that are displayed on all types of pages. Basically it scans the DOM for snippets of text that look like prices and adds the extra currency after them if a match is found.

NorPrice V5 is significantly different in operation so new changes are needed. Try using the attached file after upgrading to V5. Note that it must be saved as "norpricesupport.js" to work properly.

It may be worth renaming the original norpricesupport.js and using WinMerge to compare them to see what the changes are.
Attachments
norpricesupport-HideHomeCurrencyIfNorPriceInUse.zip
(4.49 KiB) Downloaded 785 times
Norman
chrisdicken
Posts: 25
Joined: Wed May 28, 2008 5:30 pm

Re: Completely replacing original price with alt price?

Post by chrisdicken »

Thanks Norman - that's excellent
Post Reply