Created
January 14, 2019 15:57
-
-
Save petarBozovic/1a422cdc1e555721224215213e69f0e3 to your computer and use it in GitHub Desktop.
Resave All Products (Magento1.9.x)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
ini_set('memory_limit', '8192M'); | |
require 'app/Mage.php'; | |
Mage::app(); | |
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID); | |
$products = Mage::getResourceModel('catalog/product_collection')->addAttributeToSelect('*'); | |
//->addAttributeToFilter('sku','testskuhere'); | |
foreach ($products as $product) { | |
if ($product->getModshopVisibility() && !$product->isConfigurable()) { | |
echo 'Product: ' . $product->getId() . ' - ' . $product->getName() . "\xA"; | |
if (Mage::app()->isSingleStoreMode()) { | |
$product->setWebsiteIds(array(Mage::app()->getStore(true)->getWebsite()->getId())); | |
} | |
$product->save(); | |
} | |
else echo 'Skip ' . $product->getId() . "\xA"; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment