tags:

views:

184

answers:

1

Hi,

I rewrite the sales/order_collection Model or, perhaps, correctly said the Resource. I did that to add filter that filters orders by store_ids. Please see my post to see how i did it http://stackoverflow.com/questions/2426986/how-to-rewrite-collection

My new model works and here is how i tested

$path = '../magento';

require_once('app/Mage.php');
umask(0);

$app = Mage::app('base','website');


$col = Mage::getResourceModel('sales/order_collection')->addAttributeToSelect('*');

echo "<br>Size of the colletion: ".$col->getSize();

This new Model filters and returns # of orders just like i want. It returns # of orders also when i run it inside any of my created modules, but not in Admin section then it returns 0 orders

In Admin section the same line is called as above ( Mage::getResourceModel('sales/order_collection')->addA....) from Mage_Adminhtml_Block_Sales_Order_Grid class (line 50) . It can be initiated when going Admin->Sales->Orders. However, it is returning 0 orders instead of # of orders

How is it that the new Model returns orders anywhere else but from Admin section? What is done differently in Admin section?..please help. I have spent hours and hours and any pointers will help

Thank you, Margots

+1  A: 

Admin runs store 0 by default, since you created a filter in your own class, it could be the problem

Ryan Sun