Skip to content

Import images with delete; imports with unknown type

Compare
Choose a tag to compare
@patrick-bigbridge patrick-bigbridge released this 08 Oct 12:42
· 118 commits to master since this release
  1. By default, the importer does not delete images. Images are only added and updated.

If you want the importer to delete existing product images that are not present in the current import, use this

 $config->imageStrategy = ImportConfig::IMAGE_STRATEGY_SET;

This will set images as they are named in the import. However, the importer will still not remove all images if none are added to a product. This is a safety precaution.

  1. If the product type is unknown, you can ask the library for the Product, by giving the sku:

    $product = $importer->getExistingProductBySku($sku);

or the id

$product = $importer->getExistingProductById($id);    

The importer will return an object with the correct class, or false if no product with the id or sku could be found.