J15 -- Custom selection field dropdown ": free" -- how to remove ': free'?

Started by ejd, December 26, 2011, 09:34:04 AM

Previous topic - Next topic

ejd

This question has appeared on several threads but it has not been answered completely or directly.
Yes, in J17 you can do language overrides. But not in J15.

I finally got the Custom Selection Dropdown to work and show custom colors on a product.
But, I cannot get rid of the ": " that is appended to the colors:

     purple : free
     black : free

The word "free" is in the language file:  en-GB.com_virtuemart.ini
Deleting it from that file deletes the word but not the colon character.

How to remove the colon  ":"  ?

Where is this occurring?
How can I remove it?

Many thanks!



Studio 42

You can exchange the language string by "0",0$  or "same cost" or what you want.

ejd

OK, but that was not my question.

How do you get rid of the colon  ":"   ?

trevorsm

I had a similar problem but I also wanted to add a '+' plus sign in front of the currency symbol if the custom option was not free.

Look in /administrator/components/com_virtuemart/models/customfields.php
Around line 559 I changed the code to look like this:

if ($group->field_type == 'V'){
$default = current($group->options);
foreach ($group->options as &$productCustom) {
if ((float)$productCustom->custom_price ) {
$price = $currency->priceDisplay($calculator->calculateCustomPriceWithTax($productCustom->custom_price)) ;
$price = "+".$price;
}
else  $price = $free ;
$productCustom->text =  $productCustom->custom_value." ".$price;

}

PRO

trevorsm, no need to hack the core, replace it

To add +
<?php $field->display = str_replace( '$', '+$', $field->display ); ?><?php echo $field->display ?>

To remove :
<?php $field->display = str_replace( ':', '', $field->display ); ?><?php echo $field->display ?>

trevorsm

Agreed, a much better solution. But as my currency symbol was &pound; in the generated code I ended up with this:

<span class="product-field-display"><?php echo str_replace(':'' 'str_replace('&pound;'"+&pound;"$field->display)) ?></span><br>

fxjunk

Hi BanquetTables.pro,

Where can I view and change the coding for VirtueMart in VM2? I am using Joomla ver 1.7 hosted by CloudAccess.Net. From the template manager in Joolma, I can only view and edit Joolma template but I cannot find VirtueMart template.  Please help, thanks in advance.

jenkinhill

Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

steinmuhly

Quote from: BanquetTables.pro on December 26, 2011, 14:11:46 PM
trevorsm, no need to hack the core, replace it

To add +
<?php $field->display = str_replace( '$', '+$', $field->display ); ?><?php echo $field->display ?>

To remove :
<?php $field->display = str_replace( ':', '', $field->display ); ?><?php echo $field->display ?>
Hello,

in which file can i male this replace ? in a Override ?

PRO

Quote from: steinmuhly on February 12, 2012, 10:51:03 AM
Quote from: BanquetTables.pro on December 26, 2011, 14:11:46 PM
trevorsm, no need to hack the core, replace it

To add +
<?php $field->display = str_replace( '$', '+$', $field->display ); ?><?php echo $field->display ?>

To remove :
<?php $field->display = str_replace( ':', '', $field->display ); ?><?php echo $field->display ?>
Hello,

in which file can i male this replace ? in a Override ?


Well, you wanna change the product page right?

Look here
http://forum.virtuemart.net/index.php?topic=90935.0