I have created a custom module to show the data in admin grid
protected function _prepareCollection()
{
$collection = Mage::getResourceModel('test_testing/order_collection');
$collection->setProductFilter($this->_product->getId())->setParentItemIdFilter();
$coreResource = Mage::getSingleton('core/resource');
$collection->getSelect()
->joinLeft(array('billing_address' => $coreResource->getTableName('sales_flat_order_address')),
'`sales_order`.`billing_address_id` = `billing_address`.`entity_id`',
array('customer_firstname' => 'billing_address.firstname',
'customer_lastname' => 'billing_address.lastname',
'customer_email' => 'billing_address.email',
));
$collection->getSelect()->limit(2);
$this->setCollection($collection);
return parent::_prepareCollection();
}
Instead of 2 produts, It return's 4 products in admin grid.
I tried to print the query echo $collection->getSelect()->__toString();
and if i run the sql query it returns the correct record (i.e. 2)
I tried with ->setPage(1, 1);
but still unable to resolve this issue.
It's Simple thing but still don't know what is missing. Please help.