VirtueMart Forum

VirtueMart 2 + 3 + 4 => Product creation => Topic started by: Lexiboy on February 02, 2012, 12:52:44 PM

Title: How to override default price with custom field price
Post by: Lexiboy on February 02, 2012, 12:52:44 PM
My question is as the topic, how can I make the price in the custom fields override the productprice instead of adding to it? (I am using Virtuamart 2.0 on Joomla 1.7)

Right now I made the default price NULL and the custom field price is set to the actual price.

This does work by itself, though now the price is only listed at the custom fields and not at the place where you would normally find the custom price. What I did is just not how it is supposed to be...

Any advise is welcome.

Should I just wait for version 2.01?
Title: Re: How to override default price with custom field price
Post by: nebular on February 02, 2012, 14:08:31 PM
I need this funcionality too.

Please I wondering if there are someone that know how override the default price instead of adding to it?


Thanks in advance.
Title: Re: How to override default price with custom field price
Post by: Georgios Kolomvos on March 04, 2012, 01:54:46 AM
Quote from: Lexiboy on February 02, 2012, 12:52:44 PM
...how can I make the price in the custom fields override the productprice instead of adding to it? (I am using Virtuamart 2.0 on Joomla 1.7)

I use VM 2.5.1 and the problem is still there. I found a workaround that works fine to me:
Edit file administrator/components/com_virtuemart/helpers/calculationh.php
change line 316 from:
$basePriceShopCurrency = $basePriceShopCurrency + doubleval($variant);
to
$basePriceShopCurrency = doubleval($variant);

This way it replaces the base price with the variant price i.e. the price of the custom field instead of adding it.
Title: Re: How to override default price with custom field price
Post by: Lexiboy on March 05, 2012, 09:58:25 AM
Quote from: gkolomvos on March 04, 2012, 01:54:46 AM
Quote from: Lexiboy on February 02, 2012, 12:52:44 PM
...how can I make the price in the custom fields override the productprice instead of adding to it? (I am using Virtuamart 2.0 on Joomla 1.7)

I use VM 2.5.1 and the problem is still there. I found a workaround that works fine to me:
Edit file administrator/components/com_virtuemart/helpers/calculationh.php
change line 316 from:
$basePriceShopCurrency = $basePriceShopCurrency + doubleval($variant);
to
$basePriceShopCurrency = doubleval($variant);

This way it replaces the base price with the variant price i.e. the price of the custom field instead of adding it.

It would be safer to test if there is a variant before you replace anything. Thank you for sharing where to find the code.
Title: Re: How to override default price with custom field price
Post by: malibu2792 on March 13, 2012, 16:42:09 PM
How is this working for you ? Are you having any problems?
Title: Re: How to override default price with custom field price
Post by: alpertheidiot on April 02, 2012, 00:19:54 AM
cant find this in VM 2.0.3 (H). what do we need to change on this version?