0

I have a php script I use to update an attribute. I have it set on ADMIN store at the moment, however I need it to update for each store that does not have default values set.

require_once('app/Mage.php');
umask(0);
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);

How do I change this to either run for all stores, or get it to cycle through each store?

1 Answer 1

0

For anyone finding this and wondering how I resolved code is below

<?php

require_once 'app/Mage.php';
Mage::app();

$storeCollection = Mage::getModel('core/store')->getCollection();
foreach($storeCollection as $store)
{

Mage::app()->setCurrentStore($storeid);


$products_collection = Mage::getModel('catalog/product')->getCollection()
                                                         ->addAttributeToSelect('*')
                                                        ->addStoreFilter($storeid);

foreach($products_collection as $product)
{

As much as it this may not be the most efficient way it did resolve my issue

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.