Day: June 29, 2015

magento

Programmatically assign products to configurable

Programmatically assign products to configurable Version 1, last updated by lbernard at 2010-12-29 <?php define('MAGENTO', realpath('/var/www/magento')); ini_set('memory_limit', '128M'); require_once MAGENTO . '/app/Mage.php'; Mage::app(); $title = 'Test Video'; $description = 'Test Video'; $bodyContent='This is a test video'; $itemNum='testVideo2.1'; $price='129.95'; $product = Mage::getModel('catalog/product'); $product->setTypeId('configurable');  // $product->setTaxClassId(0); //none $product->setWebsiteIds(array(1));  // store id $product->setAttributeSetId(26); //Videos Attribute Set Id /*    Media Format Values <option value="6">dvd</option>7 <option value="5">vhs</option> */ $product->setSku($itemNum); $product->setName($title); $product->setDescription($description); $product->setInDepth($bodyContent); $product->setPrice($price); $product->setShortDescription(ereg_replace("n","",$description)); $product->setWeight(0); $product->setStatus(1); //enabled $product->setVisibilty(4); //catalog and search...