根据报价ID获取购物车名称

时间:2015-02-27 07:20:08

标签: magento

如果客户订购了多种产品,如何根据[name] => LG LED46 TV中的报价ID获取产品名称(例如:magento)。 我使用了以下内容:

$quotecollection= Mage::getModel('sales/quote')->getCollection()->addFieldToFilter("quote_id", $order->getQuoteId())->getFirstItem();

1 个答案:

答案 0 :(得分:0)

以下是使用登录客户的客户ID提取项目的代码

$customerQuote = Mage::getModel('sales/quote') 
                        ->setStoreId(Mage::app()->getStore()->getId())
                        ->loadByCustomer(Mage::getSingleton('customer/session')->getCustomerId()
                    ); 
    if ($customerQuote->getId()) 
    { 

        foreach ($customerQuote->getAllItems() as $item) 
        { 
        //this is your product name
        $product_name = $item['name'];
        }
    }

转储 $ item 的值,以获取产品的其他属性。

希望这会有所帮助。

相关问题