如何列出产品的网站金额| Magento 1.x

时间:2018-07-18 09:28:15

标签: php magento magento-1.7 magento-1.9 magento-1.8

im试图使用magento 1.x REST API并检索产品。每个产品都有一个价格(称为“金额”的属性),并且可以为每个网站进行配置 不同的网站显示每种产品的价格不同。 enter image description here

我尝试使用

 $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 ...]到德国商店”

0 个答案:

没有答案