beate Posted July 3, 2008 Share Posted July 3, 2008 Hi, my products have attibutes like speaking time:* 3h* 3,5h* 6h* 4h* 5hAnd they are not sorted from a-z on AdminCatalog-Tab. I inserted them as I used it, but so its a little bit difficult to select. I would have hacked it, but didn't find the place where.Thanks,Beate Link to comment Share on other sites More sharing options...
Peter Wilson Posted July 4, 2008 Share Posted July 4, 2008 Hi beate,Which version of PrestaShop are you using?I've just tested this on v1.0 RC4 and PrestaShop automatically lists attributes in alphabetical order, both on the Back Office and on the Front Office.... Link to comment Share on other sites More sharing options...
beate Posted July 4, 2008 Author Share Posted July 4, 2008 I use RC4... very strange...But I inserted them on RC3. Does this matter? Link to comment Share on other sites More sharing options...
Peter Wilson Posted July 4, 2008 Share Posted July 4, 2008 It shouldn't matter, no. :blank: Can you please post a screen capture of the list of the above attributes in the Back Office >> Catalog >> Attributes and groups ?Thanks! Link to comment Share on other sites More sharing options...
beate Posted July 4, 2008 Author Share Posted July 4, 2008 I'm sorry, this is not attributes and groupes, but features.Here is a screenshot. Link to comment Share on other sites More sharing options...
Peter Wilson Posted July 4, 2008 Share Posted July 4, 2008 Ahh, OK, you mean Features.I've just tested it and you're right, unlike Attributes, Features are _not_ automatically listed in alphabetical order.This will be fixed for the RC5.In the meantime, my colleague Philippe Sang will post a line of code to add, and where. It should be an easy fix even for non-developers. Link to comment Share on other sites More sharing options...
beate Posted July 4, 2008 Author Share Posted July 4, 2008 Thank you, that would be great!But I'm a developer, but I didn't find the place where to edit this. Link to comment Share on other sites More sharing options...
beate Posted July 8, 2008 Author Share Posted July 8, 2008 Is there some kind of fix in the pipeline? Would be great Link to comment Share on other sites More sharing options...
rsvp Posted August 24, 2008 Share Posted August 24, 2008 My features just organize themselves in no discernible order. They're just there, willy-nilly. What can be done? :long: Link to comment Share on other sites More sharing options...
vinoalvino Posted September 13, 2008 Share Posted September 13, 2008 Hi, sorry for my english ;-)I make this change on: classes/Product.php Near the end of file: /* * 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)); } changed on: /* * 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 - hide 01. 02. */ $resultsArray = array(); foreach ($result AS $row) { $row['name'] = preg_replace('/^[0-9]+\./', '', $row['name']); $resultsArray[] = $row; } return $resultsArray; } Now you can show ordered fautures.If you need to force order you can use 01. 02. like category - example:01.feature zzz02.feature xxx Link to comment Share on other sites More sharing options...
Infordesign Posted January 28, 2009 Share Posted January 28, 2009 Hello!I had the same problem with the latest SVN version.To solve that (on front store):Change getAttributesGroups function in "/classes/Product.php" to: public function getAttributesGroups($id_lang) { $result = Db::getInstance()->ExecuteS(' SELECT ag.`id_attribute_group`, agl.`name` AS group_name, agl.`public_name` AS public_group_name, a.`id_attribute`, al.`name` AS attribute_name, a.`color` AS attribute_color, pa.`id_product_attribute`, pa.`quantity`, pa.`price`, pa.`ecotax`, pa.`weight`, pa.`default_on`, pa.`reference` FROM `'._DB_PREFIX_.'product_attribute` pa LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON pac.`id_product_attribute` = pa.`id_product_attribute` LEFT JOIN `'._DB_PREFIX_.'attribute` a ON a.`id_attribute` = pac.`id_attribute` LEFT JOIN `'._DB_PREFIX_.'attribute_group` ag ON ag.`id_attribute_group` = a.`id_attribute_group` LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al ON a.`id_attribute` = al.`id_attribute` LEFT JOIN `'._DB_PREFIX_.'attribute_group_lang` agl ON ag.`id_attribute_group` = agl.`id_attribute_group` WHERE pa.`id_product` = '.intval($this->id).' AND al.`id_lang` = '.intval($id_lang).' AND agl.`id_lang` = '.intval($id_lang).' ORDER BY agl.`name`, al.`name`, pa.`id_product_attribute`'); /* Modify SQL result - hide 01. 02. */ $resultsArray = array(); foreach ($result AS $row) { $row['attribute_name'] = preg_replace('/^[0-9]+\./', '', $row['attribute_name']); $resultsArray[] = $row; } return $resultsArray; } To correct all PrestoShop code, see this post:http://www.prestashop.com/forums/viewthread/11717/general_discussion/sort_product_attributesThere you'll find how to correct BackOffice and FrontStore "Attribute sorting bug". Link to comment Share on other sites More sharing options...
Recommended Posts