should be different ID input radio
I changed:
administrator\components\com_virtuemart\models\customfields.php
$idav = 1;
foreach ($group->options as $productCustom) {
//vmdebug('getProductCustomsFieldCart',$productCustom);
if ((float)$productCustom->custom_price) {
$price = $currency->priceDisplay ($calculator->calculateCustomPriceWithTax ($productCustom->custom_price));
}
else {
$price = ($productCustom->custom_price === '') ? '' : $free;
}
$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 . '_' . $idav . '" ' . $checked . ' type="radio" value="' .
$productCustom->virtuemart_customfield_id . '" name="customPrice[' . $row . '][' . $productCustom->virtuemart_custom_id . ']" /><label
for="' . $productCustom->virtuemart_custom_id . '_' . $idav . '">' . $this->displayProductCustomfieldFE ($productCustom, $row) . ' ' . $price . '</label>';
$checked = '';
$idav++;
}
is that right? thank you
I have the same problem, always id="5"... :-[ :-[ using Virtuemart 2.0.8c and joomla 2.5.6
<input id="5" type="radio" name="customPrice[0][5]" value="8" checked="checked">
<label for="5">Lorem</label>
<input id="5" type="radio" name="customPrice[0][5]" value="9">
<label for="5">Ipsum</label>
I wrote the above code, the solution to this problem, it would be good for developers to have corrected itself, this is a bug
Your code works like a charm, thanks!
The bug still remains in VM 2.0.10.
Same bug also remain in VM 2.0.12. It is a very simple fix but do not know why it is still not done in several past updates.
hi there
ive tried inserting the suggested code but it doesnt seem to make any difference. im not 100% sure im inserting it in the right place. can someone tell me on what line i need to enter this code and what code to replace it with?
or upload a fixed file.
thanks
Then you are not making the corrections properly. I am attaching the corrected copy of administrator\components\com_virtuemart\models\customfields.php
Unzip the attached package and replace the file in your site by this corrected one.
[attachment cleanup by admin]
excellent many thanks. that worked. i didnt know what the bold sections in the original post meant.
The problem remains in VirtueMart 2.0.24. It is still generating wrong HTML for string type custom fields. Here is the exact fix.
Open administrator\components\com_virtuemart\models\customfields.php
Find the following codes between lines 952 to 966:
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 .$row. '" ' . $checked . ' type="radio" value="' .
$productCustom->virtuemart_customfield_id . '" name="customPrice[' . $row . '][' . $productCustom->virtuemart_custom_id . ']" /><label
for="' . $productCustom->virtuemart_custom_id .$row. '" class="other-customfield">' . $this->displayProductCustomfieldFE ($product, $productCustom, $row) . ' ' . $price . '</label>';
$checked = '';
}
Replace above by:
$i = 1;
foreach ($group->options as $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 .$row. '-'.$i.'" ' . $checked . ' type="radio" value="' .
$productCustom->virtuemart_customfield_id . '" name="customPrice[' . $row . '][' . $productCustom->virtuemart_custom_id . ']" /><label
for="' . $productCustom->virtuemart_custom_id .$row. '-'.$i.'" class="other-customfield">' . $this->displayProductCustomfieldFE ($product, $productCustom, $row) . ' ' . $price . '</label>';
$checked = '';
$i++;
}
Hope this will fixed at least in the next update.