VirtueMart Forum

VirtueMart 2 + 3 + 4 => Product creation => Topic started by: ntm91307 on November 06, 2017, 19:43:00 PM

Title: Custom Field - Remove "No Additional Charge" from custom field dropdown
Post by: ntm91307 on November 06, 2017, 19:43:00 PM
I have a few custom fields that offer many options on drop down lists for the customer.  The addition of the price or the words "No Additional Charge" is something I'd rather not have them see in the drop down.  I'll handle that myself in the item details. 

My versions of Joomla! and VM aren't the most current but I've enjoyed a VERY stable site for almost two years and would rather not have to apply any upgrades to do this.  A flick of a checkbox or insert/delete/modify some CSS or PHP code somewhere are methods I'm comfortable with.

How can I safely and easily remove this verbiage?

Thank you...

Joomla! Version: 3.6.5
VM3: 3.0.18
PHP: 5.5.38
Title: Re: Custom Field - Remove "No Additional Charge" from custom field dropdown
Post by: Jörgen on November 07, 2017, 06:54:59 AM
Hello

You can use the str_replace('No Additional Charge', '', $the_actual_item_str); and remove the text. Or You could find the text in the language file and remove it there.

I made something similar for VM 3.2.5 in sublayout/customfields.php approx line 53, replacing ( SEK 0,00) with nothing:


if (!empty($field->display)){ ?>
            <div class="product-field-display">
    <?php // JH 2017-10-14 
       echo str_replace('( SEK 0,00)'''$field->display);
            
?>

            </div>
        <?php 
          
}
        
?>



regards

Jörgen @ Kreativ Fotografi
Title: Re: Custom Field - Remove "No Additional Charge" from custom field dropdown
Post by: misholini on December 14, 2017, 09:51:18 AM
Jörgen,
I am on J.3.8.3 and VM 3.2.8 but can not find this ccode in  either:
/components/com_virtuemart/sublayouts/customfields.php  or
templates/MY-TemPlate/html/com_virtuemart/sublayouts/customfields.php

I have managed to remove the wording "No additional charge" in the drop down selection of custom fields via language override.
Further I handled the addition of the price for custom fields in:
/administrator/components/com_virtuemart/models/customfields.php
by amending: $price ="+".$price; (around line 918)
to: $price ="";
This worked before updating Virtuemart from ver 3.2.4 to ver 3.2.8
After update the file had been overwritten so I re-applied the above change but nevertheless the custom fileds price addition continues to appear in the dropdown (e.g. customfieldName +€10).
Any suggestions how to achieve this again?
Title: Re: Custom Field - Remove "No Additional Charge" from custom field dropdown
Post by: Studio 42 on December 14, 2017, 15:45:49 PM
This plugin https://shop.st42.fr/en/products/shortcodes.htm can disable price display.
See http://pro.st42.fr/en/shortcodes/test-product-no4.html OPTION LIST for eg.