News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

custom boolean fields do not display correctly Multi radio have same ID

Started by Richardkl, August 14, 2012, 04:54:42 AM

Previous topic - Next topic

Richardkl

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

Polleke

Hi,
is this problem already solved. I have the same problem.
Do you have a solution?

JtouchMobile.com


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 = '';
}
Author of Jtouch - Mobile solution for Joomla & VirtueMart
http://www.jtouchmobile.com

Polleke


Milbo

Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Polleke

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

Milbo


$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>';
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/