3

I want to create a admin Grid that displays all products that are using the default ( admin 0 ) scope values when i am in a store scope.

How can I filter a collection to get this desire result.

Any help would be appreciated.

Thanks.

Ryan

1 Answer 1

2

You can get the default store id with

$defaultStoreId = Mage::app()->getWebsite()->getDefaultGroup()->getDefaultStoreId();

then you can use that ID to filter the product collection.

$productCollection = Mage::getResourceModel('catalog/product_collection')
    ->setStoreFilter($defaultStoreId)
    ->addAttributeToSelect('*');

That should give you what you are looking for.

I have not tested it so please let me know if it does not work so I can make adjustments.

1
  • Hi Phil, Thanks for your reply. What I am looking to achieve is getting all products that are using admin scope values (0) when I am in a store scope. Say suppose I have a website test.com with store A, and have 10 products under this. I set the price for all 10 products under Admin scope (0). Then I switch to Store A scope and change the price of 5 products. Now I want to list only those 5 products which are using the admin scope value (0). Hope this makes sense and look forward to your reply. Dec 2, 2014 at 8:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.