我已经在php中创建Magento产品。现在我想添加产品的重量和尺寸(长度,宽度,高度),以便运输插件可以使用它。对于设置权重,我发现这种方法:$ product-> setWeight(1.0); 但我找不到任何类似的尺寸方法。Magento - 在php中创建产品和设置尺寸
现在我的问题是:如何设置产品尺寸?
这是我使用的是用于添加产品代码:
umask(0);
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
Mage::getSingleton('core/session', array('name'=>'adminhtml'));
$product = Mage::getModel('catalog/product');
$product->setSku("SKU");
$product->setName("name");
$product->setDescription("description");
$product->setShortDescription("short description");
$product->setPrice(9.99);
$product->setTypeId('simple');
$product->setAttributeSetId(9);
$product->setCategoryIds("0");
$product->setWeight(1.0);
[...] // setting stock and tax information
$product->save();
在此先感谢
非常感谢你,这正是我所期待的。 – user2878068
@ user2878068。别客气。如果这有助于接受答案。不要留下松散的结尾。 – Marius