0
我正在嘗試在list.phtml網格中獲取我的可配置產品的所有可用尺寸。Magento - 獲取可配置產品的可用尺寸
使用下面的代碼,我可以成功獲取所有尺寸,但它甚至顯示不可用的尺寸。
<?php if($_product->isSaleable()): ?>
<div class="taglie">
<?php $cProduct = Mage::getModel('catalog/product')->load($_product->getId());
//check if product is a configurable type or not
if ($cProduct->getData('type_id') == "configurable") {
//get the configurable data from the product
$config = $cProduct->getTypeInstance(true);
//loop through the attributes
foreach($config->getConfigurableAttributesAsArray($cProduct) as $attributes) { ?>
<?php foreach($attributes["values"] as $values) {
echo "<span>".$values["label"]."</span>";
} ?>
<?php
}
} ?>
</div>
<?php else: ?>
<?php echo $this->__('Out of Stock') ?>
<?php endif; ?>
我想要做的是隱藏不可用的大小選項。