Jump to content

Sorting products within a category


Recommended Posts

Hi,

(reposted duing to being in wrong cat)

A have what must be a simple issue. I am trying to sort products in a category, so I can display them in a selected order.

On the back end, I am going into the category, selecting the products and moving them around in the group. This seems to change the order, but as soon as I reload the page etc, it just changes back ?

Also where is the order stored within the product, I have a number of sql queries that pull out products from a give category and I want them in the ordered in the correct order I have setup. I though can not find a field that stores any sort of order ?

Andy

Link to comment
Share on other sites

What version of PrestaShop are you using? I know bugs in the position code have been fixed. The `position` field is in the ps_category_product table. Make sure those numbers are sequential, otherwise problems will occur when repositioning products.

Link to comment
Share on other sites

  • 1 month later...
What version of PrestaShop are you using? I know bugs in the position code have been fixed. The `position` field is in the ps_category_product table. Make sure those numbers are sequential, otherwise problems will occur when repositioning products.


Yes, Prestashop is quite buggy when it comes to positioning. I'm using version 1.3.3 - when did the "fix" occur ?
Link to comment
Share on other sites

  • 2 weeks later...

In Prestashop 1.3.6, I find another sort products position bug. It would make duplicated position in database and then the two items would move together when click on one (up/down) of them.

mysql> select * from category_product where id_category=65 order by position;

+-------------+------------+----------+


| id_category | id_product | position |


+-------------+------------+----------+


| 65 | 84 | 0 |


| 65 | 80 | 1 |


| 65 | 81 | 2 |


| 65 | 90 | 3 |


| 65 | 92 | 4 |


| 65 | 89 | 5 |


| 65 | 94 | 6 |


| 65 | 91 | 6 |


| 65 | 88 | 7 |


| 65 | 86 | 8 |


| 65 | 87 | 9 |


| 65 | 95 | 10 |


| 65 | 85 | 11 |


| 65 | 83 | 12 |


| 65 | 82 | 13 |


+-------------+------------+----------+


15 rows in set (0.00 sec)

Note the position 6 used by two products.

I correct the database easy by the following SQL.
update category_product set position=14 where id_category=65 and id_product=91;

Please direct me on which php caused the fault as I notice that happened in other categories.
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...