Forums / General Questions / Mysql query to change all product image in category?

Mysql query to change all product image in category?

Started by jonnyboy22 on 9 Feb 2011, 4:57 PM · Views: 1,109

Results 1 to 6 of 6
9 Feb 2011, 4:57 PM
#1
jonnyboy22 avatar

jonnyboy22

Zen Follower

Join Date:
Jun 2008
Location:
Sheffield South Yorkshire
Posts:
165
Plugin Contributions:
1

Mysql query to change all product image in category?

Hello,

i have a category and i want all the images in that cat to have the same image (image4.jpg). at the moment they all have same image called zone4.

Is their a mysql command that can change all the products in a cat to have the same image .

im running the latest version of zencart.

thanks

Want to switch servers? see our how to migrate Zencart guide
Supercharge your website with our **Fast Zencart Hosting**

9 Feb 2011, 5:11 PM
#2
bonnit avatar

bonnit

Zen Follower

Join Date:
Jun 2009
Location:
Kent, UK
Posts:
350
Plugin Contributions:
0

Re: Mysql query to change all product image in category?

have you looked at the add on easy populate to do this?

http://www.mods.livvylougifts.co.uk Zen Cart Mod Site
http://www.livvylougifts.co.uk Personalised gifts for every occasion

9 Feb 2011, 5:18 PM
#3
jonnyboy22 avatar

jonnyboy22

Zen Follower

Join Date:
Jun 2008
Location:
Sheffield South Yorkshire
Posts:
165
Plugin Contributions:
1

Re: Mysql query to change all product image in category?

not really, ive had easy pop before but as this is only a one off i dont really want to install it

Want to switch servers? see our how to migrate Zencart guide
Supercharge your website with our **Fast Zencart Hosting**

9 Feb 2011, 7:25 PM
#4
ajeh avatar

ajeh

Oba-san

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

Re: Mysql query to change all product image in category?

If all of the Products use the same master_categories_id in the products table and you want ALL Products using that master_categories_id to have the same image then you could:

1 Backup your database

2 See 1

3 run the following SQL statement in the Tools ... Install SQL Patches ...

UPDATE products SET products_image = 'image4.jpg' WHERE master_categories_id = XX;

where XX is the master_categories_id that you want to change the image for the Products ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

10 Feb 2011, 9:11 AM
#5
jonnyboy22 avatar

jonnyboy22

Zen Follower

Join Date:
Jun 2008
Location:
Sheffield South Yorkshire
Posts:
165
Plugin Contributions:
1

Re: Mysql query to change all product image in category?

thanks that worked perfectly again you've save me a lot of work.

now here's another test with some math involved!

would it be possible to use the same (Ish) query to alter the prices of a categorys products by a percentage

e.g something like

UPDATE products SET products_price = '(??current price??-5%)' WHERE master_categories_id = 48;

know this is a long shot but would be really helpfull.

Want to switch servers? see our how to migrate Zencart guide
Supercharge your website with our **Fast Zencart Hosting**

10 Feb 2011, 2:09 PM
#6
ajeh avatar

ajeh

Oba-san

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

Re: Mysql query to change all product image in category?

You could do that with:

UPDATE products SET products_price = products_price * .95 WHERE master_categories_id = 48;

where the .95 is the amount to adjust the existing products_price ...

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

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!