|
20 | 20 |
|
21 | 21 | namespace Meta\Catalog\Model\Product\Feed;
|
22 | 22 |
|
23 |
| -use Magento\Catalog\Model\ResourceModel\Eav\Attribute; |
24 | 23 | use Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\Related;
|
25 | 24 | use Magento\Framework\Exception\NoSuchEntityException;
|
26 | 25 | use Magento\GroupedProduct\Ui\DataProvider\Product\Form\Modifier\Grouped;
|
|
35 | 34 | use Magento\Catalog\Model\ResourceModel\Category\CollectionFactory as CategoryCollectionFactory;
|
36 | 35 | use Magento\Framework\Exception\LocalizedException;
|
37 | 36 | use Magento\Framework\Escaper;
|
38 |
| -use Magento\Catalog\Model\Product\Visibility; |
39 | 37 | use Magento\Catalog\Model\Product\Attribute\Source\Status;
|
40 | 38 | use Meta\BusinessExtension\Model\System\Config as SystemConfig;
|
41 | 39 |
|
@@ -602,6 +600,26 @@ private function getStatus(Product $product)
|
602 | 600 | return $status == Status::STATUS_ENABLED ? 'active' : 'archived';
|
603 | 601 | }
|
604 | 602 |
|
| 603 | + /** |
| 604 | + * Get age group for product |
| 605 | + * |
| 606 | + * @param Product $product |
| 607 | + * @return string |
| 608 | + * @SuppressWarnings(PHPMD.CyclomaticComplexity) |
| 609 | + */ |
| 610 | + private function getAgeGroup(Product $product) |
| 611 | + { |
| 612 | + $ageGroup = ''; |
| 613 | + if(isset($this->attrMap[self::ATTR_AGE_GROUP])) { |
| 614 | + $ageGroup = $product->getData($this->attrMap[self::ATTR_AGE_GROUP]); |
| 615 | + } |
| 616 | + if (empty($ageGroup)) { |
| 617 | + $ageGroup = $this->additionalAttributes->getCorrectText($product, self::ATTR_AGE_GROUP); |
| 618 | + } |
| 619 | + |
| 620 | + return $ageGroup ?: ''; |
| 621 | + } |
| 622 | + |
605 | 623 | /**
|
606 | 624 | * Get gender for product
|
607 | 625 | *
|
@@ -855,6 +873,7 @@ public function buildProductEntry(Product $product)
|
855 | 873 | self::ATTR_ADDITIONAL_IMAGE_URL => $this->getAdditionalImages($product, $images),
|
856 | 874 | self::ATTR_STATUS => $this->getStatus($product),
|
857 | 875 | self::ATTR_GENDER => $this->getGender($product),
|
| 876 | + self::ATTR_AGE_GROUP => $this->getAgeGroup($product), |
858 | 877 | self::ATTR_MATERIAL => $this->getMaterial($product),
|
859 | 878 | self::ATTR_PATTERN => $this->getPattern($product),
|
860 | 879 | self::ATTR_SHIPPING_WEIGHT => $this->getWeight($product),
|
@@ -1012,6 +1031,7 @@ public function getHeaderFields()
|
1012 | 1031 | self::ATTR_ADDITIONAL_IMAGE_URL,
|
1013 | 1032 | self::ATTR_STATUS,
|
1014 | 1033 | self::ATTR_GENDER,
|
| 1034 | + self::ATTR_AGE_GROUP, |
1015 | 1035 | self::ATTR_MATERIAL,
|
1016 | 1036 | self::ATTR_PATTERN,
|
1017 | 1037 | self::ATTR_SHIPPING_WEIGHT,
|
|
0 commit comments