Skip to content

Commit e1bf631

Browse files
Merge pull request #893 from sdinteractive/ADO-274-add-sale-price-mapping
Ado 274 add sale price mapping
2 parents f3bd984 + 8c3a36e commit e1bf631

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

app/code/Meta/Catalog/Model/Product/Feed/Builder.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,7 @@ public function buildProductEntry(Product $product)
768768
self::ATTR_PRODUCT_TYPE => $this->getProductType($product),
769769
self::ATTR_CONDITION => $this->getCondition($product),
770770
self::ATTR_PRICE => $this->builderTools->getProductPrice($product),
771-
self::ATTR_SALE_PRICE => $this->builderTools->getProductSalePrice($product),
771+
self::ATTR_SALE_PRICE => $this->getSalePrice($product),
772772
self::ATTR_SALE_PRICE_EFFECTIVE_DATE => $this->builderTools->getProductSalePriceEffectiveDate($product),
773773
self::ATTR_COLOR => $this->getColor($product),
774774
self::ATTR_SIZE => $this->getSize($product),
@@ -819,6 +819,23 @@ public function buildProductEntry(Product $product)
819819
return $entry;
820820
}
821821

822+
/**
823+
* Get product sale price
824+
*
825+
* @param Product $product
826+
* @return mixed|null
827+
*/
828+
private function getSalePrice(Product $product)
829+
{
830+
$salePrice = isset($this->attrMap[self::ATTR_SALE_PRICE])
831+
? $product->getData($this->attrMap[self::ATTR_SALE_PRICE]) : null;
832+
if (!$salePrice) {
833+
$this->builderTools->getProductSalePrice($product);
834+
}
835+
836+
return $salePrice;
837+
}
838+
822839
/**
823840
* Get product additional images
824841
*

app/code/Meta/Catalog/etc/adminhtml/di.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
<item name="applink" xsi:type="string">App link</item>
5252
<item name="disabled_capabilities" xsi:type="string">Disabled Capabilities</item>
5353
<item name="commerce_tax_category" xsi:type="string">Commerce Tax Category</item>
54+
<item name="sale_price" xsi:type="string">Sale Price</item>
5455
</argument>
5556
</arguments>
5657
</type>

0 commit comments

Comments
 (0)