Created
February 12, 2015 02:58
-
-
Save deivisonarthur/bf06e224e0fd355ca1ae to your computer and use it in GitHub Desktop.
Para erros de import dos produtos configuraveis do magento (Quando se faz necessário entrar no produto pelo admin e salvar para que ele aprareça)
This file contains hidden or 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 | |
require_once('app/Mage.php'); | |
umask(0); | |
#Mage::app('default'); | |
Mage::app(); | |
#Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID); | |
$collection = Mage::getResourceModel('catalog/product_collection') | |
->addAttributeToSelect('entity_id') | |
->addAttributeToFilter('type_id', 'simple'); | |
#->addAttributeToFilter('type_id', 'configurable'); | |
foreach ($collection as $product) { | |
$product = Mage::getModel('catalog/product')->load($product->getId()); | |
#$product->setWebsiteIds(array(Mage::app()->getStore(true)->getWebsite()->getId())); | |
#$product->save(); | |
//This section is what was required. | |
#$stockStatus = Mage::getModel('cataloginventory/stock_status'); | |
#$stockStatus->assignProduct($product); | |
#$stockStatus->saveProductStatus($product->getId(), 1); | |
$product->setOptionsContainer('container1'); | |
$product->save(); | |
echo $product->getId()." \n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment