Page 1 of 1

Completely replacing original price with alt price?

Posted: Thu Oct 16, 2014 12:54 pm
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

Re: Completely replacing original price with alt price?

Posted: Thu Oct 16, 2014 9:38 pm
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.

Re: Completely replacing original price with alt price?

Posted: Thu Oct 23, 2014 11:28 am
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

Re: Completely replacing original price with alt price?

Posted: Thu Oct 23, 2014 12:11 pm
by norman
Apologies. Typo in the very last Replace / With, above.

Now corrected. Redo that last line.

Re: Completely replacing original price with alt price?

Posted: Fri Aug 21, 2015 11:21 am
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

Re: Completely replacing original price with alt price?

Posted: Fri Aug 21, 2015 12:46 pm
by norman
Confused. You mention NorPrice V5 (which I sent you in January 2015) but seem to be using NorPrice V4.

Re: Completely replacing original price with alt price?

Posted: Mon Aug 24, 2015 4:08 pm
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?

Re: Completely replacing original price with alt price?

Posted: Mon Aug 24, 2015 6:58 pm
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.

Re: Completely replacing original price with alt price?

Posted: Wed Sep 02, 2015 9:58 am
by chrisdicken
Thanks Norman - that's excellent