Jump to content

Recommended Posts

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())
    if (!AdminImportController::copyImg($id_product, $image->id, $url, 'products', true))

But it seems like it doesn't download image. It adds to product, but no image is shown:


What could be wrong with this?

Thanks in advantage.

Share this post

Link to post
Share on other sites
  • 1 year later...

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

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More