Author Topic: [Bug] Custom field title appears twice  (Read 4184 times)

andrey

  • Beginner
  • *
  • Posts: 16
[Bug] Custom field title appears twice
« on: May 03, 2012, 09:14:15 am »
I've added a custom field to the product - 'Custom Field Text Input' plugin. And the field title appears twice in the cart.

[attachment cleanup by admin]

andrey

  • Beginner
  • *
  • Posts: 16
Re: [Bug] Custom field title appears twice
« Reply #1 on: May 03, 2012, 10:41:50 am »
This code is from customfields.php in CustomsFieldCartDisplay function:
Code: [Select]
foreach ($variantmods as $variant=>$selected){
if ($selected) {
$productCustom = self::getProductCustomFieldCart ($selected );
if(!empty($productCustom)){
$html .= ' <span class="product-field-type-'.$productCustom->field_type.'">';
$value ='';
if ($productCustom->field_type == "E") {

} elseif (($productCustom->field_type == "G")) {
$child = self::getChild($productCustom->custom_value);
// $html .= $productCustom->custom_title.' '.$child->product_name;
$value = $child->product_name;
} elseif (($productCustom->field_type == "M")) {
// $html .= $productCustom->custom_title.' '.self::displayCustomMedia($productCustom->custom_value);
$value = self::displayCustomMedia($productCustom->custom_value);
} elseif (($productCustom->field_type == "S")) {
// q $html .= $productCustom->custom_title.' '.JText::_($productCustom->custom_value);
$value = $productCustom->custom_value;
} else {
// $html .= $productCustom->custom_title.' '.$productCustom->custom_value;
$value = $productCustom->custom_value;
}
$html .=ShopFunctionsF::translateTwoLangKeys($productCustom->custom_title,$value);

$html .= '</span>';
} else {
vmdebug('CustomsFieldCartDisplay, $productCustom is empty ');
}

}
$row++;
}
if ($variantmods ) {
$product = self::addParam($product);
if(!class_exists('vmCustomPlugin')) require(JPATH_VM_PLUGINS.DS.'vmcustomplugin.php');
JPluginHelper::importPlugin('vmcustom');
$dispatcher = JDispatcher::getInstance();
$dispatcher->trigger('plgVmOnViewCart',array($product, $row,&$html));

}

You see, that we add html code for every field, including the plugin type (E) fields:
Code: [Select]
$html .=ShopFunctionsF::translateTwoLangKeys($productCustom->custom_title,$value);And after that, we trigger 'plgVmOnViewCart' and custom plugin itself add its value to html:
Code: [Select]
$dispatcher->trigger('plgVmOnViewCart',array($product, $row,&$html));
That is why we got title appears twice. I think we need to skip E-type fields in the loop and don't add any html code for them.

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 10070
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: [Bug] Custom field title appears twice
« Reply #2 on: May 03, 2012, 11:23:08 am »
haha funny, I fixed this also yesterday. Please check the latest svn or the new version of today.
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

andrey

  • Beginner
  • *
  • Posts: 16
Re: [Bug] Custom field title appears twice
« Reply #3 on: May 03, 2012, 11:35:53 am »
Great! Thanks! Is 2.0.7 the latest?

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 10070
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: [Bug] Custom field title appears twice
« Reply #4 on: May 03, 2012, 11:54:37 am »
It will be in 2.0.7a
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

andrey

  • Beginner
  • *
  • Posts: 16
Re: [Bug] Custom field title appears twice
« Reply #5 on: May 03, 2012, 12:09:47 pm »
Just checked th SVN. Don't you think we mess up <span> tags here? We add open tag, and continue without closing it:
Code: [Select]
$html .= ' <span class="product-field-type-'.$productCustom->field_type.'">';
$value ='';
if ($productCustom->field_type == "E") {
continue;
} elseif (($productCustom->field_type == "G")) {
...
} else {
// $html .= $productCustom->custom_title.' '.$productCustom->custom_value;
$value = $productCustom->custom_value;
}
$html .=ShopFunctionsF::translateTwoLangKeys($productCustom->custom_title,$value);
$html .= '</span><br />';

$html .= ' <span class="product-field-type-'.$productCustom->field_type.'">'; - will add start <span> tag, but the closing tag for the <span> would not be added if $productCustom->field_type == "E".

Actlas

  • Jr. Member
  • **
  • Posts: 69
Re: [Bug] Custom field title appears twice
« Reply #6 on: May 19, 2012, 18:22:16 pm »
Sorry for repeating this question in the forums but this field is still displayed twice in 2.0.7c.

The biggest problem is although it is displayed twice in the cart it doesn't get added to the order in VM itself.
You can see the values in the DB though...

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 10070
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: [Bug] Custom field title appears twice
« Reply #7 on: May 20, 2012, 19:49:47 pm »
Okey, rechecked. Please test.
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Actlas

  • Jr. Member
  • **
  • Posts: 69
Re: [Bug] Custom field title appears twice
« Reply #8 on: May 21, 2012, 08:40:32 am »
Which files should I update now? Using the SVN repository, or how?

Actlas

  • Jr. Member
  • **
  • Posts: 69
Re: [Bug] Custom field title appears twice
« Reply #9 on: May 24, 2012, 18:38:09 pm »
Milbo, could you please tell me what exactly should be updated and how?
We cannot simply update our entire website at this moment.

kfirc3

  • Beginner
  • *
  • Posts: 4
Re: [Bug] Custom field title appears twice
« Reply #10 on: June 07, 2012, 20:24:18 pm »
can you guide me how to fix that ?

dirkb

  • Jr. Member
  • **
  • Posts: 74
Re: [Bug] Custom field title appears twice
« Reply #11 on: July 31, 2012, 17:54:24 pm »
I checked a few weeks ago on that thread, since I have the same problem. As of today, I still have it with VM 2.0.8e - is there a solution for that ? Thanks d.

chetanmadaan

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 291
Re: [Bug] Custom field title appears twice
« Reply #12 on: September 12, 2012, 02:33:07 am »
i am using 2.0.8e and i am having the same problem.

specifically, it doesn't comes up twice... but comes up the number of plugin custom fields we have published in the cart.

for instance if we have three custom fields... it would display all the cart variant fields three times

fishbones

  • Beginner
  • *
  • Posts: 6
Re: [Bug] Custom field title appears twice
« Reply #13 on: December 23, 2012, 18:42:00 pm »
Hi

We are having this Problem too.
We have setup some Costom stockable variants.
They do apear several times on my cart.
If a product has 3 Costom stockable variants, they apear 3 times.
If a product has 2 Costom stockable variants, they apear 2 times.
and so on...

any ideas hox to solve this problem?

We are working with:
Joomla! 2.5.7
VirtueMart 2.0.12


MANY THANKS FOR YOUR HELP!!!

 :-\

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 10070
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: [Bug] Custom field title appears twice
« Reply #14 on: December 23, 2012, 18:45:19 pm »
It must be done by the plugin itself atm, that is the problem. I think vm2.1 it will be solved. It is also solved now, but depends on the used plugin.
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/