Author Topic: J15 -- Custom selection field dropdown ": free" -- how to remove ': free'?  (Read 2881 times)

ejd

  • Beginner
  • *
  • Posts: 22
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

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4048
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: J15 -- Custom selection field dropdown ": free" -- how to remove ': free'?
« Reply #1 on: December 26, 2011, 10:04:32 am »
You can exchange the language string by "0",0$  or "same cost" or what you want.

ejd

  • Beginner
  • *
  • Posts: 22
Re: J15 -- Custom selection field dropdown ": free" -- how to remove ': free'?
« Reply #2 on: December 26, 2011, 10:47:08 am »
OK, but that was not my question.

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

trevorsm

  • Beginner
  • *
  • Posts: 27
Re: J15 -- Custom selection field dropdown ": free" -- how to remove ': free'?
« Reply #3 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:

Code: [Select]
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

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10376
  • VirtueMart Version: 3+
Re: J15 -- Custom selection field dropdown ": free" -- how to remove ': free'?
« Reply #4 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 ?>
J3.9+ VM 3.4.2
Slowest Page Speed Score (88) (Category)
Fastest Page Speed Score (94-96) (productdetails)

trevorsm

  • Beginner
  • *
  • Posts: 27
Re: J15 -- Custom selection field dropdown ": free" -- how to remove ': free'?
« Reply #5 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:

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

fxjunk

  • Beginner
  • *
  • Posts: 1
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

  • UK Web Developer & Consultant
  • Global Moderator
  • Super Hero
  • *
  • Posts: 27577
  • Always on vacation
    • Jenkin Hill Internet
The template files are in /components/com_virtuemart/views   - see http://forum.virtuemart.net/index.php?topic=90935.0 for help.
Kelvyn

Jenkin Hill Internet,
Lowestoft, Suffolk, UK

Unsolicited PMs/emails will be ignored.

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

Currently using VM 3.6.8 10204 on Joomla 3.9.13 PHP 7.0.33

steinmuhly

  • Beginner
  • *
  • Posts: 5
Re: J15 -- Custom selection field dropdown ": free" -- how to remove ': free'?
« Reply #8 on: February 12, 2012, 10:51:03 am »
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

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10376
  • VirtueMart Version: 3+
Re: J15 -- Custom selection field dropdown ": free" -- how to remove ': free'?
« Reply #9 on: February 12, 2012, 14:39:18 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
J3.9+ VM 3.4.2
Slowest Page Speed Score (88) (Category)
Fastest Page Speed Score (94-96) (productdetails)