Zen Cart Logo
Forums / General Questions / Change sort order of products in a category using phpmyadmin

Change sort order of products in a category using phpmyadmin

Views: 1,681

Results 1 to 10 of 10
4 Sep 2011, 5:34 PM
#1
mcpisik avatar

mcpisik

Zen Follower

Join Date:
Jan 2007
Location:
Mount Maunganui, New Zealand
Posts:
417
Plugin Contributions:
0

Change sort order of products in a category using phpmyadmin

Hi Ajeh and others in the know,
A few years ago you kindly suggested some samples, to change store quantities all to 100 using phpmyadmin.
I was hoping you might throw me an example for another...
Would like to change all products in category 5 for example, to have a sort order of 200. (would like them below other products when a search word is used, as they are accessories)
I would just change them manually but there are 2000 products on the site.
Thanks :smile:

4 Sep 2011, 5:53 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Change sort order of products in a category using phpmyadmin

If all of the Products in categories_id 5 are using that for the master_categories_id then you could use:

UPDATE products set products_sort_order = 200 WHERE master_categories_id = 5;

NOTE: be sure to backup your database before attempting this ...

10 Sep 2011, 8:49 PM
#3
mcpisik avatar

mcpisik

Zen Follower

Join Date:
Jan 2007
Location:
Mount Maunganui, New Zealand
Posts:
417
Plugin Contributions:
0

Re: Change sort order of products in a category using phpmyadmin

Awesome. That worked a treat.
Thanks for the response and code!

10 Sep 2011, 9:17 PM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Change sort order of products in a category using phpmyadmin

Thanks for the update that this worked for you ... :smile:

2 Aug 2012, 7:02 PM
#5
mcpisik avatar

mcpisik

Zen Follower

Join Date:
Jan 2007
Location:
Mount Maunganui, New Zealand
Posts:
417
Plugin Contributions:
0

Re: Change sort order of products in a category using phpmyadmin

Might I ask the php code, to change all products in Category id 1, to have a manufacturer of: XYZ ?

2 Aug 2012, 10:34 PM
#6
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Change sort order of products in a category using phpmyadmin

What is the manufactuers_id for the manufacturer of: XYZ ?

2 Aug 2012, 10:49 PM
#7
mcpisik avatar

mcpisik

Zen Follower

Join Date:
Jan 2007
Location:
Mount Maunganui, New Zealand
Posts:
417
Plugin Contributions:
0

Re: Change sort order of products in a category using phpmyadmin

4, thanks

2 Aug 2012, 10:55 PM
#8
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Change sort order of products in a category using phpmyadmin

If ALL Products that are using categories_id 1 for their master_categories_id need to have their manufacturers_id to be changed to 4, then in the Tools ... Install SQL Patches, you could use:

UPDATE products SET manufacturers_id = 4 WHERE master_categories_id = 1;

NOTE: be sure to backup your database before doing this ...

4 Aug 2012, 8:14 AM
#9
mcpisik avatar

mcpisik

Zen Follower

Join Date:
Jan 2007
Location:
Mount Maunganui, New Zealand
Posts:
417
Plugin Contributions:
0

Re: Change sort order of products in a category using phpmyadmin

Thanks for the solution again Ajeh :)
I've used this, to change all of our hire/rental items to a manufacturer of "Hire"
And the purchase items to a manufacturer of "Sales"
This allows me to export a report for hire and a report for purchases made for any month, for our accountant.
(perhaps there is a better way, but thought I'd write this in case someone in future may find it useful)

4 Aug 2012, 12:43 PM
#10
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Change sort order of products in a category using phpmyadmin

Thanks for the update that this worked for you ... :smile: