Magento 相关产品选项

发布于 2024-10-08 15:11:20 字数 192 浏览 2 评论 0原文

我已将所有产品导入为可配置,并将其选项导入为简单产品类型,所有简单产品都具有正确的尺寸属性,可配置产品具有正确的属性集

将产品选项与其产品相关联的最佳方式是什么?

我宁愿不使用 SQL 来执行此操作,或者如果可以的话手动执行此操作!

提前致谢

I have imported all of my products as configurable and their options as simple product types, all the simple products have the correct size attributes and the configurable products have the right attribute_set.

What is the best way of associating the product options with their products?

I would rather not do this with SQL, or manually if I can help it!

Thanks in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

恋你朝朝暮暮 2024-10-15 15:11:21

据我了解您的问题,您想将简单的产品分配给其“可配置父级”吗?
如果是这样,请查看 Mage_Catalog_Model_Product_Type_Configurable 模型。有方法 save() 调用资源模型的方法 saveProducts($mainProduct, $productIds):

Mage::getResourceModel('catalog/product_type_configurable')
            ->saveProducts($this->getProduct($product), $productIds);

As I understand your question, you want to assign simple products to its' configurable parent?
If so, please look at Mage_Catalog_Model_Product_Type_Configurable model. There is method save() which call resource model's method saveProducts($mainProduct, $productIds):

Mage::getResourceModel('catalog/product_type_configurable')
            ->saveProducts($this->getProduct($product), $productIds);
淑女气质 2024-10-15 15:11:21

我一直认为使用 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...
        )
    )
);

I always thought this wasn't possible using the SOAP-API (as explained e.g. here).

But quickly googling has shown that somebody apparently managed to do this using the SOAP-API. Here's the relevant code from the forum post:

$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...
        )
    )
);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文