VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: iWim on May 10, 2015, 20:05:59 PM

Title: [SOLVED] Custom field type E not displayed correctly in cart
Post by: iWim on May 10, 2015, 20:05:59 PM
Hey, hey,

Custom field type E is not displayed correctly in the cart.
From what I can see is that the second custom field type E is nested inside the first, and the third inside the second...

It worked fine in VM 3.0.6, it happened after the upgrade to 3.0.8.

See attachment.
I colored it for clearance.

In the attachment you also see a type-S, that one is displayed correctly.
But when placed at the end it is also nested inside product field type E.

J! 3.4.1
VM 3.0.8

Thank you.
Wim
Title: Re: [3.0.8] Custom field type E not displayed correctly in cart
Post by: GJC Web Design on May 10, 2015, 22:33:23 PM
isn't it a problem with 'custom fields for all' missing a closing span?
Title: Re: [3.0.8] Custom field type E not displayed correctly in cart
Post by: iWim on May 11, 2015, 09:05:43 AM
Yeah... but VM updated and Custom Fields for All did not.

As I said in VM 3.0.6 it was displayed correctly, in VM 3.0.8 it's not.

Just in case I also informed the CF4A devs.
Title: Re: [3.0.8] Custom field type E not displayed correctly in cart
Post by: balai on May 11, 2015, 11:23:52 AM
I tested it with other plug-ins including the text input.
It happened with all of them.

<span class="product-field-type-E">
    <span>
        Input 1
    </span>
    <span class="product-field-type-E">
   <span>
        Input 2
    </span>
</span>
</span>


Seems like the <span class="product-field-type-E"> is not closing after a custom field display
Title: Re: [3.0.8] Custom field type E not displayed correctly in cart
Post by: balai on May 11, 2015, 11:41:06 AM
file: administrator/components/com_virtuemart/models/customfields.php
lines 1236-1248
code:

                                        $otag = ' <span class="product-field-type-' . $productCustom->field_type . '">';
if ($productCustom->field_type == "E") {

$tmp = '';
if (!class_exists ('vmCustomPlugin'))
require(VMPATH_PLUGINLIBS . DS . 'vmcustomplugin.php');
JPluginHelper::importPlugin ('vmcustom');
$dispatcher = JDispatcher::getInstance ();
$dispatcher->trigger ($trigger.'VM3', array(&$product, &$productCustom, &$tmp));
if(!empty($tmp)){
$html .= $otag.$tmp;
}
}


should be:


                                        $otag = ' <span class="product-field-type-' . $productCustom->field_type . '">';
$closing_tag='</span>';
if ($productCustom->field_type == "E") {

$tmp = '';
if (!class_exists ('vmCustomPlugin'))
require(VMPATH_PLUGINLIBS . DS . 'vmcustomplugin.php');
JPluginHelper::importPlugin ('vmcustom');
$dispatcher = JDispatcher::getInstance ();
$dispatcher->trigger ($trigger.'VM3', array(&$product, &$productCustom, &$tmp));
if(!empty($tmp)){
$html .= $otag.$tmp.$closing_tag;
}
}


I suggest using the $closing_tag for the rest of the code instead of repeating the '</span>' closure
Since you use a variable for opening tag, better have a variable also for the closing to avoid such errors
Title: Re: [3.0.8] Custom field type E not displayed correctly in cart
Post by: Milbo on May 11, 2015, 11:53:00 AM
I suggest to use the latest version, called vm3.0.9 and to be delighted by the fix given by Kainhofer around 3 weeks ago.
Title: Re: [3.0.8] Custom field type E not displayed correctly in cart
Post by: iWim on May 12, 2015, 20:44:54 PM
Thank you. That fixed it.

Wim