Hi,
I have successfully done characteristics override as per documentation. However i have 1 concern regarding the code i used. The whole code is based on default characteristics.php file....
So If i use:
}elseif( $element->product_id==$variant->product_id && !$switch_done){
For some reason first variant isn't checked by js:
$js = "var el = document.querySelector('[name=\"".$id."\"]'); if(el) el.checked = true; hikashopUpdateVariant(el);";
If i set first variant quantity to 0 it works fine. Not sure why it does like that? As the whole code is based on default of the hikashop code it should work...
So i have uncommented it as for now....
Here is the full code of the override:
<?php
defined('_JEXEC') or die('Restricted access');
$this->load();
function hikashop_characteristics_html(&$element, &$params, &$obj) {
    $characteristics =& $element->main->characteristics;
    $doc = JFactory::getDocument();
	$config =& hikashop_config();
    switch ($params->get('characteristic_display')) {
        case 'radio':
         
            foreach ($obj->characteristics as $characteristic) { 
                $html .= '<div class="hikashop_characteristic fz-characteristic-' . $characteristic->characteristic_alias . ' my-3">';
				
				if($characteristic->characteristic_alias == 'color') {
					$html .='test'; // Working on it
				}else{
                    $html .= '<h5>' . $characteristic->characteristic_value . ':</h5>';
                    $html .= '<div class="form-check-inline">';
				
				    $switch_done = false;
				    if(!empty($characteristic->values)) {
                        foreach($characteristic->values as $k => $value){
					        if(!$config->get('show_out_of_stock',1)){
						        $hasQuantity = false;
		 			            foreach($element->variants as $variant){
						            foreach($variant->characteristics as $variantCharacteristic) {
							            if($variantCharacteristic->characteristic_id == $value->characteristic_id) {
										    if($variant->product_quantity != 0){
											    $hasQuantity = true;
										      //}elseif( $element->product_id==$variant->product_id && !$switch_done){
											    $id = 'hikashop_product_characteristic['.$characteristic->characteristic_id.']';
											    $js = "var el = document.querySelector('[name=\"".$id."\"]'); if(el) el.checked = true; hikashopUpdateVariant(el);";
											    $js = "window.hikashop.ready( function() {".$js."});";
											    $doc->addScriptDeclaration("\n<!--\n".$js."\n//-->\n");
											    $switch_done = true;
										    }
						                }
					                }
					            }
					            if(!$hasQuantity)
						           continue;
						    }						
						    if(strlen($value)!=0 && empty($value)){
                                $val = $value.' ';
                            }
                            if(strpos($val, '<img ') !== false)
                                $val = str_replace('<img ', '<img onclick="return hikashopUpdateVariant(\'hikashop_product_characteristic_'. $key . $value->characteristic_id.'\');" ', $val);
                                $clean = strip_tags($val);
						
                        $html .= '<label for="hikashop_product_characteristic_' . $characteristic->characteristic_id . $value->characteristic_id . '" id="hikashop_product_characteristic_' . $characteristic->characteristic_id . $value->characteristic_id . '-lbl" class="form-check-label">';
                        $html .= '<input '.$extra.' type="radio" name="hikashop_product_characteristic[' . $characteristic->characteristic_id.']" id="hikashop_product_characteristic_' . $characteristic->characteristic_id . $value->characteristic_id . '" value="' . $value->characteristic_id . '" class="form-check-input d-none" size="1" onclick="return hikashopUpdateVariant(this);" />';
					    $html .= '<span>'. $value->characteristic_value.'</span>';
                        $html .= '</label>';
							
			            }
			         } 
                     $html .= '</div>';
				}
                $html .= '</div>';
            }
            break;
    }
    return $html;
}