Guest aikdo Posted December 20, 2005 Share Posted December 20, 2005 This mod will display the Top-Level Cats On the home page.... OPEN includes/content/index.inc.php Find$index->parse("index.latest_prods"); } AFTER ADD :-/////////////////////// //// CATAGORIES // build query $query = "SELECT * FROM ".$glob['dbprefix']."CubeCart_category WHERE cat_father_id = ".$db->mySQLSafe(0)." ORDER BY cat_name ASC"; // get category array in foreign innit $resultsForeign = $db->select("SELECT cat_master_id as cat_id, cat_name FROM ".$glob['dbprefix']."CubeCart_cats_lang WHERE cat_lang = '".$lang_folder."'"); // query database $subCategories = ""; $subCategories = $db->select($query); // loop results for ($i=0; $i<count($subCategories); $i++){ if(is_array($resultsForeign)){ for ($k=0; $k<count($resultsForeign); $k++){ if($resultsForeign[$k]['cat_id'] == $subCategories[$i]['cat_id']){ $subCategories[$i]['cat_name'] = $resultsForeign[$k]['cat_name']; } } } if(empty($subCategories[$i]['cat_image'])){ $index->assign("IMG_CATEGORY",$GLOBALS['rootRel']."skins/".$config['skinDir']."/styleImages/catnophoto.gif"); } else { $index->assign("IMG_CATEGORY",$GLOBALS['rootRel']."images/uploads/".$subCategories[$i]['cat_image']); } $index->assign("TXT_LINK_CATID",$subCategories[$i]['cat_id']); $index->assign("TXT_CATEGORY", validHTML($subCategories[$i]['cat_name'])); $index->assign("NO_PRODUCTS", $subCategories[$i]['noProducts']); $index->parse("index.sub_cats.sub_cats_loop"); } // end loop results $index->parse("index.sub_cats"); // end $subCategories CLOSE includes/content/index.inc.php OPEN skins/{your_skin}/skinTemplates/content/index.tpl FIND<!-- BEGIN: latest_prods --> BEFORE ADD<!-- BEGIN: sub_cats --> <div class="boxContent"> <span class="txtContentTitle"></span> <div> <!-- BEGIN: sub_cats_loop --> <div style="float: left; text-align: center; possition:relative; margin:5px;"> <a href="index.php?act=viewCat&catId={TXT_LINK_CATID}" class="txtDefault"><img src="{IMG_CATEGORY}" alt="{TXT_CATEGORY}" border="0" title="{TXT_CATEGORY}" /></a><br /> <a href="index.php?act=viewCat&catId={TXT_LINK_CATID}" class="txtDefault">{TXT_CATEGORY}</a> </div> <!-- END: sub_cats_loop --> <br clear="all" /> </div> <br clear="all" /> </div> <!-- END: sub_cats --> Thats it it now works perfectly just the same as the Subcats work You can see this in action at http://www.roxydiamonds.com/index.php and http://www.wood-b-treasures.com/ Quote Link to comment Share on other sites More sharing options...
Guest woodbtreasures Posted December 20, 2005 Share Posted December 20, 2005 installed this mod on my site and works great. Super easy instructions and took less than 5 minutes! Good job Aikdo :D Quote Link to comment Share on other sites More sharing options...
Guest aikdo Posted December 20, 2005 Share Posted December 20, 2005 Thanks wood-be-tresures. i have added you link to the examples as it looks good on your site... Quote Link to comment Share on other sites More sharing options...
Guest woodbtreasures Posted December 20, 2005 Share Posted December 20, 2005 :D :D Quote Link to comment Share on other sites More sharing options...
markscarts Posted December 20, 2005 Share Posted December 20, 2005 Excellent and useful! I was working on this awhile back and got stuck, never did finish it. This will be helpful for many people @ woodbtreasures, I agree, you have implemented the mod beautifully :D Quote Link to comment Share on other sites More sharing options...
Guest aikdo Posted December 20, 2005 Share Posted December 20, 2005 Yea i have seen many people try this none sucessful and with a simple brainwave that i could just use the subcarts code and tell it to find father_id 0 << ie all top-level catagories... then it was easy to create and i think you will agree impliment also... Quote Link to comment Share on other sites More sharing options...
convict Posted December 20, 2005 Share Posted December 20, 2005 @ aikdo just a suggestion, add this as a Minor mod here ;) Quote Link to comment Share on other sites More sharing options...
Guest aikdo Posted December 20, 2005 Share Posted December 20, 2005 Im already working on writing it up as mod instructions, at the time it was quicker to make a post here. I will however be updating it so that they can be turned ff from the admin... ^^ same as lattest products ^^ i wil upload this as v1 tonight though... But i do have Alot of work to do... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.