如何在Magento中使用Super属性获取商品ID? [英] How to get Product id using Super attribute in Magento?

查看:73
本文介绍了如何在Magento中使用Super属性获取商品ID?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am working on ajax module for Shopping cart in Magento. Consider i have a configurable product with 2 simple products configured as its two sizes (Small an Medium). When user selects and adds the item to cart, i cannot see the specific product id (small) in the url. But instead supper_attribute is posted to my controller.

是否可以通过super属性获取尺寸为小"的实际产品ID.

Is it possible for me to get the actual product id of size "Small" with the super attribute.

下面是我的晚饭属性数组

Below is my supper attribute array

[super_attribute] => Array
        (
            [129] => 128
        )
129 = attribute_id (Size)
128 = attribute value (Small)

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

Please suggest me in this scenario. Please let me know if my question is not clear.

谢谢

推荐答案

尝试一下:

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

$product是可配置的产品对象.

Where $product is the configurable product object.

对于类参考

这篇关于如何在Magento中使用Super属性获取商品ID?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆