Jump to content
Sign in to follow this  
Tipusha

Массово скопировать картинки на товары из категорий

Recommended Posts

На сайте есть около 40 категорий. В каждой категории где-то по 600 товаров. Как быстро проставить фото на все товары, чтобы фото конечного товара просто соответствовало фотографии категории(подкатегории) в которой товар находится ? Фото категорий проставляли вручную

Share this post


Link to post
Share on other sites

Я понимаю. Подскажите запрос. Могу заплатить за подсказку )

Share this post


Link to post
Share on other sites

Неужели никто не знает запрос ?

Share this post


Link to post
Share on other sites


CREATE TEMPORARY TABLE `copy_temp_table` (

`product_id` INT UNSIGNED,

`image` varchar(255)

) DEFAULT CHARSET utf8 COLLATE utf8_general_ci;

INSERT INTO `copy_temp_table` (`product_id`, `image`)

SELECT `a`.`product_id`, `b`.`image`

FROM `oc_product_to_category` AS `a`

INNER JOIN `oc_category` AS `b`

ON `a`.`category_id` = `b`.`category_id`

WHERE `a`.`main_category` = 1

GROUP BY `a`.`product_id`;

INSERT INTO `oc_product` (`product_id`, `image`)

SELECT `product_id`, `image`

FROM `copy_temp_table`

ON DUPLICATE KEY UPDATE `image` = VALUES(`image`);

Edited by ZeroHero

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
You are posting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.