1

I know about method

public function addStoreFilter($store = null)
{
        if ($store === null) {
            $store = $this->getStoreId();
        }
        $store = Mage::app()->getStore($store);

        if (!$store->isAdmin()) {
            $this->setStoreId($store);
            $this->_productLimitationFilters['store_id'] = $store->getId();
            $this->_applyProductLimitations();
        }

        return $this;
}

But as you can see it doesn't work for $store->isAdmin(). I'm always getting "admin store" data.

So my question is: how to get product collection for specific store by SKU list under "admin" store?

0

You can use the addStoreFilter method in your admin code as long as you pass the id of your frontend store as a parameter.

As you can see from the method if the $store variable is set based on the parameter using Mage::app()->getStore() method so that code will retrieve the frontend store based on the id you've passed.

Then it checks if that store is an admin store, as you've passed a frontend store id that !$store->isAdmin() condition will be true so it will properly apply the products limitations to the store you've passed.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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