Order Products in category so that we can customize swap product ordering

Posted about 5 years ago by Yet Another Tech

Post a topic
Answered
Y
Yet Another Tech

Can we add drag/drop functionality in product categories so that we can customize the order which products appear when swapping categories? It looks like we could add an order column to the fpd_category_products_rel table which would allow this functionality

0 Votes

Y

Yet Another Tech posted about 5 years ago Best Answer

Maybe this will help other people having issues with ordering category items. I created my designs in order initially, but WP / MYSQL was giving me results out of order. Certain ids with higher values were appearing before others. To fix this, I was able to simply reorder the database index on my wp_fpd_products table. This then ordered the results by ID and solved my issue. 

RUNNING DATABASE QUERIES CAN BE DANGEROUS BACK UP BEFORE YOU ATTEMPT THIS
Note: your database may be using a custom prefix, it can generally be found in /wp-config.php
Once you find your prefix, you can replace wp_ in the following command and run it
To reorder the index you can run the command 
ALTER TABLE `wp_fpd_products` ORDER BY `ID` ASC;

0 Votes


2 Comments

Sorted by
Y

Yet Another Tech posted about 5 years ago

I'll mention I was very lucky in my case that BECAUSE I added them in the proper order, this worked for me.... additions out of order would not find this working


0 Votes

Y

Yet Another Tech posted about 5 years ago Answer

Maybe this will help other people having issues with ordering category items. I created my designs in order initially, but WP / MYSQL was giving me results out of order. Certain ids with higher values were appearing before others. To fix this, I was able to simply reorder the database index on my wp_fpd_products table. This then ordered the results by ID and solved my issue. 

RUNNING DATABASE QUERIES CAN BE DANGEROUS BACK UP BEFORE YOU ATTEMPT THIS
Note: your database may be using a custom prefix, it can generally be found in /wp-config.php
Once you find your prefix, you can replace wp_ in the following command and run it
To reorder the index you can run the command 
ALTER TABLE `wp_fpd_products` ORDER BY `ID` ASC;

0 Votes

Login or Sign up to post a comment