VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: edsmiths on May 28, 2019, 13:22:37 PM

Title: [SOLVED] hide the price in product options - but recalculate the sales price
Post by: edsmiths on May 28, 2019, 13:22:37 PM
Hi there,

I'm not an expert on virtuemart and have been digging in the code to solve the following issue without success.

- I need to hide the increase (or decrease) price that shows on product's options dropdown list.

- However, I need to keep the sales price recalculation function.

Let' say that my product cost $100 and I have three options that change the sales price:
- option 1 (+$10)
- option 2 (+$20)
- option 3 (-$15)

Basically, I want to hide the value added or substracted by the option, but keep the sales price recalculation. So, if the client chose "option 1", he won't see that the increase will be ($10) but will see the sales price at $110.

Presuming in advance that you propably won't undertand my question, please have a look at the attached image.
https://www.dropbox.com/s/2dsfwfmw8k1e635/capture.PNG?dl=0 (https://www.dropbox.com/s/2dsfwfmw8k1e635/capture.PNG?dl=0)

virtuemart version: 3.0.12

Thanks,
Ed
Title: Re: hide the price in product options - but recalculate the sales price
Post by: Studio 42 on May 28, 2019, 14:57:43 PM
You can override components\com_virtuemart\sublayouts\customfield.php
in your template/html/virtuemart\sublayouts\customfield.php
For standard options search
$price = VirtueMartModelCustomfields::renderCustomfieldPrice($productCustom, $product, $calculator);
and replace with
$price = '';
You have some plugin that can handle this by default as my plugin https://shop.st42.fr/en/products/shortcodes.htm (https://shop.st42.fr/en/products/shortcodes.htm) or demo (https://pro.st42.fr/en/shortcodes (https://pro.st42.fr/en/shortcodes)) and perhaps breckdesign customfield for all.
                       
Title: Re: [SOLVED] hide the price in product options - but recalculate the sales price
Post by: edsmiths on May 29, 2019, 15:07:17 PM
Thanks Studio 42,

It's solved the issue.  Altough, not exacty the source code that you pointed (probably due to different VM version):

$price = VirtueMartModelCustomfields::_getCustomPrice($productCustom->customfield_price, $currency, $calculator);

Thaks again,
Ed