Tárraga Posted June 12, 2018 Share Posted June 12, 2018 I'm trying to add programmatically a product image with this code $id_product = $product->id; $url = 'http://server.com/img/myproductimage.jpg'; $shops = Shop::getShops(true, null, true); $image = new Image(); $image->id_product = $id_product; $image->position = Image::getHighestPosition($id_product) + 1; $image->cover = true; // or false; if (($image->validateFields(false, true)) === true && ($image->validateFieldsLang(false, true)) === true && $image->add()) { $image->associateTo($shops); if (!AdminImportController::copyImg($id_product, $image->id, $url, 'products', true)) { $image->delete(); } } But it seems like it doesn't download image. It adds to product, but no image is shown: https://image.ibb.co/jS4F9d/blank_image_ps.png What could be wrong with this? Thanks in advantage. Link to comment Share on other sites More sharing options...
LauraPresta Posted June 18, 2018 Share Posted June 18, 2018 interested too about this Link to comment Share on other sites More sharing options...
chale Posted May 19, 2020 Share Posted May 19, 2020 did you manage to solve? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now