Skip to content

Commit 8c3a36e

Browse files
committed
ADO-274: adds method to fetch sale price as per catalog mapping
1 parent e5f1960 commit 8c3a36e

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-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
*

0 commit comments

Comments
 (0)