开发者

Magento: How to get the creditmemo by order item quote id

开发者 https://www.devze.com 2023-03-01 18:57 出处:网络
i have a increment id of a magento order and a quote id of a order item (i do not mean the order it开发者_JAVA百科em id) and i want to the all creditmemos that contains a corresponding creditmemo item

i have a increment id of a magento order and a quote id of a order item (i do not mean the order it开发者_JAVA百科em id) and i want to the all creditmemos that contains a corresponding creditmemo item for that order item.

If i use the creditmemo model in magento i can use getOrderItem() to get the order item and on that i can use getOrder() to get the order. But the order model in magento do not have a getCreditmemoItems().

Is there a better way instead of iterating over getCreditmemosCollection() of the order and over each creditmemo item?


Use this:

$collection = Mage::getResourceModel('sales/order_creditmemo_collection')
        ->addAttributeToFilter('order_id', array('eq' => $order->getEntityId()))
        ->addAttributeToSelect('*');
0

精彩评论

暂无评论...
验证码 换一张
取 消