im试图使用magento 1.x REST API并检索产品。每个产品都有一个价格(称为“金额”的属性),并且可以为每个网站进行配置 不同的网站显示每种产品的价格不同。
我尝试使用
$collection = Mage::getResourceModel('catalog/product_collection')
->addStoreFilter($store->getId())
->addFinalPrice()
->addMinimalPrice()
->addAttributeToSelect('*');
// we iterate through the list of products to get attribute values
foreach ($collection as $product) {
array_push($products , $this->formatProductListing($product,$store));
}
private function formatProductListing($product,$currentStore){
$responseProduct = array();
$responseProduct['entity_id'] = $product->_data["entity_id"];
$responseProduct['category_ids'] = $product->_data["category_ids"];
$responseProduct['name'] = $product->getName();
$responseProduct['sku'] = $product->getSku();
$responseProduct['description'] = $product->getDescription();
$responseProduct['image_url'] = $product->getImageUrl();
$responseProduct['price'] = $product->getFinalPrice();
$responseProduct['minimum_price'] = $product->getMinimalPrice();
$responseProduct['currency_code'] = Mage::app()->getStore($currentStore)->getCurrentCurrencyCode();
$currency = Mage::app()->getLocale()->currency($responseProduct['currency_code']);
$responseProduct['currency_symbol'] = $currency->getSymbol();
$responseProduct['currency_name'] = $currency->getName();
$responseProduct['store_code'] = $currentStore->getCode();
$responseProduct['status'] = $product->_data["status"];
return $responseProduct;
}
,但无论是集合还是产品都没有金额。 我需要将所有金额添加为像一个数组 “价格:[100,2500,5000 ...]到德国商店”