1
我想在自定義模塊安裝時創建產品,我可以實現這一點嗎? 這是我的自定義模塊的安裝腳本如何使用自定義模塊創建產品?
$this->startSetup();
$product= new Mage_Catalog_Model_Product();
$product->setSku("basic-plan");
$product->setName("Basic Plan");
$product->setDescription("Description for the product");
$product->setShortDescription("Short Description for the product");
$product->setPrice(20);
$product->setTypeId('simple');
$product->setAttributeSetId(4); // enter the catalog attribute set id here
$product->setCategoryIds(array(16)); // id of categories
$product->setWeight(1.0);
$product->setTaxClassId(0); // taxable goods
$product->setVisibility(1); // catalog, search
$product->setStatus(1); // enabled
$product->setStoreIDs(array(1));
$product->setStockData(
array(
'is_in_stock' => 1,
'qty' => 1000,
'manage_stock' => 1
)
);
$product->setIsRecurring('1');
$product->setRecurringProfile(array(
'schedule_description' => 'Basic Plan',
'period_unit' => 'week',
'period_frequency' => 1
));
// assign product to the default website
//$product->setWebsiteIds(array(Mage::app()->getStore(true)->getWebsite()->getId()));
$product->setWebsiteIds(array(1));
$product->save();
/*Subscription Plan Products Ends Here*/
$this->endSetup();
運行安裝程序,但我使用這個腳本
我已經嘗試感到無法創建產品這一點,它的工作,它節省了SKU,產品類型,類別,但它沒有名稱,價格和其他 –