Question

Is there any point of applying website filter after applied store filter already:

$collection->addStoreFilter()->addWebsiteFilter();

will have same effect as:

$collection->addStoreFilter();

and this should:

$collection->addWebsiteFilter();

filter products only from website and with no matter from which store from filtered website?

Was it helpful?

Solution

Short Answer:

No, there is no need to.

Longer Answer

No there is no need, while Stores are unik for the whole system. So a collection filtered by store is only a subset of a collection filtered by website.

I actually never used the website filter, because there wasn'T any need to do so.

But lets see a short sceanrio:

Website A
  StoreGroup A
     StoreView A
          Product 1
          Product 2
     StoreView B
          Product 1
          Product 2
   StoreGroup B
     StoreView C
          Product 3
          Product 4
     StoreView D
          Product 3
          Product 4

Applying the method addStoreFilter(StoreView A) will result in a collection with 2 items while the same collection with addWebsiteFilter(Website A) will get a collection of 4 items.

hope that helps.

cheers

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top