Jump to content

[SOLVED] - SQL - Copy "name product" from product_lang to caption image?


Recommended Posts

Good evening,

I have to face the following problem:many of my products have an incorrect image description which have to be modified. On the basis of the huge quantity of products it seems impossible to corre everything manually

 

Is it possible to work directly in the db and to copy allthe the "name" fields of ps_product_lang tab in the matching fields of the image tab?ps_image_lang

 I manage to create following tab

 

 

SELECT l.*,p.* FROM `ps_image_lang` l

join `ps_image` i on i.`id_image` = l.`id_image`

join  `ps_product_lang` p on i.`id_product`=p.`id_product`

 

But I'm not able to substitute the fields... thanks

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

  • 2 weeks later...
  • 3 weeks later...
  • 2 weeks later...
  • 6 months later...

Hello,

Thank guys, this is working:

UPDATE ps_image_lang AS l 
INNER JOIN ps_image AS i ON (i.id_image = l.id_image)
INNER JOIN ps_product_lang AS pl ON (pl.id_product = i.id_product)
SET l.legend = pl.name
WHERE l.id_lang = 2
AND pl.id_lang = 2

Please i Have a question, i would like to  moove this query to next level. Is it possible to copy Product name +assigned color combination to img caption name?
 

So for example if i had this product in my shop:

"Insane T-shirt" in 2 colors -> 1) Black and 2) White

The image caption will be: "Insane T-shirt Black" & "Insane T-shirt White" (ofcourse if you have assigned images to color combinations)

 

I know it would be quite complicated, but i don´t think that it is imimpossible :)
 
Is there any who can help us? Thanks youuu

 

 

Link to comment
Share on other sites

  • 1 year later...

This worked for me. I changed database name to fit mine and language.

UPDATE
    ps2_image_lang AS l
INNER JOIN ps2_image AS i
ON
    (i.id_image = l.id_image)
INNER JOIN ps2_product_lang AS pl
ON
    (pl.id_product = i.id_product)
SET
    l.legend = pl.name
WHERE
    l.id_lang = 1 AND pl.id_lang = 1

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