News:

Support the VirtueMart project and become a member

Main Menu

remove +price on customfield on 3.0.6

Started by prismadigitale, March 05, 2015, 08:38:54 AM

Previous topic - Next topic

prismadigitale

I want to delete in the dropdown variant cart the additional price (eg: +15.40) in previous versions it was enough to change: administrator / components / com_virtuemart / models / customefields.php .............. ...... if ($ group-> field_type == 'V') {$ default = current ($ group-> options); foreach ($ group-> options as $ productCustom) {price = self :: $ _ getCustomPrice ($ productCustom-> custom_price, $ currency, $ calculator);

// DELETE ROW AND WRITE THIS = $ productCustom-> text = vmText :: _ ($ productCustom-> custom_value). ''. $ price; $ productCustom-> text = vmText :: _ ($ productCustom-> custom_value); } $ Group-> display = VmHTML :: select ('customPrice ['. $ Row. '] ['. $ Group-> virtuemart_custom_id. ']', $ Group-> options, $ default-> custom_value, '', 'virtuemart_customfield_id', 'text', false, false);

in version 3.0.6 as I do? the custom field is of type string dropdown variant cart ...

Milbo

the code is, around line 1091

$trValue = vmText::_($productCustom->customfield_value);
if($productCustom->customfield_value!=$trValue and strpos($trValue,'%1')!==false){
$productCustom->text = vmText::sprintf($productCustom->customfield_value,$price);
} else {
$productCustom->text = $trValue.' '.$price;
}


But actually it would be simpler on the long run, to add a config setting to the custom itself, which disables the price, would be just a new type in getVarsToPush of the custom model.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

prismadigitale

ok I had made this change around line 1311:
      if ((float)$customPrice) {
         $price = strip_tags ($currency->priceDisplay ($calculator->calculateCustomPriceWithTax ($customPrice)));
         if ($customPrice >0) {
//modificato era così---$price ="+".$price;
            $price ="";
         }
      }
is correct or is it better that I make the change suggested by you? thank you