Google Shopping Feed の必須属性を商品の構造化データで充足する
- Dominant language
- PHP
- Stars
- 788
- Forks
- 719
- Avg merge
- 3d 20h
- Merged PRs (30d)
- 45
Description
#6147「店舗情報などの基本的な構造化データの拡充」から切り出しました。
## 切り出しの経緯
#6147 は本文が無く、2 件のコメントで構成されていました。
| コメント | 内容 | 対象 |
|---|---|---|
| [tao-s さん](https://github.com/EC-CUBE/ec-cube/issues/6147#issuecomment-2060589985) | 営業時間、`sameAs` 等、現状の店舗設定では入れられないものがある | 店舗情報(Organization / WebSite) |
| [dotani1111 さん](https://github.com/EC-CUBE/ec-cube/issues/6147#issuecomment-4727789786) | Google Shopping Feed の必須属性を確認、足りないフィードがあれば追加 | **商品フィード** |
前者は #6957 で対応します(`sameAs` / `foundingDate` / `numberOfEmployees` / `image` / `copyrightYear` と、曜日・時刻を持つ `openingHoursSpecification`)。後者は出力先のサービスも対象データも異なるため、本 issue として分離し、#6147 は #6957 の完了で閉じられるようにします。
## やること
Google Merchant Center が要求する属性と、商品詳細ページが現在出力している構造化データを突き合わせ、不足分を追加します。
現状の出力は `Eccube\Service\ProductStructuredDataService::createProductJsonLd()` で、次の項目です。
- `Product`: `name` / `image` / `description` / `sku`(`ProductClass` の最小商品コード) / `category` / `offers`
- `offers`: 規格が複数なら `AggregateOffer`(`url` / `priceCurrency` / `lowPrice` / `highPrice` / `offerCount` / `availability` / `itemCondition`)、単一なら `Offer`(`url` / `priceCurrency` / `price` / `availability` / `itemCondition`)
一方で `brand` と商品識別子(`gtin` / `mpn`)は出力していません。EC-CUBE のコアには対応するデータ項目自体がない(メーカーは maker-plugin)ため、**出力の追加だけで済む項目と、データ項目の新設を伴う項目を分けて整理する**必要があります。
- [ ] Merchant Center の必須属性・推奨属性と現状出力の対応表を作る
- [ ] 出力の追加だけで満たせる項目を洗い出す
- [ ] データ項目の新設が必要なものについて、コアで持つか拡張に委ねるかを判断する
## 備考
`ProductStructuredDataService` には `EccubeEvents::FRONT_PRODUCT_DETAIL_JSON_LD` の拡張点があり、プラグインから `aggregateRating` 等を注入できます。コアで持つべきか拡張で足りるかの判断材料になります。
Contributor guide
Research direction
Start with Eccube\Service\ProductStructuredDataService::createProductJsonLd() and the EccubeEvents::FRONT_PRODUCT_DETAIL_JSON_LD extension point. Compare its current Product and offers fields with Google Merchant Center’s required and recommended attributes. Done means documenting the mapping, identifying additions possible without new data fields, and recording whether missing fields belong in core or extensions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100