Thanks, lhungil. I found another "funny" with the dropdown (and possibly other flavors) of attributes; the ordering of the attribute values in the dropdown were all over the place, i.e. not in their defined sort-order. I made the following change to the /YOUR_ADMIN/includes/classes/attributes.php module to correct:
Code:
/**
* Returns a multidimensional array containing the product attribute options
* id / name / value rows for the specified product sorted by option id.
*
* @param int|string $zf_product_id the specified product id.
* @param bool $readonly include readonly attributes not required to add a
* product to the cart, defaults to false.
* @return array
*/
function get_attributes_options($zf_product_id, $readonly = false) {
global $db;
$query = 'SELECT attr.products_attributes_id, attr.products_id, attr.options_id, opt.products_options_name, val.products_options_values_name, opt.products_options_type, products_options_size, opt.products_options_rows ' .
'FROM ' . TABLE_PRODUCTS_ATTRIBUTES . ' AS attr ' .
'LEFT JOIN ' . TABLE_PRODUCTS_OPTIONS .
' AS opt ON attr.options_id = opt.products_options_id ' .
'LEFT JOIN ' . TABLE_PRODUCTS_OPTIONS_VALUES .
' AS val ON attr.options_values_id = val.products_options_values_id ' .
'WHERE attr.products_id = \'' . (int)$zf_product_id . '\' ' .
'AND val.language_id = \'' . (int)$_SESSION['languages_id'] . '\' ' .
'AND val.language_id = opt.language_id ';
// Don't include READONLY attributes if product can be added to cart without them
if(PRODUCTS_OPTIONS_TYPE_READONLY_IGNORED == '1' && $readonly === false) {
$query .= 'AND opt.products_options_type != \'' . PRODUCTS_OPTIONS_TYPE_READONLY . '\' ';
}
//-bof-20140712-lat9-Fix up attributes' sort order.
// $query .= 'ORDER BY `opt`.`products_options_sort_order`, `attr`.`options_id`';
$query .= 'ORDER BY `attr`.`options_id`, `attr`.`products_options_sort_order`';
//-eof-20140712-lat9
if($this->cache_time == 0) $queryResult = $db->Execute($query);
else $queryResult = $db->Execute($query, false, true, $this->cache_time);
$retval = array();
while (!$queryResult->EOF) {
$retval[$queryResult->fields['products_attributes_id']] = array(
'id' => $queryResult->fields['options_id'],
'name' => $queryResult->fields['products_options_name'],
'value' => $queryResult->fields['products_options_values_name'],
'type' => $queryResult->fields['products_options_type'],
'length' => $queryResult->fields['products_options_length'],
'size' => $queryResult->fields['products_options_size'],
'rows' => $queryResult->fields['products_options_rows']
);
$queryResult->MoveNext();
}
return $retval;
}
Bookmarks