I did a better research on the forums here and I got to
THIS
thread where the OP suggests editing the product/option.php in the line where it says:
$html = JHTML::_('select.genericlist', $this->values, $map, 'class="inputbox" size="1" onchange="hikashopChangeOption();"', 'value', 'text', (int)$value,$id );
to
$html = JHTML::_('select.radiolist', $this->values, $map, 'class="inputbox" size="1" onclick="hikashopChangeOption();"', 'value', 'text', (int)$value, $id );
essentially changing the
select.genericlist to
select.radiolist.
This worked, but it changed all the option selections into radio buttons (though that does not look shabby at all imho), whereas I want the type of input set for each characteristic (when we created them) to set it to the appropriate type. I can only assume I need to add the value of the Characteristics selection method (from the Characteristic edit page in administration), changing the code further into:
$html = JHTML::_('select.[add-method-selection-value-here]list',
which will result in appropriately choosing between:
$html = JHTML::_('select.genericlist',
and
$html = JHTML::_('select.radiolist',
Now I need to find this value. Any ideas?
EDIT#1:
An idea for implementing the above would be to add an IF statement where:
IF [method-selection-value] = radio button --> $html = JHTML::_('select.radiolist',...
ELSE $html = JHTML::_('select.genericlist',...
EDIT#2: Here is a link to my progress so far:
menestho.com/online-shop/swimwear/create-your-swimsuit
Also I noticed that changing options does not update the price with options value, but it does show the correct sum in the cart.
Weird...Any ideas why this could be happening?
EDIT#3:
I re-read the directions given in that other post and it mentioned s javascript function:
function hikashopChangeOption(){
var j = 0;
total_option_price = 0;
while(true){
var option = document.getElementById('hikashop_product_option_'+j);
if(!option){
break;
}
j++;
var option_price = hikashop_options[option.value];
if(option_price){
total_option_price+=option_price;
}
}
var arr = new Array();
arr = document.getElementsByName('hikashop_price_product');
for(var i = 0; i < arr.length; i++){
var obj = document.getElementsByName('hikashop_price_product').item(i);
var id_price = 'hikashop_price_product_' + obj.value;
var id_price_with_options = 'hikashop_price_product_with_options_' + obj.value;
var price = document.getElementById(id_price);
var price_with_options = document.getElementById(id_price_with_options);
if(price && price_with_options){
price_with_options.value = parseFloat(price.value) + total_option_price;
}
}
hikashopRefreshOptionPrice();
if(window.Oby && window.Oby.fireAjax) window.Oby.fireAjax('hkContentChanged');
}
function hikashopRefreshOptionPrice(){
var price_div = document.getElementById('hikashop_product_id_main');
var inputs = price_div.getElementsByTagName('input');
if(inputs[0]){
var id_price_with_options = 'hikashop_price_product_with_options_' + inputs[0].value;
var price_with_options = document.getElementById(id_price_with_options);
if(price_with_options){
var target = document.getElementById('hikashop_product_price_with_options_main');
if(target)
window.Oby.xRequest('".$baseUrl."price='+price_with_options.value+'".$url_itemid."', { mode: 'GET', update: target });
}
}
}
window.hikashop.ready( function() { hikashopChangeOption(); });
";
Apparently dropdown value can be easily picked, while in a radio it requires a loop on each radio element to see which one is selected. To be frank I am rather confused as to why the loop is required and how should I change the code.