added conditional for cookies to show sub cats
authorAnthony Talarico <talarico@gaslightmedia.com>
Wed, 13 Jan 2016 13:47:06 +0000 (08:47 -0500)
committerAnthony Talarico <talarico@gaslightmedia.com>
Wed, 13 Jan 2016 13:47:06 +0000 (08:47 -0500)
views/list_categories.php
views/list_products.php

index 023b4c5..ca5bd8e 100644 (file)
@@ -8,7 +8,7 @@
     <?php if (function_exists('z_taxonomy_image')) z_taxonomy_image(); ?>
         <div class="small-12 medium-4 columns<?php if ($term->end){ echo ' end';}?>">
           <div class="row">
-         <div id="catContainer" class= "small-12 columns"><a href="<?php echo $term->href; ?>">
+         <div class="catContainer" class= "small-12 columns"><a href="<?php echo $term->href; ?>">
                           <img id="catImg" src="<?php echo z_taxonomy_image_url($term->term_id, array(320, 285)); ?>" class="image wp-post-image no-display" alt="<?php echo $term->name; ?>" title="<?php echo $term->name; ?>" itemprop="image">
         
              <div id="catTitleGrid" class="small-12 columns">
index 7d22e0a..6e690ba 100644 (file)
@@ -1,16 +1,17 @@
 <?php if(!isset($_COOKIE['view']) || $_COOKIE['view'] == "grid"){ ?>
     <div id="gridView" class="row">
     <?php 
-    // sub cats
-      $catNum = $_REQUEST[MICHSCI_CATEGORY_NAME];
-      echo category_description($catNum);
-      $cat_id = $_REQUEST[MICHSCI_CATEGORY_NAME];
-      $cat_children = get_term_children($cat_id, MICHSCI_CATEGORY_NAME);
-    foreach($cat_children as $cats){
-        $term = get_term($cats, MICHSCI_CATEGORY_NAME); ?>
-        <?php $tags = wp_get_post_terms($product->ID,'michsci_tag'); ?>
-        <div class="<?php echo $term->slug;?> product grid small-12 medium-4 columns<?php if ($product->end){ echo ' end';}?>">
+       $cat_id = $_REQUEST[MICHSCI_CATEGORY_NAME];
+       echo category_description($cat_id);
+       $cat_children = get_term_children($cat_id, MICHSCI_CATEGORY_NAME);
+?>
+        
+      <?php  if(isset($_COOKIE['subcat'])){ ?>
+       
+       <?php foreach($cat_children as $cats){
+            $term = get_term($cats, MICHSCI_CATEGORY_NAME); ?>
+            <?php $tags = wp_get_post_terms($product->ID,'michsci_tag'); ?>
+            <div class="<?php echo $term->slug;?> grid small-12 medium-4 columns<?php if ($product->end){ echo ' end';}?>">
                 <div class="prodImgGrid small-12 columns"><a href="<?php echo $product->href; ?>">
                      <img id="catImg" src="<?php echo z_taxonomy_image_url($cats, array(320, 285)); ?>" class="image wp-post-image no-display" alt=" "  title="<?php echo $term->name; ?>" itemprop="image">
                 </div>
@@ -21,9 +22,9 @@
                     <a href="<?php echo $cat->href . $term->term_id; ?>"><strong><?php echo $term->name; ?></strong></a>
                 </div>
         </div>
-         
-   <?php // end sub cats 
-   }
+        <?php  } ?>
+   <?php 
+   } else {
     ?>
    <?php if ( isset( $products ) && is_array( $products ) ) : foreach ( $products as $product ) : ?>
    <?php $tags = wp_get_post_terms($product->ID,'michsci_tag'); ?>
@@ -43,6 +44,7 @@
     </div>
 <?php } ?>
 
+
 <?php if($_COOKIE['view'] == "list"){ ?>
    <div id="listView" class="row">
    <?php 
@@ -68,6 +70,7 @@
     <?php endforeach; endif; ?>
    </div>
 <?php } ?>
+<?php } ?>