johnprest99 Posted July 31, 2013 Share Posted July 31, 2013 On version 1.5.4.1 under catalog-attributes I am unable to sort the attributes by drag and drop. It physically moves them on screen but when you go back it reverts to the old positions. I looked at db and noticed that the table values dont change. This was fine until the list got bigger. I have now about 30 values and something has stopped it from working Link to comment Share on other sites More sharing options...
Toeareg Posted July 31, 2013 Share Posted July 31, 2013 (edited) I did run into that same problem too. Because I am still testing with 1.5.4.1 it's not too big a problem for me and I was able to help myself with a workaround for now. If you have a csv file with all your combinations in it, then maybe this procedure is of any help to you too until there is a working solution in PS itself. This is what I did: 1. I created an empty combinations csv and imported that with the option to delete all existing combinations checked. This also removes the existing attributes/values!!! 2. I then added all required attributes/values via the BO in the exact order in which I want them displayed in the menus and layered navigation block. 3. To be sure, I used phpMyAdmin to backup all attributes tables. Just in case I ever have to repeat the procedure. 4. Now import all combinations via csv again and leave the option to remove existing combinations UNCHECKED. If you check the option your attributes/values will be deleted again and your sort order will be lost. Now everything is sorted as expected in the front office. Edited July 31, 2013 by Toeareg (see edit history) Link to comment Share on other sites More sharing options...
tomerg3 Posted July 31, 2013 Share Posted July 31, 2013 It may be related to the PHP setting max_input_size Try setting it to 10000 in your php.ini file In case you're not sure what that is, check out http://presto-changeo.tumblr.com/post/17589539698/understanding-php-ini-how-and-why-you-need-one Link to comment Share on other sites More sharing options...
benjamin utterback Posted July 31, 2013 Share Posted July 31, 2013 Hi tomerg3, do you mean the max_input_vars setting? Link to comment Share on other sites More sharing options...
tomerg3 Posted July 31, 2013 Share Posted July 31, 2013 yes, max_input_vars Link to comment Share on other sites More sharing options...
Toeareg Posted July 31, 2013 Share Posted July 31, 2013 (edited) That did indeed solve part of the problem. It does change the sort order within the menus, but it has no influence on the sort order in the layered navigation block. As far as I can see, that is not a problem of the sort order (position) of the attribute values though, but it looks like layered navigation retrieves data ordered by ID instead of ordered by position. Edited July 31, 2013 by Toeareg (see edit history) 1 Link to comment Share on other sites More sharing options...
johnprest99 Posted July 31, 2013 Author Share Posted July 31, 2013 Hi that as unfortunately not sorted the problem out. I think this is a bug so will look for a solution on the tracker and see if anyone else has logged it Link to comment Share on other sites More sharing options...
tomerg3 Posted July 31, 2013 Share Posted July 31, 2013 That is the case as far as I am aware, the sort order only affects the front end product page. Hi that as unfortunately not sorted the problem out. I think this is a bug so will look for a solution on the tracker and see if anyone else has logged it Did you check using phpinfo() that the max_input_vars was actually changed, as not all hosts read the php.ini file. Link to comment Share on other sites More sharing options...
johnprest99 Posted July 31, 2013 Author Share Posted July 31, 2013 yeah did phpinfo output. tested in another system now and the attributes screen definitely doesn't work when dragging and dropping. If you use the arrows that seems to work so something on the drag and drop isn't firing off proeprly Link to comment Share on other sites More sharing options...
Toeareg Posted July 31, 2013 Share Posted July 31, 2013 @johnprest99, Did you perhaps only add/change the max_input_vars? I changed these 3 lines: max_input_vars = 10000; suhosin.get.max_vars = 10000; suhosin.post.max_vars = 10000; That works for me. Link to comment Share on other sites More sharing options...
benjamin utterback Posted July 31, 2013 Share Posted July 31, 2013 If your hosting provider has the “suhosin” php patch, you will need to change two more values suhosin.get.max_vars = 10000; suhosin.post.max_vars = 10000; Link to comment Share on other sites More sharing options...
johnprest99 Posted July 31, 2013 Author Share Posted July 31, 2013 tried it on local wamp server but nope the problems still persist. One issue I can see in database sometimes the position value is the same for different attributes which I'm guessing shouldn't happen if an array is sorted at the backend Link to comment Share on other sites More sharing options...
Toeareg Posted July 31, 2013 Share Posted July 31, 2013 That's not an issue. The position only needs to be unique within the list of positions for each attribute. Link to comment Share on other sites More sharing options...
benjamin utterback Posted July 31, 2013 Share Posted July 31, 2013 I have my install on a local wamp server. I was able to move the filters around in Modules>Layered Navigation>Configuration I was able to drag and drop, save, and stay saved. This is for both the Attributes in Catalog>Attributes and Modules>Layered Navigation>Configuration It's very strange that it's not working for you, even after the max_input_vars is changed. Link to comment Share on other sites More sharing options...
tomerg3 Posted July 31, 2013 Share Posted July 31, 2013 You can try using Firefox with Firebug and look at the console. When you drag and drop, you will see a new request (IE http://screencast.com/t/VsecOlKbtXm ) First see if they return 200 OK, or another code (IE 404 or 500). Then, you can look at the "Response" tab and see if there are any errors there. Link to comment Share on other sites More sharing options...
Toeareg Posted August 1, 2013 Share Posted August 1, 2013 (edited) I have my install on a local wamp server. I was able to move the filters around in Modules>Layered Navigation>Configuration I was able to drag and drop, save, and stay saved. This is for both the Attributes in Catalog>Attributes and Modules>Layered Navigation>Configuration That is not what I meant with "sort order in the layered navigation block" problem. I have an Attribute "Sizes" which has Values XS,S,M,L,XL,XXL (with ID's 1,2,3,4,5,6 AND positions 0,1,2,3,4,5). Now my Size select menu shows the attributes in this order AND the layered block Sizes show them in this order too. But if the attribute values are entered as L,M,S,XL,XS,XXL and I want them to show up as XS,S,M,L,XL,XXL then I need to change the positions which gives this matrix: Val => ID => Position XS => 5 => 0 S => 3 => 1 M => 2 => 2 L => 1 => 3 XL => 4 => 4 XXL => 6 => 5 For the Size select menus this works just fine. But in my block layered navigation, the attribute values are still shown in ID order, so L,M,S,XL,XS,XXL. That is NOT how this should work. The block layered navigation should conform to the preferred sort order (positions) just like the menus. **UPDATE** I made some changes to modules/blocklayered/blocklayered.php (lines 2677 & 2709) to make the sort order of the attribute values work in block layered navigation as well as in the menus. Line 2677, added a.position in the SELECT clause: SELECT COUNT(DISTINCT p.id_product) nbr, lpa.id_attribute_group, a.position, a.color, al.name attribute_name, agl.public_name attribute_group_name , lpa.id_attribute, ag.is_color_group, Line 2709, changed the ORDER BY clause from: ORDER BY id_attribute_group, id_attribute'; to: ORDER BY id_attribute_group, position'; Now all sorting works like it should Edited August 1, 2013 by Toeareg (see edit history) 3 Link to comment Share on other sites More sharing options...
johnprest99 Posted August 1, 2013 Author Share Posted August 1, 2013 Ok weird I get it on both local wamp and a live server the exact problem. Here's my one response and it doesn't look like yours ok position 6 for attribute 6\r\n Link to comment Share on other sites More sharing options...
johnprest99 Posted August 2, 2013 Author Share Posted August 2, 2013 anyone have more of a update on this especially as I get different output Link to comment Share on other sites More sharing options...
tilki Posted August 3, 2013 Share Posted August 3, 2013 (edited) SOLVED:..thank you, it works...I need to do the same for manufactures and features values, could you please advise what to change? The best - they will be sorted in alphabetical order.... I can't change their positions in BO (is tha a bug?) Edited August 4, 2013 by tilki (see edit history) Link to comment Share on other sites More sharing options...
Toeareg Posted August 5, 2013 Share Posted August 5, 2013 @Tilki, To get the manufacturers sorted alphabetically open modules/blocklayered/blocklayered.php and look for this string: GROUP BY p.id_manufacturer It should be in there twice! Change them both to: GROUP BY p.id_manufacturer ORDER BY m.name ASC The features have a position, but I have not needed to use another sorting order yet, so I haven't changed the code for that. But since it requires joining in another table into the query, that's not some code change I can simply dish up from the top of my head. If you can live with alphabetical sorting of the features, you can take a shortcut and do the same as for manufacturers: Change GROUP BY fv.id_feature_value To: GROUP BY fv.id_feature_value ORDER BY fl.name ASC Make sure to keep all code between the enclosing apostrophs. Hope that works for you. 1 Link to comment Share on other sites More sharing options...
johnprest99 Posted August 6, 2013 Author Share Posted August 6, 2013 okay does anyone else have a solution for the catalog attributes screen? Link to comment Share on other sites More sharing options...
tilki Posted August 6, 2013 Share Posted August 6, 2013 Toeareg thank you! Link to comment Share on other sites More sharing options...
Toeareg Posted August 6, 2013 Share Posted August 6, 2013 Ok weird I get it on both local wamp and a live server the exact problem. Here's my one response and it doesn't look like yours ok position 6 for attribute 6\r\n That's what I get too when dragging/dropping with Firefox. But does the DB value not change with it? Link to comment Share on other sites More sharing options...
johnprest99 Posted August 6, 2013 Author Share Posted August 6, 2013 Not always. sometimes it changes but event hen it wont for example change to the last position event hough that is where it had been dragged to Link to comment Share on other sites More sharing options...
Toeareg Posted August 6, 2013 Share Posted August 6, 2013 So if you for instance have 30 values for a certain attribute and you drag/drop a value from the top position to the bottom, the correct response for Firebug would be ok position 29 for attribute xx and the DB should update all positions for all values because they all move up 1 spot. Can you check if this happens at all or if there is any inconsistancy in the DB update behaviour? Link to comment Share on other sites More sharing options...
johnprest99 Posted August 6, 2013 Author Share Posted August 6, 2013 okay looking at the db I can see that when you move it to the last position. The number assigned for example is 131 yet in the db the values at 134 or 135 still exist and do not change their positions. This doesn't happen on a stock prestashop. May be if you delete a value it messes with their structure Link to comment Share on other sites More sharing options...
Toeareg Posted August 6, 2013 Share Posted August 6, 2013 Could be a possibility. But do you really have that many attribute values? Can you post a SQL export from the attributes tables? Link to comment Share on other sites More sharing options...
johnprest99 Posted August 6, 2013 Author Share Posted August 6, 2013 Toeareg - I have sent you a pm with the sql dump Link to comment Share on other sites More sharing options...
Toeareg Posted August 7, 2013 Share Posted August 7, 2013 @johnprest99, You have my reply message in your box. Just to clarify for the other readers: I can load and reorder the attributes/values without problems in my test setup. Everything works as it should. So this looks like it's not a Prestashop issue, but rather an installation issue of some kind. Maybe there is anybody out there who has more knowledge about setting up apache/php/mysql properly? Link to comment Share on other sites More sharing options...
johnprest99 Posted August 7, 2013 Author Share Posted August 7, 2013 Thanks Toeareg for all your help. How weird that this problem persists on both a wamp setup and redhat. I shall investigate further and let the community know if anything is found Link to comment Share on other sites More sharing options...
benjamin utterback Posted August 7, 2013 Share Posted August 7, 2013 Your wamp setup does the same? On a fresh installation? Or is a modified installation? Link to comment Share on other sites More sharing options...
johnprest99 Posted August 7, 2013 Author Share Posted August 7, 2013 okay guys found this to be the problem. It appears along the way (possibly when values are deleted) the max ordering value for example was 136 when there was only 131 products(when moved last position it would always be 131 but of course db has 136 as last entry hence wrong display on screen). Also some attributes have same order value eg 46 three times I spotted in my db. Once I cleared all these up it works as it should. Appears prestashop can not reconfigure itself after deletes possibly Link to comment Share on other sites More sharing options...
kirinMissy Posted October 16, 2013 Share Posted October 16, 2013 (edited) **UPDATE** I made some changes to modules/blocklayered/blocklayered.php (lines 2677 & 2709) to make the sort order of the attribute values work in block layered navigation as well as in the menus. Line 2677, added a.position in the SELECT clause: SELECT COUNT(DISTINCT p.id_product) nbr, lpa.id_attribute_group, a.position, a.color, al.name attribute_name, agl.public_name attribute_group_name , lpa.id_attribute, ag.is_color_group, Line 2709, changed the ORDER BY clause from: ORDER BY id_attribute_group, id_attribute'; to: ORDER BY id_attribute_group, position'; Now all sorting works like it should These work for me. Thank you Edited October 16, 2013 by kirinMissy (see edit history) Link to comment Share on other sites More sharing options...
benjamin utterback Posted June 3, 2014 Share Posted June 3, 2014 Would some one explain how to do this for a n00b like myself that does not know about database editing. I have deleted a few values maybe like 5-10 back in prestashop 1.5 now on 1.6.0.6 i have this problem and have tried everything elese including getting my host to edit my PHP.ini for my VDS. going insane need to arrange my values Okay, so have you done anything in your database already. If so, did you make a backup before you did? Link to comment Share on other sites More sharing options...
benjamin utterback Posted June 3, 2014 Share Posted June 3, 2014 http://www.prestashop.com/blog/en/how-to-manually-back-up-mysql-database-and-prestashop-files/ That should help you backup. Then we can try a solution. Link to comment Share on other sites More sharing options...
asmar Posted June 20, 2014 Share Posted June 20, 2014 Anyone with a solution to the save issue? I'm drag and drop values but after doing a refresh they are not saved. Value in php.ini is as suggested. Any ideas? Thanks Link to comment Share on other sites More sharing options...
gatla2 Posted July 12, 2014 Share Posted July 12, 2014 That is not what I meant with "sort order in the layered navigation block" problem. I have an Attribute "Sizes" which has Values XS,S,M,L,XL,XXL (with ID's 1,2,3,4,5,6 AND positions 0,1,2,3,4,5). Now my Size select menu shows the attributes in this order AND the layered block Sizes show them in this order too. But if the attribute values are entered as L,M,S,XL,XS,XXL and I want them to show up as XS,S,M,L,XL,XXL then I need to change the positions which gives this matrix: Val => ID => Position XS => 5 => 0 S => 3 => 1 M => 2 => 2 L => 1 => 3 XL => 4 => 4 XXL => 6 => 5 For the Size select menus this works just fine. But in my block layered navigation, the attribute values are still shown in ID order, so L,M,S,XL,XS,XXL. That is NOT how this should work. The block layered navigation should conform to the preferred sort order (positions) just like the menus. **UPDATE** I made some changes to modules/blocklayered/blocklayered.php (lines 2677 & 2709) to make the sort order of the attribute values work in block layered navigation as well as in the menus. Line 2677, added a.position in the SELECT clause: SELECT COUNT(DISTINCT p.id_product) nbr, lpa.id_attribute_group, a.position, a.color, al.name attribute_name, agl.public_name attribute_group_name , lpa.id_attribute, ag.is_color_group, Line 2709, changed the ORDER BY clause from: ORDER BY id_attribute_group, id_attribute'; to: ORDER BY id_attribute_group, position'; Now all sorting works like it should HI excuse me for my bad english but does n work in prestashop 1.6.0.8. have u sollution? Link to comment Share on other sites More sharing options...
Toeareg Posted July 15, 2014 Share Posted July 15, 2014 No sorry, I have just installed 1.6 yesterday and I will need some time to get acquainted with this version. Link to comment Share on other sites More sharing options...
Pete78 Posted October 16, 2014 Share Posted October 16, 2014 I had the same issue on a customer database: Reason was, that several values in a group had the same position values. This can come from a bad import or somehow else.. This worked for me: Add a test attribute to this group and delete it right aways. Deletion will clean up positions in the table and the values should be allright again.. Hope this helps 2 Link to comment Share on other sites More sharing options...
robertocommerce Posted November 2, 2015 Share Posted November 2, 2015 Hi, i have prestashop 1.6.0.13 by I can not sort the attributes by alphabetically Name I have many attributes and would like to show in order, I tried to put the line ORDER BY agl.`id_attribute_group`, al.`name` ASC'; in place of ORDER BY id_attribute_group, id_attribute '; but not work! can someone help me? Link to comment Share on other sites More sharing options...
andrej981 Posted April 19, 2017 Share Posted April 19, 2017 Hi, I have a problem with sorting product attribute. In BO size is list in order that I added it with combination generator. But in front ofice attributes are not in same order like in BO. Problem is that if I choose size which I already add for product before, prestashop place ¨"old" size first and then new created size. But only in FO in BO they are just like they have to be. Examlpe: BO 100 x 100cm (add second) BO 110 x 110cm (add first) FO 110 x 110cm (add first) FO 100 x 100cm (add second) My prestashop version is 1.6.1.4. Can someone please help me with this? Link to comment Share on other sites More sharing options...
Recommended Posts