testing dropdown restriction navigation
authorAnthony Talarico <talarico@gaslightmedia.com>
Tue, 12 Jan 2016 21:06:19 +0000 (16:06 -0500)
committerAnthony Talarico <talarico@gaslightmedia.com>
Tue, 12 Jan 2016 21:06:19 +0000 (16:06 -0500)
index.php
views/list_products.php

index 5e66988..e55a54f 100644 (file)
--- a/index.php
+++ b/index.php
@@ -440,9 +440,10 @@ function michsci_shortcode($atts)
 
     if ( isset($atts['cat']) ) {
         if ($prodCategory = get_term_by( 'slug', $atts['cat'], MICHSCI_CATEGORY_NAME ) ) {
+           if(!isset($_REQUEST[MICHSCI_CATEGORY_NAME])){
             $_REQUEST[MICHSCI_CATEGORY_NAME] = $prodCategory->term_id;
-            $cat_id = $_REQUEST[MICHSCI_CATEGORY_NAME];
-            
+           }
+            $cat_id = $prodCategory->term_id;
         }
     }
     echo '<form id="catSubmit" action=""><div class="row catSearch"><div id="viewBtns" class="12-small medium-3 columns"> <button id="grid" type="button">Grid</button> <button id="list"type="button">list</button>
@@ -533,6 +534,7 @@ function michsci_get_terms_dropdown($cat_id)
 function michsci_list_products()
 {
     global $wpdb, $wp;
+    $cat = get_term($cat_id, MICHSCI_CATEGORY_NAME);
     $args = array(
         'posts_per_page' => -1,
         'post_type'     => 'miproduct'
index 14e7aa5..6e6c069 100644 (file)
@@ -1,25 +1,33 @@
-
-
 <?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);
-  
-   ?>
-    <?php $cat_id = $_REQUEST[MICHSCI_CATEGORY_NAME];
-    $cat_children = get_term_children($cat_id, MICHSCI_CATEGORY_NAME);
+      $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);
-        echo $term->name;
-    }
+        $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';}?>">
+                <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="<?php echo $term->name; ?>" title="<?php echo $term->name; ?>" itemprop="image">
+                </div>
+                <div class="subCatGrid small-12 columns">
+                    <a href="<?php echo $product->href; ?>"><?php echo $term->name; ?></a>
+                </div>
+                <div class="prodTitleGrid small-12 columns">
+                    <a href="<?php echo $product->href; ?>"><strong><?php echo $term->name; ?></strong></a>
+                </div>
+        </div>
+         
+   <?php // end sub cats 
+   }
     ?>
    <?php if ( isset( $products ) && is_array( $products ) ) : foreach ( $products as $product ) : ?>
    <?php $tags = wp_get_post_terms($product->ID,'michsci_tag'); ?>
         <div class="<?php foreach ($tags as $tag)echo $tag->slug . " ";?> product grid small-12 medium-4 columns<?php if ($product->end){ echo ' end';}?>">
-
                 <div class="prodImgGrid small-12 columns"><a href="<?php echo $product->href; ?>">
                     <?php echo get_the_post_thumbnail( $product->ID, array(320, 285)); ?></a>
                 </div>