Advertisement
Guest User

Untitled

a guest
Aug 4th, 2014
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. $bikini_size        = array();
  3. $m_flip_flops_size  = array();
  4. $m_shorts_size      = array();
  5. $m_tshirt_size      = array();
  6. $w_flip_flops_size  = array();
  7. $w_shorts_size      = array();
  8.  
  9. if($_product->isConfigurable()){
  10.     $allProducts = $_product->getTypeInstance(true)->getUsedProducts(null, $_product);
  11.     foreach ($allProducts as $subproduct) {
  12.         if ($subproduct->isSaleable() && floor($subproduct->getStockItem()->getQty()) > 0 ) {
  13.             $bikini_size[]          = trim( $subproduct->getAttributeText('bikini_size') );
  14.             $m_flip_flops_size[]    = trim( $subproduct->getAttributeText('m_flip_flops_size') );
  15.             $m_shorts_size[]        = trim( $subproduct->getAttributeText('m_shorts_size') );
  16.             $m_tshirt_size[]        = trim( $subproduct->getAttributeText('m_tshirt_size') );
  17.             $w_flip_flops_size[]    = trim( $subproduct->getAttributeText('w_flip_flops_size') );
  18.             $w_shorts_size[]        = trim( $subproduct->getAttributeText('w_shorts_size') );
  19.         }
  20.     }
  21.    
  22.     $bikini_size        = array_filter( $bikini_size );
  23.     $m_flip_flops_size  = array_filter( $m_flip_flops_size );
  24.     $m_shorts_size      = array_filter( $m_shorts_size );
  25.     $m_tshirt_size      = array_filter( $m_tshirt_size );
  26.     $w_flip_flops_size  = array_filter( $w_flip_flops_size );
  27.     $w_shorts_size      = array_filter( $w_shorts_size );
  28.    
  29.     if(count($bikini_size)>0) {
  30.         sort($bikini_size);
  31.         ?>
  32.         <div class="desc std bikini_size">
  33.         Sizes: <? echo implode(", ", $bikini_size); ?>
  34.         </div>
  35.         <?
  36.     }
  37.     if(count($m_flip_flops_size)>0) {
  38.         sort($m_flip_flops_size);
  39.         ?>
  40.         <div class="desc std m_flip_flops_size">
  41.         Sizes: <? echo implode(", ", $m_flip_flops_size); ?>
  42.         </div>
  43.         <?
  44.     }
  45.     if(count($m_shorts_size)>0) {
  46.         sort($m_shorts_size);
  47.         ?>
  48.         <div class="desc std m_shorts_size">
  49.         Sizes: <? echo implode(", ", $m_shorts_size); ?>
  50.         </div>
  51.         <?
  52.     }
  53.     if(count($m_tshirt_size)>0) {
  54.         sort($m_tshirt_size);
  55.         ?>
  56.         <div class="desc std m_tshirt_size">
  57.         Sizes: <? echo implode(", ", $m_tshirt_size); ?>
  58.         </div>
  59.         <?
  60.     }
  61.     if(count($w_flip_flops_size)>0) {
  62.         sort($w_flip_flops_size);
  63.         ?>
  64.         <div class="desc std w_flip_flops_size">
  65.         Sizes: <? echo implode(", ", $w_flip_flops_size); ?>
  66.         </div>
  67.         <?
  68.     }
  69.     if(count($w_shorts_size)>0) {
  70.         sort($w_shorts_size);
  71.         ?>
  72.         <div class="desc std w_shorts_size">
  73.         Sizes: <? echo implode(", ", $w_shorts_size); ?>
  74.         </div>
  75.         <?
  76.     }
  77. }
  78. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement