feat(catalog): expose real product descriptions - #137
Open
Lukas Rump (lukasrump) wants to merge 2 commits into
Open
feat(catalog): expose real product descriptions#137Lukas Rump (lukasrump) wants to merge 2 commits into
Lukas Rump (lukasrump) wants to merge 2 commits into
Conversation
The catalog mapper only passed the product title to the SDK Product, so catalog/search, catalog/lookup, and catalog/product all returned the title echoed back under the schema-required description field instead of the product's actual text. Read the (translation-aware) product description, strip the storefront HTML to plain text, and pass it to the SDK Product description argument. Products without a description fall back to the title as before. Depends on ucp-php-sdk#98 for the new Product description argument.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The UCP catalog mapper (
ShopwareDataMapper::toProduct()) only passed the product title to the SDKProduct. The SDK then hardcodeddescription.plainto that title, socatalog/search,catalog/lookup, andcatalog/productall returned the title echoed back under the schema-requireddescriptionfield — agents never received the product's real text. This was flagged during demo prep: descriptions we expose in the storefront integrations were missing from the catalog.Change
getTranslation('description')with a fallback togetDescription()).strip_tags+ entity decode + whitespace collapse).Productvia the newdescriptionargument, and reuse it for the lookup variant description.Dependency / merge order
Depends on ucp-php-sdk#98, which adds the optional
descriptionargument toProduct. That PR must merge first (orUCP_SDK_REFmust point at its branch); until then the unit test build here will be red because the constructor argument does not yet exist on the SDKmainthis repo pins by default.Tests
Extends
ShopwareCatalogGatewayTestwith:testCatalogExposesThePlainProductDescription— an HTML description is surfaced as plain text on both the product and the featured variant.testCatalogDescriptionFallsBackToTheTitleWhenAbsent— no description → title fallback, matching prior behavior.Follow-ups (out of scope)
media, real multi-variant data, and a non-degenerateprice_rangeremain title/single-price derived and would each need dedicated SDK fields first (tracked alongside ucp-php-sdk#98).