diff --git a/src/FeedContext/Google/Shopping/ProductItemContext.php b/src/FeedContext/Google/Shopping/ProductItemContext.php index 88592172..12efe872 100644 --- a/src/FeedContext/Google/Shopping/ProductItemContext.php +++ b/src/FeedContext/Google/Shopping/ProductItemContext.php @@ -17,6 +17,9 @@ use Setono\SyliusFeedPlugin\Model\ColorAwareInterface; use Setono\SyliusFeedPlugin\Model\ConditionAwareInterface; use Setono\SyliusFeedPlugin\Model\GtinAwareInterface; +use Setono\SyliusFeedPlugin\Model\LocalizedBrandAwareInterface; +use Setono\SyliusFeedPlugin\Model\LocalizedColorAwareInterface; +use Setono\SyliusFeedPlugin\Model\LocalizedSizeAwareInterface; use Setono\SyliusFeedPlugin\Model\MpnAwareInterface; use Setono\SyliusFeedPlugin\Model\SizeAwareInterface; use Setono\SyliusFeedPlugin\Model\TaxonPathAwareInterface; @@ -101,8 +104,12 @@ public function getContextList(object $product, ChannelInterface $channel, Local $data->setProductType($productType); } - if ($variant instanceof BrandAwareInterface && $variant->getBrand() !== null) { + if ($variant instanceof LocalizedBrandAwareInterface && $variant->getBrand($locale) !== null) { + $data->setBrand((string) $variant->getBrand($locale)); + } elseif ($variant instanceof BrandAwareInterface && $variant->getBrand() !== null) { $data->setBrand((string) $variant->getBrand()); + } elseif ($product instanceof LocalizedBrandAwareInterface && $product->getBrand($locale) !== null) { + $data->setBrand((string) $product->getBrand($locale)); } elseif ($product instanceof BrandAwareInterface && $product->getBrand() !== null) { $data->setBrand((string) $product->getBrand()); } @@ -119,14 +126,22 @@ public function getContextList(object $product, ChannelInterface $channel, Local $data->setMpn((string) $product->getMpn()); } - if ($variant instanceof SizeAwareInterface && $variant->getSize() !== null) { + if ($variant instanceof LocalizedSizeAwareInterface && $variant->getSize($locale) !== null) { + $data->setSize((string) $variant->getSize($locale)); + } elseif ($variant instanceof SizeAwareInterface && $variant->getSize() !== null) { $data->setSize((string) $variant->getSize()); + } elseif ($product instanceof LocalizedSizeAwareInterface && $product->getSize($locale) !== null) { + $data->setSize((string) $product->getSize($locale)); } elseif ($product instanceof SizeAwareInterface && $product->getSize() !== null) { $data->setSize((string) $product->getSize()); } - if ($variant instanceof ColorAwareInterface && $variant->getColor() !== null) { + if ($variant instanceof LocalizedColorAwareInterface && $variant->getColor($locale) !== null) { + $data->setColor((string) $variant->getColor($locale)); + } elseif ($variant instanceof ColorAwareInterface && $variant->getColor() !== null) { $data->setColor((string) $variant->getColor()); + } elseif ($product instanceof LocalizedColorAwareInterface && $product->getColor($locale) !== null) { + $data->setColor((string) $product->getColor($locale)); } elseif ($product instanceof ColorAwareInterface && $product->getColor() !== null) { $data->setColor((string) $product->getColor()); } diff --git a/src/Model/BrandAwareInterface.php b/src/Model/BrandAwareInterface.php index 1cf2ec59..e1a1c567 100644 --- a/src/Model/BrandAwareInterface.php +++ b/src/Model/BrandAwareInterface.php @@ -4,6 +4,10 @@ namespace Setono\SyliusFeedPlugin\Model; +/** + * @deprecated since 0.6.6 This interface is deprecated and will be removed in 0.7.0 + * Use \Setono\SyliusFeedPlugin\Model\LocalizedBrandAwareInterface instead. + */ interface BrandAwareInterface { /** diff --git a/src/Model/ColorAwareInterface.php b/src/Model/ColorAwareInterface.php index b34cd836..485f509e 100644 --- a/src/Model/ColorAwareInterface.php +++ b/src/Model/ColorAwareInterface.php @@ -4,6 +4,10 @@ namespace Setono\SyliusFeedPlugin\Model; +/** + * @deprecated since 0.6.6 This interface is deprecated and will be removed in 0.7.0 + * Use \Setono\SyliusFeedPlugin\Model\LocalizedColorAwareInterface instead. + */ interface ColorAwareInterface { /** diff --git a/src/Model/LocalizedBrandAwareInterface.php b/src/Model/LocalizedBrandAwareInterface.php new file mode 100644 index 00000000..1bdbb643 --- /dev/null +++ b/src/Model/LocalizedBrandAwareInterface.php @@ -0,0 +1,17 @@ +