After rewrite Model sales/order_collection it works except in Admin section, why?
Posted
by latvian
on Stack Overflow
See other posts from Stack Overflow
or by latvian
Published on 2010-03-20T01:11:00Z
Indexed on
2010/04/02
19:23 UTC
Read the original article
Hit count: 372
magento
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
© Stack Overflow or respective owner