如何按订单ID

时间:2017-07-07 06:49:49

标签: php magento magento-1.9

我想在credit memo collection

中的外部order id文件中php magento 1.9.x获取$collection = Mage::getResourceModel('sales/order_creditmemo_collection') ->addFieldToFilter('order_id', $order->getId()); foreach($collection as $item) { echo $item->getId(); }

以下是我按订单ID获取贷项通知单的代码。

NULL

但它显示SO

我尝试了tensorflow.python.framework.errors_impl.FailedPreconditionError: Attempting to use uninitialized value error/logits/BatchNorm/moving_variance [[Node: error/logits/BatchNorm/moving_variance/read = Identity[T=DT_FLOAT, _class=["loc:@error/logits/BatchNorm/moving_variance"], _device="/job:localhost/replica:0/task:0/cpu:0"](error/logits/BatchNorm/moving_variance)]] 上提供的各种示例,但他们没有帮助我。

非常感谢任何帮助。

2 个答案:

答案 0 :(得分:2)

如果您获得Mage_Sales_Model_Order类的对象,则可以使用getCreditmemosCollection()函数获取贷项通知单集合 例如。 $order->getCreditmemosCollection()

它将返回为当前加载的订单创建的所有creditmemo ...

答案 1 :(得分:1)

试试这段代码。

<?php
    $orderid = 6; //you order id
    $creditMemos = Mage::getResourceModel('sales/order_creditmemo_collection');
    $creditMemos->addFieldToFilter('order_id', $orderid);
    $creditMemos->setOrder('created_at','DESC');
    $creditMemos->load();

    foreach ($creditMemos as $creditMemo) {
       var_dump($creditMemo->getData());
    }
?>

你可以删除这一行以获得完整的收藏。

$creditMemos->addFieldToFilter('order_id', $orderid);