Added documentation to the shop category display file
authorLaury GvR <laury@gaslightmedia.com>
Tue, 5 Dec 2017 19:01:34 +0000 (14:01 -0500)
committerLaury GvR <laury@gaslightmedia.com>
Tue, 5 Dec 2017 19:01:34 +0000 (14:01 -0500)
parts/shop-cats-and-products.php

index bb3c93b..d8ee7e7 100644 (file)
@@ -1,6 +1,16 @@
-
-
 <?php 
+/*
+ * - Only shows top-level categories 
+ * - Unless a top-level category is selected, then it shows the subcats for that category
+ * - Currently selected category gets a > prefix. Also applied to parent category if current category is a subcategory
+ * - Going into a product still shows the selected subcategory (see: if is_product())
+ * 
+ * FLAWS: 
+ * - If a product has multiple categories assigned to it it may only recognise the last one
+ * (foreach $terms as $term --> $current_cat_id = $term->term_id)
+ * - There may be outlying situations where the default values (else) of id 0 and parent 0 are undesirable
+ */
+
     if (is_shop()) {
         $current_cat_id = 0;
         $current_cat_parent = 0;
                         }
                     }
                 echo '</div>';
-
             }
-            
             ?>
         <?php } ?>
     <?php } ?>
\ No newline at end of file