<%$grouping_specifier_key = "" $available_list = "" $complete_list = "" $variant_list = "" FETCH ProductGrouping IF $ProductGrouping.attribs THEN%>
<%ENDIF /* Build lists */ QUERY Variant(product_id=$product_id) DO DISPLAY QUERY StockProfile(stockprofile_id = $stockprofile_id) DO DISPLAY $this_grouping_specifier = CALL VARIANT_GROUPING_SPECIFIER() $variant_list = CALL ADD_KEY_TO_SEPARATED_LIST($variant_id + ";" + $this_grouping_specifier, $variant_list, '|', 1) $complete_list = CALL ADD_KEY_TO_SEPARATED_LIST($this_grouping_specifier, $complete_list, '|', 1) IF $stock_available > 0 THEN $available_list = CALL ADD_KEY_TO_SEPARATED_LIST($this_grouping_specifier, $available_list, '|', 1) IF NOT $grouping_specifier_key THEN $grouping_specifier_key = $this_grouping_specifier ENDIF ELSIF $enable_product_watch THEN $available_list = CALL ADD_KEY_TO_SEPARATED_LIST($this_grouping_specifier, $available_list, '|', 1) IF NOT $grouping_specifier_key THEN $grouping_specifier_key = $this_grouping_specifier ENDIF ELSIF $denyorder_notinstock == 0 THEN $available_list = CALL ADD_KEY_TO_SEPARATED_LIST($this_grouping_specifier, $available_list, '|', 1) IF NOT $grouping_specifier_key THEN $grouping_specifier_key = $this_grouping_specifier ENDIF ENDIF NEXTROW ENDQUERY NEXTROW ENDQUERY /* Check if the first available variant should be shown */ IF NOT $sopt_product_grouping_select_first_available THEN $grouping_specifier_key = "" ENDIF /* Check if the plugin has any idea of which items should be active */ $hook_grouping_specifier_key = CALL CUSTOM_HOOK("GROUPING_SPECIFIER", $grouping_specifier_key, $variant_list, $available_list, $complete_list) IF $hook_grouping_specifier_key THEN $hook_set_grouping_specifier_key = 1 $grouping_specifier_key = $hook_grouping_specifier_key ENDIF DISPLAY IF $sopt_product_grouping_hide_unavailable THEN $on_change_function = "hiding_var_select_ajax('" + $field_id + "', " ELSE $on_change_function = "var_select_ajax(" ENDIF $temp_name=CALL REGEX_REPLACE($name, ' ', '', 'g') %>
$name:
<%POP $temp_name NEXTROW IF $ProductGrouping.attribs THEN%>
<%IF $sopt_product_grouping_hide_unavailable THEN%> [%RESET_GROUPING_VALUES Nollställ val%] <%ENDIF%>
<% ENDIF ENDFETCH%>