tjjunior Posted March 14, 2011 Share Posted March 14, 2011 To change the order of attributes in 1.4 (specifically 1.4.0.15) here's what I did:Add a new column in the database table ps_attribute_lang. I used a name of orderby and type TinyInt. I then added in the order number that I wanted (e.g. all of the Smalls get 1, Mediums get 2, Larges 3 etc) in the orderby column. In override -> classes I added a new file called Product.php: <?php class Product extends ProductCore { /** * Get all available attribute groups * * @param integer $id_lang Language id * @return array Attribute groups */ public function getAttributesGroups($id_lang) { return Db::getInstance()->ExecuteS(' SELECT ag.`id_attribute_group`, ag.`is_color_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`, pa.`unit_price_impact`, pa.`minimal_quantity` 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` = '.(int)($this->id).' AND al.`id_lang` = '.(int)($id_lang).' AND agl.`id_lang` = '.(int)($id_lang).' ORDER BY al.`orderby`'); } } And in override ->controllers I added a file called ProductController.php (quoted in next post due to size): Link to comment Share on other sites More sharing options...
tjjunior Posted March 14, 2011 Author Share Posted March 14, 2011 Still too big to copy in entirety so here's the important parts: class ProductController extends ProductControllerCore { public function process() { parent::process(); global $cart; ... // foreach($groups AS &$group) // natcasesort($group['attributes']); ... } Basically the whole function process from the original controller (controllers -> ProductController.php) except comment out the two lines shown. My approach does move the Color attribute above the Size attribute, but that didn't bother me much. Hope it helps someone. Link to comment Share on other sites More sharing options...
alezzzzz Posted May 30, 2011 Share Posted May 30, 2011 I dont have any files in "override/controlers" .. It would be really nice to know how to implement the needed class there :-) Link to comment Share on other sites More sharing options...
alezzzzz Posted June 1, 2011 Share Posted June 1, 2011 OK, I found the way to do it!Just got the function "public function process()" from the class ProductController.php in the folder 'controllers' then copied it into 'override/controllers' and commented the part you mentioned..Thank you!! Link to comment Share on other sites More sharing options...
jesusruiz Posted June 23, 2011 Share Posted June 23, 2011 Hello, could you explain this more easily?.In override -> controllers, I have no file. Link to comment Share on other sites More sharing options...
alezzzzz Posted June 30, 2011 Share Posted June 30, 2011 I think that If I remeber right, you can copy the ProductController.php file in the 'controlers' folder and paste it in 'override/controlers' with the changes mentioned above..Good luck! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now