Сталкнулся с такой проблемой сортировки.
Решение для 1,3,*
в файле classes/Product.php
Код:
static public function getProductsProperties($id_lang, $query_result)
{
$resultsArray = array();
foreach ($query_result AS $row)
if ($row2 = Product::getProductProperties($id_lang, $row))
$resultsArray[] = $row2;
return $resultsArray;
}
/*
* Select all features for a given language
*
* @param $id_lang Language id
* @return array Array with feature's data
*/
/* MODIF DE STRATIC PUBLIC FUNCTION
static public function getFrontFeaturesStatic($id_lang, $id_product)
{
return Db::getInstance()->ExecuteS('
SELECT name, value, pf.id_feature
FROM '._DB_PREFIX_.'feature_product pf
LEFT JOIN '._DB_PREFIX_.'feature_lang fl ON (fl.id_feature = pf.id_feature AND fl.id_lang = '.intval($id_lang).')
LEFT JOIN '._DB_PREFIX_.'feature_value_lang fvl ON (fvl.id_feature_value = pf.id_feature_value AND fvl.id_lang = '.intval($id_lang).')
WHERE pf.id_product = '.intval($id_product));
}
*/
/* MODIF ON TRIE LES CARACTERISTISQUES PERSO via 01; 02; 03, etc. */
static public function getFrontFeaturesStatic($id_lang, $id_product)
{
$result=Db::getInstance()->ExecuteS('
SELECT name, value, pf.id_feature
FROM '._DB_PREFIX_.'feature_product pf
LEFT JOIN '._DB_PREFIX_.'feature_lang fl ON (fl.id_feature = pf.id_feature AND fl.id_lang = '.intval($id_lang).')
LEFT JOIN '._DB_PREFIX_.'feature_value_lang fvl ON (fvl.id_feature_value = pf.id_feature_value AND fvl.id_lang = '.intval($id_lang).')
WHERE pf.id_product = '.intval($id_product).' order by name');
$resultsArray = array();
foreach ($result AS $row)
{
$row['name'] = product::hideFeaturePosition($row['name']);
$resultsArray[] = $row;
}
return $resultsArray;
}
static public function hideFeaturePosition($name)
{
return preg_replace('/^[0-9]+\./', '', $name);
}
/* FIN MODIF */
public function getFrontFeatures($id_lang)
{
return self::getFrontFeaturesStatic($id_lang, $this->id);
}
static public function getAttachmentsStatic($id_lang, $id_product)
{
return Db::getInstance()->ExecuteS('
SELECT *
FROM '._DB_PREFIX_.'product_attachment pa
LEFT JOIN '._DB_PREFIX_.'attachment a ON a.id_attachment = pa.id_attachment
LEFT JOIN '._DB_PREFIX_.'attachment_lang al ON (a.id_attachment = al.id_attachment AND al.id_lang = '.intval($id_lang).')
WHERE pa.id_product = '.intval($id_product));
}
public function getAttachments($id_lang)
{
return self::getAttachmentsStatic($id_lang, $this->id);
}
/*
** Customization management
*/
Пример Features
01.свойство1
02.свойство2
03.свойство3