Sorting Option Type Names in Table Heading
There is no way in the standard Cartweaver code to sort the option type names used in the table heading when you have a multiple-option product and have a display type of "Tables" or more than 2 options on a product. To allow a sort field to be used, first add the sort field to the tbl_list_optiontypes table (optiontype_Sort tinyint) and populate it with data. Then add this small modification to the CWFunProductOptions.php file:
Code was:
/* If we have more than 1 option, get our option information set for display */
if($displayType == "Tables") {
$optionNames = arrayKeyToArray($rsCWAllOptions, "optiontype_Name");
$numOptions = count($optionNames);
$optionArray = array();
cwDebugger($optionNames);
}
New code:
/* If we have more than 1 option, get our option information set for display */
if($displayType == "Tables") {
$optionNames = arrayKeyToArray($rsCWAllOptions, "optiontype_Name");
$numOptions = count($optionNames);
$optionArray = array();
cwDebugger($optionNames);
/* MODIFICATION FOR SORTING */
$optionNamesTemp = array();
$query_rsCWGetOptionSort = "SELECT optiontype_Name, optiontype_Sort
FROM tbl_list_optiontypes
ORDER BY optiontype_Sort";
$rsCWGetOptionSort = $cartweaver->db->executeQuery($query_rsCWGetOptionSort);
$rsCWGetOptionSort_recordCount = $cartweaver->db->recordCount;
$row_rsCWGetOptionSort = $cartweaver->db->db_fetch_assoc($rsCWGetOptionSort);
do {
if(in_array($row_rsCWGetOptionSort["optiontype_Name"], $optionNames)) {
array_push($optionNamesTemp, $row_rsCWGetOptionSort["optiontype_Name"]);
}
} while ($row_rsCWGetOptionSort = $cartweaver->db->db_fetch_assoc($rsCWGetOptionSort));
$optionNames = $optionNamesTemp;
}