Jump to content

[Solved] Troubles with the attributes pull-down order.


Recommended Posts

Good morning to everyone ¡¡¡

Would you be so kind to explain how could I order the attributes pull-down inside the product file module ? Be so kind to refer to the attached file.
I would like to have it in the following way:
· T-Shirt color
· Drawing 1 color
· Drawing 2 color
· Size.

I have tried to edit the name of the attributes , which appears on back office (not in the public name), placing before the name of the attribute some “aa”, “bb”, etc to follow the order:
· aaT-Shirt color
· bbDrawing 1 color
· ccDrawing 2 color
· ddSize.

This does not work. I have also tries to order them as the categories method:
· 1. T-Shirt color
· 2. Drawing 1 color
· 3. Drawing 2 color
· 4. Size.

But, this does not work ¡¡¡
What can I do to solve this problem? I hope someone could help me.
Many thanks in advance,

Best regards,

1285_IXl88D6DUtAPaDftPjMN_t

Link to comment
Share on other sites

There are several ways to do what you request.
first I will show you the easiest method.

within product.php you will find the following line.
(nothing must be changed here, but please take not the function being called is [n]getAttributesGroups[/b]
$attributesGroups = $product->getAttributesGroups(intval($cookie->id_lang));

You will find this function classes/product.php line 1317
all you need to do is change the following line. use any of fields below you want to order by

for example if you order by group name this would become
ORDER BY agl.`name`');


public function getAttributesGroups($id_lang)
{
return 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.`id_image`, 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 pa.`id_product_attribute`');
}



The other more complex method would be to add a sequence column to the DB
this would require some modification to the admin

hope that helps ;-)

Link to comment
Share on other sites

  • 11 months later...
×
×
  • Create New...