VirtueMart Forum

VirtueMart 2 + 3 + 4 => Product creation => Topic started by: ejd on December 26, 2011, 09:34:04 AM

Title: J15 -- Custom selection field dropdown ": free" -- how to remove ': free'?
Post by: ejd on December 26, 2011, 09:34:04 AM
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!


Title: Re: J15 -- Custom selection field dropdown ": free" -- how to remove ': free'?
Post by: Studio 42 on December 26, 2011, 10:04:32 AM
You can exchange the language string by "0",0$  or "same cost" or what you want.
Title: Re: J15 -- Custom selection field dropdown ": free" -- how to remove ': free'?
Post by: ejd on December 26, 2011, 10:47:08 AM
OK, but that was not my question.

How do you get rid of the colon  ":"   ?
Title: Re: J15 -- Custom selection field dropdown ": free" -- how to remove ': free'?
Post by: trevorsm on December 26, 2011, 12:27:23 PM
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;

}
Title: Re: J15 -- Custom selection field dropdown ": free" -- how to remove ': free'?
Post by: 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 ?>
Title: Re: J15 -- Custom selection field dropdown ": free" -- how to remove ': free'?
Post by: trevorsm on December 26, 2011, 16:16:45 PM
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>
Title: Re: J15 -- Custom selection field dropdown ": free" -- how to remove ': free'?
Post by: fxjunk on January 01, 2012, 04:48:25 AM
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.
Title: Re: J15 -- Custom selection field dropdown ": free" -- how to remove ': free'?
Post by: jenkinhill on January 01, 2012, 13:38:52 PM
The template files are in /components/com_virtuemart/views   - see http://forum.virtuemart.net/index.php?topic=90935.0 for help.
Title: Re: J15 -- Custom selection field dropdown ": free" -- how to remove ': free'?
Post by: 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 ?
Title: Re: J15 -- Custom selection field dropdown ": free" -- how to remove ': free'?
Post by: PRO on February 12, 2012, 14:39:18 PM
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