VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: Richardkl on August 14, 2012, 04:54:42 AM

Title: custom boolean fields do not display correctly Multi radio have same ID
Post by: Richardkl on August 14, 2012, 04:54:42 AM
The labels for radio buttons do  not appear correctly.  Instead of:

No (0)  Yes (X)

They appear as:

No  Yes       (0)  (X)

In other words, the labels are beside each other, then the buttons beside each other instead of: label button    label button


also the custom  used on cart modification they wrap and display on two lines

Also the ID's are duplicated for multi buttons

<span class="product-field-display"><input id="17" checked="checked" type="radio" value="100" name="customPrice[3][17]" /><label
for="17">No No additional charge</label><input id="17"  type="radio" value="98" name="customPrice[3][17]" /><label
for="17">Yes $100.00</label></span>
 

note that both radio buttons have the same ID
Title: Re: custom boolean fields do not display correctly Multi radio have same ID
Post by: Polleke on December 31, 2012, 11:42:23 AM
Hi,
is this problem already solved. I have the same problem.
Do you have a solution?
Title: Re: custom boolean fields do not display correctly Multi radio have same ID
Post by: JtouchMobile.com on January 01, 2013, 10:29:53 AM
(http://jtouchmobile.com/download/vm-2016-same-id-bug-2.jpeg)
Add attachement for details  8)

Solution (VM 2016):
File: /administrator/components/com_virtuemart/models/customfields.php
Line:939
Replace those code block:

foreach ($group->options as $productCustom) {
//vmdebug('getProductCustomsFieldCart',$productCustom);
$price = self::_getCustomPrice($productCustom->custom_price, $currency, $calculator);
$productCustom->field_type = $group->field_type;
$productCustom->is_cart = 1;
// $group->display .= '<input id="' . $productCustom->virtuemart_custom_id . '" ' . $checked . ' type="radio" value="' .
// $productCustom->virtuemart_custom_id . '" name="customPrice[' . $row . '][' . $productCustom->virtuemart_customfield_id . ']" /><label
// for="' . $productCustom->virtuemart_custom_id . '">' . $this->displayProductCustomfieldFE ($productCustom, $row) . ' ' . $price . '</label>';
//MarkerVarMods
$group->display .= '<input id="' . $productCustom->virtuemart_custom_id . '" ' . $checked . ' type="radio" value="' .
$productCustom->virtuemart_customfield_id . '" name="customPrice[' . $row . '][' . $productCustom->virtuemart_custom_id . ']" /><label
for="' . $productCustom->virtuemart_custom_id . '" class="other-customfield">' . $this->displayProductCustomfieldFE ($product, $productCustom, $row) . ' ' . $price . '</label>';

$checked = '';
}



by:


$i = 0;
foreach ($group->options as $productCustom) {
$i++;
//vmdebug('getProductCustomsFieldCart',$productCustom);
$price = self::_getCustomPrice($productCustom->custom_price, $currency, $calculator);
$productCustom->field_type = $group->field_type;
$productCustom->is_cart = 1;
// $group->display .= '<input id="' . $productCustom->virtuemart_custom_id . '" ' . $checked . ' type="radio" value="' .
// $productCustom->virtuemart_custom_id . '" name="customPrice[' . $row . '][' . $productCustom->virtuemart_customfield_id . ']" /><label
// for="' . $productCustom->virtuemart_custom_id . '">' . $this->displayProductCustomfieldFE ($productCustom, $row) . ' ' . $price . '</label>';
//MarkerVarMods
$group->display .= '<input id="' . $productCustom->virtuemart_custom_id . $i . '" ' . $checked . ' type="radio" value="' .
$productCustom->virtuemart_customfield_id . '" name="customPrice[' . $row . '][' . $productCustom->virtuemart_custom_id . ']" /><label
for="' . $productCustom->virtuemart_custom_id . $i . '" class="other-customfield">' . $this->displayProductCustomfieldFE ($product, $productCustom, $row) . ' ' . $price . '</label>';

$checked = '';
}
Title: Re: custom boolean fields do not display correctly Multi radio have same ID
Post by: Polleke on January 01, 2013, 10:33:06 AM
I know this solution, but that did not  worked for me.
Title: Re: custom boolean fields do not display correctly Multi radio have same ID
Post by: Milbo on January 02, 2013, 00:11:42 AM
and is it working with $row?
Title: Re: custom boolean fields do not display correctly Multi radio have same ID
Post by: Polleke on January 02, 2013, 09:34:51 AM
Hi,
what do you mean with $row. Did i miss something ?

But it is still not working. The only difference is that the both input tags have there own id.

regards Jan
Title: Re: custom boolean fields do not display correctly Multi radio have same ID
Post by: Milbo on January 02, 2013, 16:53:35 PM

$group->display .= '<input id="' . $productCustom->virtuemart_custom_id .$row. '" ' . $checked . ' type="radio" value="' .
$productCustom->virtuemart_customfield_id . '" name="customPrice[' . $row . '][' . $productCustom->virtuemart_custom_id . ']" /><label
for="' . $productCustom->virtuemart_custom_id . '" class="other-customfield">' . $this->displayProductCustomfieldFE ($product, $productCustom, $row) . ' ' . $price . '</label>';