如何在Magento中使用Super属性获取产品ID?

bal*_*anv 3 magento

我正在为Magento的购物车制作ajax模块.考虑我有一个可配置产品,其中2个简单产品配置为两种尺寸(小型和中型).当用户选择并将项目添加到购物车时,我无法在网址中看到特定的产品ID(小).但是supper_attribute会发布到我的控制器上.

是否有可能使用super属性获得大小为"Small"的实际产品ID.

下面是我的晚餐属性数组

[super_attribute] => Array
        (
            [129] => 128
        )
129 = attribute_id (Size)
128 = attribute value (Small)
Run Code Online (Sandbox Code Playgroud)

请在这种情况下建议我.如果我的问题不明确,请告诉我.

谢谢

vic*_*cch 23

试试这个:

$childProduct = Mage::getModel('catalog/product_type_configurable')->getProductByAttributes($request->getData('super_attribute'), $product);
Run Code Online (Sandbox Code Playgroud)

$product可配置产品对象在哪里.

对于类参考