View Single Post
  #5  
Old 04-20-2004, 10:52 AM
 
2getInk 2getInk is offline
 

Member
  
Join Date: Apr 2004
Posts: 12
 

Default

Hi,
I have found a code by boomer which was for the kind of thing done on http://www.savatrader.com/shop/customer/home.php.
I have modified the code to make it suitable for us.
Hope it helps everyone.


I have tested it on x-cart version: 3.4.12

Edit skin1/customer/categories.tpl:

Code:
{section name=cat_num loop=$categories} {$categories[cat_num].category_name} <span class="sub" id="{$categories[cat_num].categoryid}"> {section name=subcat_num loop=$categories_data} {if $categories_data[subcat_num].root_category_name == $categories[cat_num].category && $categories_data[subcat_num].category_name != $categories[cat_num].category_name} <a href="home.php?cat={$categories_data[subcat_num].categoryid}"> -{$categories_data[subcat_num].category_name}</A> {/if} {/section} </span> {/section}


Edit include/categories.php:

Comment out the line (just add a # in front of it):

Code:
$categories_data = func_query("select $sql_tbl[categories].*, SUBSTRING_INDEX($sql_tbl[categories].category, '\/', -1) as category_name from $sql_tbl[categories] ".($current_area=="C"?"where $sql_tbl[categories].avail='Y' $membership_condition ":"")." group by $sql_tbl[categories].categoryid order by ".($current_area=="C" ? "order_by" : "category"));

and add the following underneath it:

Code:
$categories_data = func_query("select $sql_tbl[categories].*, SUBSTRING_INDEX($sql_tbl[categories].category, '\/', -1) as category_name, SUBSTRING_INDEX($sql_tbl[categories].category, '\/', 1) as root_category_name from $sql_tbl[categories] ".($current_area=="C"?"where $sql_tbl[categories].avail='Y' $membership_condition ":"")." group by $sql_tbl[categories].categoryid order by ".($current_area=="C" ? "order_by" : "category"));

Then go down to the bottom of the file where the "Assign Smarty variables" comment is, underneath it add:

Code:
$smarty->assign("categories_data",$categories_data);
Reply With Quote