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('*');
精彩评论