gpt4 book ai didi

java - 如何使用 Magento SOAP API2 检索可配置产品的关联产品?

转载 作者:塔克拉玛干 更新时间:2023-11-03 04:34:47 25 4
gpt4 key购买 nike

我正在尝试使用 Magento SOAP API v2 获取可配置产品的所有关联产品。 catalogProductLink 调用看起来很接近,但不处理可配置类型。我没有看到包含关联产品和产品的可配置类型信息的任何其他调用。其他人是如何解决这个问题的?

我使用的是 Magento 1.6 版和带有 Java 的 SOAP API V2。

最佳答案

我深入研究了这个解决方案,意识到您可能需要覆盖 API 模型 (Mage_Catalog_Model_Product_Api) 才能获得您正在寻找的结果。

在 items 函数中(大约第 90 行),您可以执行如下操作:

foreach ($collection as $product) {
$childProductIds = Mage::getModel('catalog/product_type_configurable')->getChildrenIds($product->getId());
$result[] = array(
'product_id' => $product->getId(),
'sku' => $product->getSku(),
'name' => $product->getName(),
'set' => $product->getAttributeSetId(),
'type' => $product->getTypeId(),
'category_ids' => $product->getCategoryIds(),
'website_ids' => $product->getWebsiteIds(),
'children' => $childProductIds[0],
);
}

关于java - 如何使用 Magento SOAP API2 检索可配置产品的关联产品?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12147243/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com