dongze5043 2014-10-08 14:19
浏览 130
已采纳

如何在Magento API之外获取Quote数据?

I am trying to write a script to process all the orders from my magento store. I am able to get Shipping,Billing address and customer's name but now I want the list of items they have bought which i think will be in "quote" object.

I am trying this 2 lines to get quote object but I am getting an empty array. Please tell me what's wrong with this code.

$salesCollection = Mage::getModel("sales/order")->getCollection()->addAttributeToFilter('state', array('eq' => Mage_Sales_Model_Order::STATE_PROCESSING));
foreach($salesCollection as $order)
{
   $quote_id = $order->getQuoteId();
   $quote = Mage::getModel('sales/quote')->load($quote_id);
   print_r($quote->getData());
}
  • 写回答

2条回答 默认 最新

  • dongzhuoxie1244 2014-10-08 14:26
    关注

    No, they are not in "quote" object. You can get using this sample code -

    $order_id = 1234; //use your own order id 
    $order = Mage::getModel("sales/order")->load($order_id); 
    $ordered_items = $order->getAllItems();
    
    foreach($ordered_items as $item){     
        echo $item->getName();
    }
    

    Now using foreach loop on $ordered_items, you can get item data.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 c程序不知道为什么得不到结果
  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置