Skip to content

feat(catalog): expose real product descriptions - #137

Open
Lukas Rump (lukasrump) wants to merge 2 commits into
mainfrom
feat/expose-real-product-description
Open

feat(catalog): expose real product descriptions#137
Lukas Rump (lukasrump) wants to merge 2 commits into
mainfrom
feat/expose-real-product-description

Conversation

@lukasrump

Copy link
Copy Markdown
Contributor

Problem

The UCP catalog mapper (ShopwareDataMapper::toProduct()) only passed the product title to the SDK Product. The SDK then hardcoded description.plain to that title, so catalog/search, catalog/lookup, and catalog/product all returned the title echoed back under the schema-required description field — 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

  • Read the product description (translation-aware: getTranslation('description') with a fallback to getDescription()).
  • Strip the storefront HTML to clean plain text (strip_tags + entity decode + whitespace collapse).
  • Pass it to the SDK Product via the new description argument, and reuse it for the lookup variant description.
  • Products without a description fall back to the title exactly as before.

Dependency / merge order

Depends on ucp-php-sdk#98, which adds the optional description argument to Product. That PR must merge first (or UCP_SDK_REF must point at its branch); until then the unit test build here will be red because the constructor argument does not yet exist on the SDK main this repo pins by default.

Tests

Extends ShopwareCatalogGatewayTest with:

  • 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-degenerate price_range remain title/single-price derived and would each need dedicated SDK fields first (tracked alongside ucp-php-sdk#98).

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants