开发者

After rewrite Model sales/order_collection it works except in Admin section, why?

开发者 https://www.devze.com 2022-12-23 06:57 出处:网络
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 How to rewrite Co

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 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 a开发者_如何转开发s 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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号