首页 文章

根据属性选项加载Magento可配置产品

提问于
浏览
1

是否存在magento函数,它允许我根据使用的属性选项加载可配置产品子产品 .

例如,我有T恤颜色和尺码的选项值,比如10,45(选项ID),我想快速获得儿童简单产品的ID

1 回答

  • 7

    对于可配置产品 $product ,请使用此功能:

    $product->getTypeInstance(true)->getProductByAttributes($attributesInfo, $product);
    

    其中 $attributeInfo$attributeId => $attributeValue 定义的数组 .

相关问题