Modular Merchant: Shopping Cart Software

Shopping Cart Software Service

Advanced SearchAdvanced Search RegisterRegister ProfileProfile FAQFAQ MemberlistMemberlist Log inLog in
Subcategories Listing
Post new topic   Reply to topic
Modular Merchant Forum Index -> Design: Templates & QuickCode Tags
Author Message

scottfmorgan




Joined: 11 May 2009
Posts: 5


PostPosted: Jun 24, 2009 05:16pm    Post subject: Subcategories Listing Reply with quote

Does anyone know of a way to list subcategories on a subcategory page? So if a category "Hats" has subcategories of "baseball", "cowboy", and "Derby" - when I'm on the "Baseball" page I want to get a list of "baseball", "cowboy", and "Derby".

Any ideas? It seems like the {SUBCATEGORY-XXXX} QuickCodes are only meant to list the children pages under the current page.

Thanks in advance!

bavery261


Modular Merchant: Development

Joined: 08 Oct 2008
Posts: 19


PostPosted: Jun 25, 2009 03:23pm    Post subject: Reply with quote

Hello,

Quote:
Does anyone know of a way to list subcategories on a subcategory page? So if a category "Hats" has subcategories of "baseball", "cowboy", and "Derby" - when I'm on the "Baseball" page I want to get a list of "baseball", "cowboy", and "Derby".

Any ideas? It seems like the {SUBCATEGORY-XXXX} QuickCodes are only meant to list the children pages under the current page.


It is possible to display all of the subcategories from a specified parent category regardless of what subcategory is selected. This can be done by replacing the {SUBCATEGORY-BEGIN} QuickCode Tag in the template with the code sample provided below. Once this code is on place, any of the {SUBCATEGORY-XXX} QuickCode Tags located between this code sample and the {SUBCATEGORY-END} QuickCode Tag will display the information for the desired set of subcategories.

Replace the {SUBCATEGORY-BEGIN} with this code:
Code:

<?php
$subcat_arr=array();
$sql = "SELECT * FROM prod_cats WHERE parent_cat='CATEGORY-SID-NUMBER' AND active='Y' ORDER BY display_order ASC, name ASC";
$subcat_arr = mm_fetch_data($sql);
$x=0;
if(count($subcat_arr['id'])>0) {
   foreach((array)$subcat_arr['id'] AS $subcat) {
?>


Note: Replace the 'CATEGORY-SID-NUMBER' in this code sample above with the System ID (SID) number of the desired parent category.

I hope this information was helpful. If you have any further questions, please let us know.
Display posts from previous:   
Post new topic   Reply to topic    Modular Merchant Forum Index -> Design: Templates & QuickCode Tags All times are GMT - 7 Hours
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group