Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Vernonmac/c2b1bf1b35ee4d687df2 to your computer and use it in GitHub Desktop.
Save Vernonmac/c2b1bf1b35ee4d687df2 to your computer and use it in GitHub Desktop.
<? $sizetext = 'available sizes:'; ?>
<?php if (36 == $_product->getAttributeSetId()) { //if has attribute set id?>
<?php
$sizes = array(); if($_product->isConfigurable()){ $allProducts = $_product->getTypeInstance(true)->getUsedProducts(null, $_product); foreach ($allProducts as $subproduct) { if ($subproduct->isSaleable() && floor($subproduct->getStockItem()->getQty()) > 0 ) { $sizes[] = $subproduct->getAttributeText('SMLXL');
}
}
if($sizes) { ?>
<div class="sizes">
<p><?echo $sizetext?> <? echo implode(", ", $sizes); ?></p>
</div>
<?}?>
<?}?>
<? } ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment