How does prestashop loads Images?

喜夏-厌秋 提交于 2019-12-07 08:19:24

Product's images routes are not related to product id, but related to image id. For example: id_image =35 route should be /img/p/3/5/35.jpg You can find relation between image and product in ps_image table in DB.

Images link are dynamically formed in Link::getImageLink function located at classes/Link.php. If you want to do some modification this is the best place to do it.

Gook luck

go to your backend Vaii and in the products page, you will find the Export button.

In csv there in the first two columns id and url image.

include(dirname(__FILE__).'/../../config/config.inc.php');

//Customize it so you have <product id> and <your ur photo>

$image = new Image();
$image->id_product = (int) <product id>;
$image->position = Image::getHighestPosition($product->id) + 1;
$image->cover =  true;
$image->add();
$photo_url = <your ur photo>;
copyImg($id, $image->id, $photo_url, 'products', !Tools::getValue('regenerate'));
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!