VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: Greatdanes on June 27, 2014, 14:25:47 PM

Title: Discount mistake in amount saved
Post by: Greatdanes on June 27, 2014, 14:25:47 PM
How come my VM is showing the discount the costumer can save as a negative amount like "you save -400,00" instead of "you save 400,00"?
Title: Re: Discount mistake in amount saved
Post by: Greatdanes on July 27, 2014, 07:12:28 AM
Let me rephrase the question then - how do you fix it in the VM default template?
Title: Re: Discount mistake in amount saved
Post by: AH on July 27, 2014, 11:53:04 AM
You need to do a template override for the prices
Title: Re: Discount mistake in amount saved
Post by: Greatdanes on July 28, 2014, 09:27:50 AM
So it's normal to type it "you save -400,00"?
Title: Re: Discount mistake in amount saved
Post by: AH on July 28, 2014, 10:27:48 AM
Yep that does sound odd!
Title: Re: Discount mistake in amount saved
Post by: GJC Web Design on July 28, 2014, 10:33:25 AM
that is standard - it changed around 2.0.20 something from a positive to a negative value - I know cos it broke a script we had to update a 3rd party DB..

I wrote a post here somewhere about the way to re-display it but buggered if I can find it - (is it just me or is this forum search bollocks? I rarely find anything I'm looking for.. hmmmm)
Title: Re: Discount mistake in amount saved
Post by: GJC Web Design on July 28, 2014, 11:09:59 AM
is this in the cart with coupon or a discount on a product page?
Title: Re: Discount mistake in amount saved
Post by: Greatdanes on July 28, 2014, 20:23:05 PM
It's on the product page like this

Old Price 1000,-
New Price 600,-
You save -400,-

That is for me looking strange.
Title: Re: Discount mistake in amount saved
Post by: GJC Web Design on July 28, 2014, 21:41:41 PM
there is no text "you save" in Vm - so you must be using a third party template

normally it would be

Old Price 1000,-
New Price 600,-
Discount  -400,-

but just find the generated figure and php abs it...

http://www.w3schools.com/php/func_math_abs.asp

something like

echo abs($this->currency->createPriceDiv ('discountAmount', 'COM_VIRTUEMART_PRODUCT_DISCOUNT_AMOUNT', $this->product->prices));

or what ever is rendering the discount
Title: Re: Discount mistake in amount saved
Post by: Greatdanes on July 30, 2014, 20:06:26 PM
True it's not "you save" it's show and it's done in the language fil "en-GB.com_virtuemart.ini" - COM_VIRTUEMART_CART_SUBTOTAL_DISCOUNT_AMOUNT="Discount"

"You save" is my version of it :)

But somewhere in the programmering there must be a place where it's set to show negativ discount if used and I want the alternativ to change it to a positiv nummer but can't find that place  ;D
Title: Re: Discount mistake in amount saved
Post by: GJC Web Design on July 30, 2014, 21:10:01 PM
it is buried in the helpers/calculationh.php but if you start messing in there your nuts ..  ;)

just abs() it in the template
Title: Re: Discount mistake in amount saved
Post by: Greatdanes on August 02, 2014, 07:24:54 AM
Sure I will do it the easy way - just need to learn and find that.

But thanks for the inputs - great to get enlightened  ;)