Skip to content

Add SetProductImagesForAllShop Admin API endpoint - #384

Closed
PrestaEdit wants to merge 1 commit into
PrestaShop:devfrom
PrestaEdit:add-product-shop-image-associations-endpoint
Closed

PrestaEdit wants to merge 1 commit into
PrestaShop:devfrom
PrestaEdit:add-product-shop-image-associations-endpoint

Conversation

@PrestaEdit

Copy link
Copy Markdown
Contributor
Questions Answers
Branch? dev
Description? Adds PUT /products/{productId}/image-shop-associations using CQRSUpdate with SetProductImagesForAllShopCommand. Body: {productImageSettings: [{productImageId, shopIds[]}, ...]} — mirrors the ProductImageSetting VO shape. Each entry maps an image to a set of shops the image should belong to; images not listed are detached from all shops.
Type? new feature
Category? CO
BC breaks? no
Deprecations? no
Fixed ticket? Related to PrestaShop/PrestaShop#39630
How to test? Scope-protection test only for now — full happy-path coverage would need multi-shop fixtures + seeded product images that the existing test infrastructure does not currently expose.

⚠️ Depends on PrestaShop/PrestaShop#42049 — that PR adds a public setProductImageSettings(array) bulk setter to the command. Today only the per-item addProductSetting() adder exists, which Symfony's serializer can't drive from a JSON body. After #42049 lands the endpoint will start denormalizing correctly.

Adds PUT /products/{productId}/image-shop-associations using CQRSUpdate
with SetProductImagesForAllShopCommand. Body: {productImageSettings:
[{productImageId, shopIds[]}, ...]} — mirrors the ProductImageSetting VO
shape. Each entry maps an image to a set of shops the image should
belong to; images not listed are detached from all shops.

Depends on PrestaShop/PrestaShop#42049 which adds a bulk
setProductImageSettings() to the command. Without that setter the
Symfony denormalizer can't bind the request-body array (only the
per-item addProductSetting() adder is exposed).

Related to PrestaShop/PrestaShop#39630

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@ps-jarvis ps-jarvis added the Waiting for QA Status: Action required, Waiting for test feedback label Jul 29, 2026
@ps-jarvis ps-jarvis moved this from Ready for review to To be tested in PR Dashboard Jul 29, 2026
@jolelievre

Copy link
Copy Markdown
Contributor

Closing in favor of #410, which centralizes all the pending Product-domain endpoints into a single PR: mutualizing the changes makes the review simpler, and it allowed rebuilding the integration tests so that every fixture is created through the API alone (with whole-structure assertions). @PrestaEdit your work is kept and you are co-authored on the commits of #410 — thanks!

Note: in #410 the operation becomes PUT /products/{productId}/shop-images, sharing its URI and resource with the read side, and it no longer depends on PrestaShop/PrestaShop#42049: the command is built by a dedicated module denormalizer, so the endpoint works on every supported core version.

@jolelievre jolelievre closed this Aug 11, 2026
@github-project-automation github-project-automation Bot moved this from To be tested to Closed in PR Dashboard Aug 11, 2026
jolelievre added a commit to jolelievre/ps_apiresources that referenced this pull request Aug 13, 2026
Centralizes the pending Product-domain endpoint PRs into a single
branch, as requested in PrestaShop/PrestaShop#42054 (tracking table:
PrestaShop/PrestaShop#39630). Original content authored by PrestaEdit:

- PrestaShop#337 GET product attribute groups
- PrestaShop#353 GET product supplier options
- PrestaShop#354 GET shop product images
- PrestaShop#361 GET product stock movements
- PrestaShop#374 GET free gift candidates
- PrestaShop#383 POST/PATCH virtual product file
- PrestaShop#384 PUT product image shop associations
- PrestaShop#256 PUT product stock
- PrestaShop#268 product suppliers (associate, default, remove all)
- PrestaShop#269 PATCH product supplier details
- PrestaShop#308 DELETE virtual product file (resource only; its test file
  collides with PrestaShop#383's and the tests are rewritten in this PR)

Endpoints are imported as-is; consolidation, review fixes and test
rewrites follow in dedicated commits.

Co-Authored-By: Jonathan Danse <j.danse@prestaedit.com>
jolelievre added a commit to jolelievre/ps_apiresources that referenced this pull request Sep 15, 2026
Centralizes the pending Product-domain endpoint PRs into a single
branch, as requested in PrestaShop/PrestaShop#42054 (tracking table:
PrestaShop/PrestaShop#39630). Original content authored by PrestaEdit:

- PrestaShop#337 GET product attribute groups
- PrestaShop#353 GET product supplier options
- PrestaShop#354 GET shop product images
- PrestaShop#361 GET product stock movements
- PrestaShop#374 GET free gift candidates
- PrestaShop#383 POST/PATCH virtual product file
- PrestaShop#384 PUT product image shop associations
- PrestaShop#256 PUT product stock
- PrestaShop#268 product suppliers (associate, default, remove all)
- PrestaShop#269 PATCH product supplier details
- PrestaShop#308 DELETE virtual product file (resource only; its test file
  collides with PrestaShop#383's and the tests are rewritten in this PR)

Endpoints are imported as-is; consolidation, review fixes and test
rewrites follow in dedicated commits.

Co-Authored-By: Jonathan Danse <j.danse@prestaedit.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Waiting for QA Status: Action required, Waiting for test feedback

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants