1

I'm trying to join the collection of refunds and refunds items in this way:

$collection = Mage::getModel('sales/order_creditmemo')->getCollection()
        ->join(array('item'=> 'sales/order_creditmemo_item'),
            'item.parent_id = main_table.entity_id',
            array('sku'=>'item.sku')
        );

But I don't understand why is returning this error:

Fatal error: Uncaught exception 'Mage_Core_Exception' with message 'Can't retrieve entity config: sales/order_creditmemo_item' in /var/www/html/app/Mage.php:603 Stack trace: #0 /var/www/html/app/code/core/Mage/Core/Model/Resource.php(282): Mage::throwException('Can't retrieve ...') #1 /var/www/html/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(276): Mage_Core_Model_Resource->getTableName('sales/order_cre...') #2 /var/www/html/app/code/core/Mage/Core/Model/Resource/Db/Collection/Abstract.php(488): Mage_Core_Model_Resource_Db_Abstract->getTable('sales/order_cre...') #3 /var/www/html/app/code/core/Mage/Core/Model/Resource/Db/Collection/Abstract.php(569): Mage_Core_Model_Resource_Db_Collection_Abstract->getTable('sales/order_cre...')

After searching for a solution all day long still stuck at this point. Any idea why this behaviour?

1 Answer 1

1

I've found the solution about this issue:

$collection = Mage::getModel('sales/order_creditmemo')->getCollection()
        ->join(array('item'=> 'creditmemo_item'),
            'item.parent_id = main_table.entity_id',
            array('sku'=>'item.sku')
        );

I hope will help someone.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.