在购物车中显示可配置产品的所选SKU

时间:2011-11-07 11:03:45

标签: php magento

以下问题:您有一个具有一个随机属性的可配置产品。例如,客户选择尺寸“XXL”,并将其放入购物车。在购物车中,我正在显示SKU:

$_item = $this->getItem();
$item_ID = $_item->getProduct()->getId();
$_product = Mage::getModel('catalog/product')->load($item_ID);

echo $_product->getSku();

现在显示可配置产品的SKU。但我想展示所选产品的SKU(Simple Prodcut,尺寸为XXL e.x.)。怎么可能?我print_r'编辑了所有项目数据,产品数据等,但唯一的,getable是关联产品的集合。

1 个答案:

答案 0 :(得分:1)

你可以这样做:

    // check whether there are childrens for this product
    $_product->getHasChildren(); 
    // get the simple products behind the configurable product
    $_product->getChildren(); 

祝你好运!

相关问题