VirtueMart Forum

VirtueMart 2 + 3 => Product pricing => Topic started by: servlet on April 06, 2016, 08:05:17 am

Title: [HACK Solved]How to hide or replace prices in customfields?
Post by: servlet on April 06, 2016, 08:05:17 am
Hello
Is it possible to hide prices in customfields for non logged users or catalog view? OR how to replace prices with ASK FOR PRICE. Catalog view is not correct as I described here http://forum.virtuemart.net/index.php?topic=133748.0 No bode mark it as a BUG.... so I am looking for way to solve this problem.
Thank you
Title: Re: How to hide or replace prices in customfields?
Post by: servlet on April 08, 2016, 16:39:33 pm
NOTE: If you update VM dont forget to change again. To this moment this is a hack, and it is not improved by VM team. I hope to add option in configuration section shop hide price in custom field or hide in catalogue mode

If you want to do this you must replace
/administrator/components/com_virtuemart/models/customfields.php

It usable if price of custom field is >0 If it is =0 you will see No additional charge (you can edit language file to change it)

Line 874
Code: [Select]
$price ="+".$price;
with

Code: [Select]
$price ="- Ask for price";
or

If you dont want to display anything use this:

Code: [Select]
$price ="";
Title: Re: [HACK Solved]How to hide or replace prices in customfields?
Post by: misholini on December 14, 2017, 04:06:34 am
$price =""; -> This used to work for me, but ever since I updated Virtuemart to ver. 3.2.8 it does not work anymore and I see variants price additions showing in the drop down. (e.g product variant +/- price difference).
Any suggestions how to remove +/- price difference?
Title: Re: [HACK Solved]How to hide or replace prices in customfields?
Post by: servlet on December 14, 2017, 11:59:41 am
Hack it again ;)
You have to hack the core every time when you update VM
Title: Re: [HACK Solved]How to hide or replace prices in customfields?
Post by: Studio 42 on December 14, 2017, 15:43:10 pm
You can use https://shop.st42.fr/en/products/shortcodes.htm see Cart Dropdown list
In the plugin, you have an option to hide price.
See http://pro.st42.fr/en/shortcodes/test-product-no4.html OPTION LIST for eg.
Title: Re: [HACK Solved]How to hide or replace prices in customfields?
Post by: servlet on December 16, 2017, 10:52:44 am
Sounds good :)
Title: Re: [HACK Solved]How to hide or replace prices in customfields?
Post by: marvays on May 14, 2019, 11:37:00 am
I try delete line 919 - 945:
Code: [Select]
if ((float)$customPrice) {

if ($customPrice > 0) {
$sign = vmText::_('COM_VM_PLUS');
} else {
$sign = vmText::_('COM_VM_MINUS');
}

if(empty($productCustom->multiplyPrice)){
$calculator->setProduct($product);
$v = strip_tags ($calculator->_currencyDisplay->priceDisplay ($calculator->calculateCustomPriceWithTax ($customPrice)));
if ($customPrice < 0) {
$v = trim($v,'-');
}
$price = vmText::sprintf('COM_VM_CUSTOMFIELD_VARIANT_PRICE',$sign,$v);
} else {
$v = trim($productCustom->customfield_price,0);
$v = trim($v,'.');
$price = vmText::sprintf('COM_VM_CUSTOMFIELD_VARIANT_PERCENTAGE',$sign,$v);

}

}
else {
$price = ($customPrice === '') ? '' :  vmText::sprintf('COM_VIRTUEMART_CART_PRICE_FREE',$calculator->_currencyDisplay->getSymbol());
}
return $price;

and work it :)
Title: Re: [HACK Solved]How to hide or replace prices in customfields?
Post by: joshry101 on August 07, 2019, 14:55:18 pm
I used to use
$price =" ".$price;
To remove the '+' sign from the front end
Since upgrading to 3.4.2 this hack no longer works
Any ideas? Thanks
Title: Re: [HACK Solved]How to hide or replace prices in customfields?
Post by: StefanSTS on August 07, 2019, 15:58:27 pm
Didn't it help to set COM_VM_PLUS and COM_VM_MINUS to ""?

Title: Re: [HACK Solved]How to hide or replace prices in customfields?
Post by: wendy1 on September 06, 2019, 01:03:44 am
Hello where do I edit this? I upgraded VM to the latest version and now all my custom fields display this message COM_VM_CUSTOMFIELD_VARIENT_PRICE. I have different prices for certain sizes. Any advice would be greatly appreciated.
Title: Re: [HACK Solved]How to hide or replace prices in customfields?
Post by: GJC Web Design on September 06, 2019, 08:42:12 am
hmm .. have u tried making a Joomla language over ride for COM_VM_CUSTOMFIELD_VARIENT_PRICE ?
Title: Re: [HACK Solved]How to hide or replace prices in customfields?
Post by: Milbo on September 18, 2019, 22:32:38 pm
You need
COM_VM_CUSTOMFIELD_VARIANT_PRICE="%1$s%2$s"

and used in models/customfields.php line 963
$price = vmText::sprintf('COM_VM_CUSTOMFIELD_VARIANT_PRICE',$sign,$v);

not varient. We have no COM_VM_CUSTOMFIELD_VARIENT_PRICE in the code.