I'm creating a custom Grid in Adminhtml which is to list all of the items sold in the past 30 days.

I have the Grid setup, with basic product data being filled. However, I need data such as current stock level and custom attributes etc.

I'm a little new to Magento collections and not sure how to use joins etc to build up my desired collection.

Can anyone assist?

protected function _prepareCollection() {

    $collection = Mage::getResourceModel('sales/order_item_collection')
    ->join('order', 'order_id=entity_id');

    return parent::_prepareCollection();

Magento use Zend_Db_Select select as base. To get just do


after work with it like with usual Zend_Db_Select

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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