Is there a way/guide that will change the configurable option selection from select dropdown type into div / ul - li dropdown type on product view page? Because I need to add the stock status for each child options.
Asked
Active
Viewed 1,250 times
0
-
try to go through this answer http://stackoverflow.com/questions/15011604/magento-changing-the-dropdown-configurable-product-options-for-divs – Ram Sharma Nov 06 '13 at 12:04
1 Answers
0
Change the select tag to UL, and the option tags to li. Update your javascript to handle this. You can use the below script and manipulate it for your requirements.
function UpdateProductAttribute(AttributeId,ValueId,Qty,ProductId)
{
var RunFunction = true;
if (!isNaN(Qty) && Qty < 1){
RunFunction = false;
}
if (RunFunction == true){
var CurrentValueId = $('attribute' + ProductId + '_' + AttributeId).getValue();
if(CurrentValueId){
$('attributeselect' + AttributeId + '_' + CurrentValueId).removeClassName('active');
}
$('attribute' + ProductId + '_' +AttributeId).setValue(ValueId);
$('attributeselect'+ AttributeId + '_' + ValueId).addClassName('active');
}
}
You need to provide the form with the super attribute id (ValueID) & product id, attribute id in script is the attribute id (static id for your attribute). Hide/shows for selected li elements is also handled by the above script (the active class).
Be aware that:
$('attribute' + ProductId + '_' +AttributeId).setValue(ValueId);
Is for updating the input field value.

evensis
- 172
- 3
- 15