Jump to content

Changing image urls in database


just444

Recommended Posts

Hey guys,

 

I recently moved my shop from a test subdomain to a new domain and completely forgot that I used the full link structure when I was pointing to images in the product description. I obviously created all my products based on the first one and now I have nearly 1000 products with missing images x2 languages. Is there any way to change the link structure in phpmyadmin automatically or in bulk?

 

Current img link structure: 

http://my.oldsite.com/img/cms/variousimagenames.jpg'>http://my.oldsite.com/img/cms/variousimagenames.jpg

Should be changed to:

/img/cms/variousimagenames.jpg

by removing 

http://my.oldsite.com

Simply want to remove the beginning: http://my.oldsite.com or replace my.oldsite.com with http://mynewsite.com

Edited by just444 (see edit history)
Link to comment
Share on other sites

Hi,

the update query that will do the job for the product descriptions is the following:

 

"

UPDATE `ps_product_lang`
SET description = REPLACE(description, 'http://my.oldsite.com' , '')
WHERE description LIKE '%http://my.oldsite.com/%';

"

or this is for replacing the old url with the new one:

"

UPDATE `ps_product_lang`
SET description = REPLACE(description, 'http://my.oldsite.com', 'http://mynewsite.com')
WHERE description LIKE '%http://my.oldsite.com/%';

"

 

Just run it in phpmyadmin (replace ps_ with yor database prefix if you have other prefix than ps_ )

 

Regards, Leo

Edited by [email protected] (see edit history)
Link to comment
Share on other sites

  • 7 years later...

Bonjour,

Je viens de tester cette commande sur un Presta 8.1, 344 lignes ont été annoncées traitées par phpMyAdmin mais les images de mes descriptions produit utilisent toujours l'ancienne URL. Une idée quelqu'un ?

Merci.

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...