From b0402f35584c670e8d2fcb4a90133e8fab577bae Mon Sep 17 00:00:00 2001 From: Oleg Date: Wed, 17 May 2017 16:33:29 +0300 Subject: [PATCH] Support an purchase price Use Cost attribute in Magento. Don't forget to select this attribute for exchange with RetailCRM for purchase price feature. --- app/code/community/Retailcrm/Retailcrm/Model/Icml.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/code/community/Retailcrm/Retailcrm/Model/Icml.php b/app/code/community/Retailcrm/Retailcrm/Model/Icml.php index 8b79b47..c2f1e3a 100644 --- a/app/code/community/Retailcrm/Retailcrm/Model/Icml.php +++ b/app/code/community/Retailcrm/Retailcrm/Model/Icml.php @@ -114,6 +114,9 @@ class Retailcrm_Retailcrm_Model_Icml $offer['name'] = $product->getName(); $offer['productName'] = $product->getName(); $offer['initialPrice'] = (float) $product->getPrice(); + if($product->hasCost()) + $offer['purchasePrice'] = (float) $product->getCost(); + $offer['url'] = $product->getProductUrl(); $offer['picture'] = $picUrl.'catalog/product'.$product->getImage(); $offer['quantity'] = Mage::getModel('cataloginventory/stock_item') @@ -199,6 +202,8 @@ class Retailcrm_Retailcrm_Model_Icml $offer['name'] = $associatedProduct->getName().$attributesString; $offer['productName'] = $product->getName(); $offer['initialPrice'] = (float) $associatedProduct->getFinalPrice(); + if($associatedProduct->hasCost()) + $offer['purchasePrice'] = (float) $associatedProduct->getCost(); $offer['url'] = $associatedProduct->getProductUrl(); $offer['picture'] = $picUrl.'catalog/product'.$associatedProduct->getImage(); $offer['quantity'] = Mage::getModel('cataloginventory/stock_item')