0

I searched for a similar question, but didn't find any suitable answer.

I have a multi-store Magento and I simply want to load my catalog seeing some attributes values of the admin/global store view scope + store 1 view at the same time, just like Magento grid does when you change the scope, you see the name of the product in the global scope and beside the name in the choosen store view, side by side.

At this moment, this is what I do:

$store_id = 1;

$_p = Mage::getModel('catalog/product');

$_product = $_p
                    ->getCollection()
                    ->addAttributeToSelect('sku')
                    ->addAttributeToSelect('ean')
                    ->addAttributeToSelect('name')
                    ;

foreach ($_product as $product) {
    $prod_admin  = $product->getData();
    $prod_store1 = $_p->setStoreId($store_id)->load($product['entity_id']);

    $prod_admin['sku']; // SKU in the global scope
    $prod_store1['sku']; // SKU in the store 1

    (...)
}

I get the product collection from the global scope, than inside the loop, I reload the product's attributes of the specific store. But that requires quite some resources to load the full catalog. Is there a way to do this loading a single collection?

0

Try this

$websiteIds = 0;
$storeId = 0;

$collection = Mage::getModel('catalog/product')->getCollection()
            ->addAttributeToSelect('*');
$collection->addStoreFilter($storeId);
$collection->addWebsiteFilter($websiteIds);
3
  • but that way I am getting the collection for the global scope only (ID 0 for website and store)
    – feub
    Jul 16 '18 at 7:45
  • I edit answer please check Jul 16 '18 at 7:53
  • Your edited reply keeps on filtering the global scope only by specifying 0. The problem is that addStoreFilter() does not support an array of stores, it can load only 1 store and I need to load store 0 and store 1 at the same time. But thank you for your time Jugal
    – feub
    Jul 16 '18 at 8:13

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.