【问题标题】:get magento order collection with different field values for the same field使用同一字段的不同字段值获取 magento 订单集合
【发布时间】:2014-01-29 01:10:41
【问题描述】:

您好,我想为同一字段获取具有多个字段值的订单集合。我已经尝试使用 addFieldToFilter 获取单个字段值的集合('status':pening & 'status':processing),并且我合并了两个集合到单个集合。现在我遇到了问题,比如我无法访问结果集合,它的低谷错误,如 getMethod 无法调用非对象。给我任何建议。

这是我的代码:

$shippedCollection = array();
$processingCollection = array();
$orderSCollection = Mage::getModel('sales/order')->getCollection();
$shippedCollection = $orderSCollection->addFieldToFilter('status','delivered_carrier');
$orderPCollection = Mage::getModel('sales/order')->getCollection();
$processingCollection = $orderPCollection->addFieldToFilter('status','processing');
$order = array_merge($shippedCollection->getAllIds(),$processingCollection->getAllIds());

$order->getData('increment_id');

【问题讨论】:

    标签: php magento collections


    【解决方案1】:

    你好,检查下面的代码可能对你有帮助

    $order_collection = Mage::getModel('sales/order')->getCollection()->addFieldToFilter('status', array('in' => array('delivered_carrier','pending')));
    echo count($order_collection->getAllIds());
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-03-26
      • 2014-09-17
      • 2019-02-07
      • 1970-01-01
      • 2017-01-01
      相关资源
      最近更新 更多