Skip to content

Updating a product through the API removes its images #10461

Closed
@CatherineLearmonth

Description

@CatherineLearmonth

Preconditions

  1. Magento 2.1.2 or Magento 2.2.0-dev.
  2. Use the PHP api rather than the json one.

Steps to reproduce

  1. A product already exists in Magento, that has images (of any type) on it.
  2. Update the images on the product through the API and save it.

Expected result

  1. On updating a product through the php API, any existing images should remain on the product and new ones updated.

Actual result

  1. The images (whether new or existing) are removed from the product in the UI.

Note: On product update, the value of the store id on table 'catalog_product_entity_media_gallery_value' is set to 1 (when previously it was set to 0). I believe this prevents the update being done to the catalog_product_entity_varchar table for the asset.

I have got round this issue by inserting a row to the varchar table for each asset type after a product save. The assets still exist on the media gallery tables, but are removed from the product varchar table, which prevents them from being displayed in the UI.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions