join query with lowstock products with another table in magento

Posted by muralikalpana on Stack Overflow See other posts from Stack Overflow or by muralikalpana
Published on 2012-12-04T05:02:06Z Indexed on 2012/12/04 5:03 UTC
Read the original article Hit count: 134

Filed under:
|
|

I want to display some attributes in reports/products/lowstock grid. here how can i join another table with lowstock product id?

here is the query

/** @var $collection Mage_Reports_Model_Resource_Product_Lowstock_Collection */

$collection = Mage::getResourceModel('reports/product_lowstock_collection')
            ->addAttributeToSelect('*')
            ->setStoreId($storeId)
            ->filterByIsQtyProductTypes()
            ->joinInventoryItem('qty')
            ->joinInventoryItem('low_stock_date') 
            ->useManageStockFilter($storeId)
            ->useNotifyStockQtyFilter($storeId)
            ->setOrder('qty', Varien_Data_Collection::SORT_ORDER_ASC);

here i have to join with this productid with another table. i am not getting results if i use this query.

$collection->getSelect()->join(array('t2' => 'lowstockorders'),'lowstock_inventory_item.product_id = t2.product_id','t2.product_id');

please anybody tell me how to join these tables

thanks, murali

© Stack Overflow or respective owner

Related posts about magento

Related posts about join