vinoalvino Posted September 3, 2008 Share Posted September 3, 2008 I need to order the features like Category list (01.Category 1, 02.Category 2, ...) so I change the file: classes/Product.php (make a copy!!!)At the end of file change: /* * Select all features for a given language * * @param $id_lang Language id * @return array Array with feature's data */ 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)); } with: /* * Select all features for a given language * * @param $id_lang Language id * @return array Array with feature's data * MODIFICATO il 3/09/2008 */ 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`'); /* Modify SQL result */ $resultsArray = array(); foreach ($result AS $row) { $row['name'] = preg_replace('/^[0-9]+\./', '', $row['name']); $resultsArray[] = $row; } return $resultsArray; } Now for each feature put 01. 02. 03. ... before the nameSorry for my english ;-) Link to comment Share on other sites More sharing options...
Dscho Posted October 20, 2008 Share Posted October 20, 2008 Hi,my customer wanted individual position of Features too.I went an other way:1. Adding a new databasefield into table ps_feature`position` int(11) default NULL2. Changing file classes/Product.php /* * Select all features for a given language * * @param $id_lang Language id * @return array Array with feature's data */ 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)); */ return Db::getInstance()->ExecuteS(' SELECT name, value, pf.id_feature FROM ps_feature_product pf INNER JOIN '._DB_PREFIX_.'feature ON (pf.id_feature = ps_feature.id_feature) INNER JOIN '._DB_PREFIX_.'feature_value_lang ON (pf.id_feature_value = '._DB_PREFIX_.'feature_value_lang.id_feature_value) INNER JOIN '._DB_PREFIX_.'feature_lang ON (pf.id_feature = '._DB_PREFIX_.'feature_lang.id_feature) WHERE (pf.id_product = '.intval($id_product).') AND ('._DB_PREFIX_.'feature_lang.id_lang = '.intval($id_lang).') AND ('._DB_PREFIX_.'feature_value_lang.id_lang = '.intval($id_lang).') ORDER BY `position`'); } 3. I added the administration to our prestaclient:http://www.presta-client.de/flash/move_features1.swfhttp://www.presta-client.de/flash/move_features2.swfBest RegardsJohannes Teitge Link to comment Share on other sites More sharing options...
Recommended Posts