[英]Magento Associated Product Options
我已将所有产品导入为可configurable
且其选项为simple
产品类型,所有简单产品都具有正确的尺寸属性,可配置产品具有正确的attribute_set
。
将产品选项与其产品相关联的最佳方式是什么?
我宁愿不用SQL做这个,或者如果我能帮忙的话也不要手动做!
提前致谢
据我了解你的问题,你想将简单的产品分配给它的'可配置父级? 如果是这样,请查看Mage_Catalog_Model_Product_Type_Configurable模型。 方法save()调用资源模型的方法saveProducts($ mainProduct,$ productIds):
Mage::getResourceModel('catalog/product_type_configurable')
->saveProducts($this->getProduct($product), $productIds);
我一直以为这是不可能的使用SOAP-API (如解释如这里 )。
但很快谷歌搜索显示有人显然设法使用SOAP-API做到这一点 。 以下是论坛帖子中的相关代码:
$this->proxy->call($this->session,
'catalog_product_link.assign',
array('configurable',
$newConfigProdId, //This is the product ID of the configurable product
$createdVariants, //This is an array of product IDs of simple products to associate to the configurable product
array(ATTR_ID_COLOR, //This is an array of attribute IDs to create as superAttributes for the configurable product.
ATTR_ID_SIZE //I've defined them as constants...
)
)
);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.