Php 从报价单id-Magento 1.9获取产品id
Hi需要在报价项目中设置的产品id。我随身携带qoute id,并尝试了以下代码,但产品id似乎没有从报价中显示出来Php 从报价单id-Magento 1.9获取产品id,php,magento,cart,quote,Php,Magento,Cart,Quote,Hi需要在报价项目中设置的产品id。我随身携带qoute id,并尝试了以下代码,但产品id似乎没有从报价中显示出来 $quoteId=784; $quote = Mage::getModel('sales/quote')->getCollection() ->addFieldToFilter('entity_id', $quoteId) ->getFirstItem(); echo $pid = $quote[product_id] ; 请帮助从报价id获取产品id 谢谢。
$quoteId=784;
$quote = Mage::getModel('sales/quote')->getCollection()
->addFieldToFilter('entity_id', $quoteId)
->getFirstItem();
echo $pid = $quote[product_id] ;
请帮助从报价id获取产品id
谢谢。如果您已经知道quote ID,那么最好只加载quote对象 $quote=Mage::getModel'sales/quote'->加载$quoteId 加载quote对象后,需要从quote中获取项目-这些项目单独存储,因为quote可以包含许多项目 $quoteItems=$quote->getAllItems 我不知道您是否只对第一项感兴趣,但您应该能够更改以下内容:
foreach($quoteItems as $quoteItem) {
$product = $quoteItem->getProduct();
// do something with the product, i.e. $product->getId();
}