Magento - Query for Product Options

后端 未结 2 1426
无人共我
无人共我 2021-01-15 05:53

I want to write a controller that finds the different options for a given product (eg. Large, Medium, Small, Red, Blue etc...).

Can anyone show me the code I would w

2条回答
  •  灰色年华
    2021-01-15 06:49

    The above solution is perfect and I solved my problem using it. I was trying to display the colors on the list. Here is my solution

    if ($_product->isConfigurable()) {
    $configurable = $_product->getTypeInstance();
    $childProducts = $configurable->getUsedProducts($_product);
    
    foreach ($childProducts as $child) {
        $sku = $child->getSku();
        $skuarr = explode('-',$sku);
        $col = trim($skuarr[1]);
    ?>
            
    
        }
    }
    

提交回复
热议问题