Created
November 9, 2012 13:28
-
-
Save vdubyna/4045662 to your computer and use it in GitHub Desktop.
Generate magento products
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 | |
// file location dev/bootstrap.php | |
require_once dirname(__FILE__) . '/../app/Mage.php'; | |
error_reporting(E_ALL); | |
ini_set('display_errors', '1'); | |
umask(0); | |
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID); |
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 | |
// file location dev/generate-products.php | |
require_once 'bootstrap.php'; | |
$installer = new Mage_Catalog_Model_Resource_Setup('catalog_setup'); | |
$newProductData = array( | |
'name' => 'name of product', | |
'short_description' => 'short description', | |
'description' => 'description', | |
'status' => Mage_Catalog_Model_Product_Status::STATUS_ENABLED, | |
'weight' => 0, | |
'tax_class_id' => 0, | |
'price' => 12.05, | |
'visibility' => Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH, | |
); | |
for ($i = 0; $i < 9999; $i++) { | |
$api = new Mage_Catalog_Model_Product_Api(); | |
$api->create( | |
Mage_Catalog_Model_Product_Type::DEFAULT_TYPE, | |
$installer->getDefaultAttributeSetId('catalog_product'), | |
uniqid(), $newProductData); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment