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]
This code is from customfields.php in CustomsFieldCartDisplay function:
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:
$html .=ShopFunctionsF::translateTwoLangKeys($productCustom->custom_title,$value);
And after that, we trigger 'plgVmOnViewCart' and custom plugin itself add its value to html:
$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.
haha funny, I fixed this also yesterday. Please check the latest svn or the new version of today.
Great! Thanks! Is 2.0.7 (http://forum.virtuemart.net/index.php?topic=102143.0) the latest?
It will be in 2.0.7a
Just checked th SVN. Don't you think we mess up <span> tags here? We add open tag, and continue without closing it:
$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".
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...
Okey, rechecked. Please test.
Which files should I update now? Using the SVN repository, or how?
Milbo, could you please tell me what exactly should be updated and how?
We cannot simply update our entire website at this moment.
can you guide me how to fix that ?
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.
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
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!!!
:-\
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.
many thanks for your answer. :)
we are using the plugin that has been installed together with VM2.
how can this be solved for the time being?
cheers