Magento: Adding new products programmatically

两盒软妹~` 提交于 2019-11-30 08:59:25
Jürgen Thelen

AMP, the OP, already self-answered the question.

Quote:

Cool, I have found the problem, the line: $newproduct->setWebsiteIDs(array(0)); should be: $newproduct->setWebsiteIDs(array(1)); Amazing how the smallest thing can waste hours!

Note: It's absolutely OK to self-answer your own question. Please just post it as an real answer, but not in a question or comment. Posting as real answer helps to keep the "Unanswered" list more clear (avoids making other people wasting their time).

Both @Jurgen and @Amp answers are perfect.

I think this could be done like this way so it becomes more dynamic

$newproduct->setWebsiteIds(array(Mage::app()->getStore(true)->getWebsite()->getId()));
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!