Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Categories Menu - Showing Subcategories

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #91  
Old 10-13-2006, 05:06 PM
 
carpeperdiem carpeperdiem is offline
 

X-Guru
  
Join Date: Jul 2006
Location: New York City, USA
Posts: 5,399
 

Default Re: Categories Menu - Showing Subcategories

PhilJ has a commercial version that works great...

http://www.xcartmods.co.uk/demos/4018/home.php?treem=1
__________________
xcart 4.5.4 gold+ w/x-payments 1.0.6; xcart gold 4.4.4
Reply With Quote
  #92  
Old 10-13-2006, 05:15 PM
  mitash's Avatar 
mitash mitash is offline
 

X-Adept
  
Join Date: Jan 2006
Location: Australia
Posts: 450
 

Default Re: Categories Menu - Showing Subcategories

This mod looks good....

It is also search engine friendly...

You may want to call the javascript from external file...

Ash
__________________
eCommerce - Strategy / Design / Development / Marketing / Maintenance

Call within Australia:
Phone: 1300 648 274 | Mobile: 0417 241 950
Call outside Australia:
+61 417 241 950 |

Email:
results@mitash.com | Skype: mitashau | Web: www.mitash.com
Reply With Quote
  #93  
Old 10-31-2006, 07:39 PM
  mitash's Avatar 
mitash mitash is offline
 

X-Adept
  
Join Date: Jan 2006
Location: Australia
Posts: 450
 

Default Re: Categories Menu - Showing Subcategories

Hi Can I use this mod to show sub categories in 4.1.3??

Thanks
Ash
__________________
eCommerce - Strategy / Design / Development / Marketing / Maintenance

Call within Australia:
Phone: 1300 648 274 | Mobile: 0417 241 950
Call outside Australia:
+61 417 241 950 |

Email:
results@mitash.com | Skype: mitashau | Web: www.mitash.com
Reply With Quote
  #94  
Old 11-07-2006, 08:41 PM
  mitash's Avatar 
mitash mitash is offline
 

X-Adept
  
Join Date: Jan 2006
Location: Australia
Posts: 450
 

Default Re: Categories Menu - Showing Subcategories

Any one..?
__________________
eCommerce - Strategy / Design / Development / Marketing / Maintenance

Call within Australia:
Phone: 1300 648 274 | Mobile: 0417 241 950
Call outside Australia:
+61 417 241 950 |

Email:
results@mitash.com | Skype: mitashau | Web: www.mitash.com
Reply With Quote
  #95  
Old 01-23-2007, 05:25 AM
 
robin robin is offline
 

Member
  
Join Date: Aug 2005
Location: Wilmington, NC
Posts: 13
 

Default Re: Categories Menu - Showing Subcategories

I cannot seem to get them to work with my current version. Plus they are not exactly what I am looking for. What I am trying to do is make a drop down of subcategories that will be placed on the home.tpl file. I am hoping to have about 4 dropdowns on the same page. I am using version 4.1.3. Can anyone help me?

Thank you!
__________________
X-cart Version: 4.1.3
PHP Version: 5.1.6
MySQL: 3.23.58
OS: Linux
Reply With Quote
  #96  
Old 02-21-2007, 10:12 AM
  chris2002's Avatar 
chris2002 chris2002 is offline
 

Advanced Member
  
Join Date: Mar 2006
Location: French Polynesia
Posts: 30
 

Default Re: Categories Menu - Showing Subcategories

Solution for 4.1.6

Cat A
--Cat A1
--Cat A2
Cat B
--Cat B1
--Cat B2

Only one modification in incude/categorie.php

Search for this in your code :
#
# Override subcategory_count for Admin area
#
if(!empty($subcategories) && ($current_area == 'A' || ($current_area == 'P' && $active_modules['Simple_Mode']))) {
$product_counts = func_query_hash("SELECT categoryid, COUNT(*) FROM $sql_tbl[products_categories] WHERE categoryid IN ('".implode("','", array_keys($subcategories))."') GROUP BY categoryid", "categoryid", false, true);
foreach($subcategories as $k => $v) {
$subcategories[$k]['subcategory_count'] = func_query_first_cell("SELECT COUNT(subcat.categoryid) as subc FROM $sql_tbl[categories] USE INDEX (PRIMARY) LEFT JOIN $sql_tbl[categories] as subcat ON subcat.categoryid_path LIKE CONCAT($sql_tbl[categories].categoryid_path, '/%') WHERE $sql_tbl[categories].categoryid = '$k' GROUP BY $sql_tbl[categories].categoryid");
$subcategories[$k]['product_count_global'] = $subcategories[$k]['product_count'];
$subcategories[$k]['product_count'] = isset($product_counts[$k]) ? intval($product_counts[$k]) : 0;
}
}



then add this just below the line :


//Subcategories in menu
function func_getallsubcat()
{
$raj =func_get_categories_list("", true, "all");
$raj1=$raj['all_categories'];
$ll=array();
foreach ($raj1 as $k=>$val)
{
if($val['parentid']!="0")
{
$ll[$val['parentid']][]=$val;
}
}
return $ll;
}
$smarty->assign("allsubcategories", func_getallsubcat());
//Subcategorie in menu - end

thank you
__________________
Chris
----------------------------------------
X-Cart Gold 4.1.xx / 4.2.xx
Need some Help in french
Webdesign or else.
----------------------------------------
Reply With Quote
  #97  
Old 02-21-2007, 11:03 AM
 
MallRomania MallRomania is offline
 

Senior Member
  
Join Date: Apr 2006
Posts: 109
 

Default Re: Categories Menu - Showing Subcategories

Hello

I add code below into my include/categories.php but my subcategories are still not visible..do i have to make any other modifications?

Thanks
__________________
Mircea Teleleu
Shopedia.ro-la cumparaturi
www.shopedia.ro
______________________
x-cart gold 4.1.6
Linux
Reply With Quote
  #98  
Old 02-21-2007, 01:53 PM
  chris2002's Avatar 
chris2002 chris2002 is offline
 

Advanced Member
  
Join Date: Mar 2006
Location: French Polynesia
Posts: 30
 

Default Re: Categories Menu - Showing Subcategories

Hi,

Yes you're right MallRomania, I foget to add variable in skin1/customer/categorie.tpl

Add this line were you need to show the subategorie

{assign var=in value=$c.categoryid}
{foreach from=$allsubcategories.$in item=c }

and then the link of your subcategorie (you modify it to fit your template)

<a href="home.php?cat={$c.categoryid}" class="CategoriesList3">{$c.category}<br></a>
__________________
Chris
----------------------------------------
X-Cart Gold 4.1.xx / 4.2.xx
Need some Help in french
Webdesign or else.
----------------------------------------
Reply With Quote
  #99  
Old 02-21-2007, 11:37 PM
 
MallRomania MallRomania is offline
 

Senior Member
  
Join Date: Apr 2006
Posts: 109
 

Default Re: Categories Menu - Showing Subcategories

Thanks, here is the complete code for skin1/customer/categories.tpl, modified to fit my template

Code:
{* $Id: categories.tpl,v 1.26 2005/11/17 06:55:37 max Exp $ *} {if $active_modules.Fancy_Categories ne ""} {include file="modules/Fancy_Categories/categories.tpl"} {assign var="fc_cellpadding" value="0"} {else} {if $config.General.root_categories eq "Y"} {foreach from=$categories item=c} <font class="CategoriesList"><a href="home.php?cat={$c.categoryid}" class="VertMenuItems">{$c.category}</a></font>{assign var=in value=$c.categoryid} {foreach from=$allsubcategories.$in item=c }<br /> &nbsp;&nbsp;&raquo; <a href="home.php?cat={$c.categoryid}" class="CategoriesList3">{$c.category}</a> {/foreach}<br> {/foreach} {else} {foreach from=$subcategories item=c key=catid} <font class="CategoriesList"><a href="home.php?cat={$catid}" class="VertMenuItems"><li>{$c.category} </li></a></font><br /> {/foreach} {/if} {/if}
__________________
Mircea Teleleu
Shopedia.ro-la cumparaturi
www.shopedia.ro
______________________
x-cart gold 4.1.6
Linux
Reply With Quote
  #100  
Old 02-22-2007, 08:31 AM
  chris2002's Avatar 
chris2002 chris2002 is offline
 

Advanced Member
  
Join Date: Mar 2006
Location: French Polynesia
Posts: 30
 

Default Re: Categories Menu - Showing Subcategories

It seems great, here's the full code page for you.
Code:
{* $Id: categories.tpl,v 1.26 2005/11/17 06:55:37 max Exp $ *} {capture name=menu} {if $active_modules.Fancy_Categories ne ""} {include file="modules/Fancy_Categories/categories.tpl"} {assign var="fc_cellpadding" value="0"} {else} {if $config.General.root_categories eq "Y"} {assign var="_categories" value=$categories} {foreach from=$_categories item=c key=catid} <font class="CategoriesList"><a href="home.php?cat={$c.categoryid}" class="VertMenuItems">{$c.category}</a></font> {assign var=in value=$c.categoryid} {foreach from=$allsubcategories.$in item=c }<br /> &nbsp;&nbsp;&raquo; <a href="home.php?cat={$c.categoryid}" class="CategoriesList3">{$c.category}</a> {/foreach}<br> {/foreach} {else} {foreach from=$subcategories item=c key=catid} <font class="CategoriesList"><a href="home.php?cat={$catid}" class="VertMenuItems"><li>{$c.category} </li></a></font><br /> {/foreach} {/if} {/if} {/capture} { include file="menu.tpl" dingbats="dingbats_categorie.gif" menu_title=$lng.lbl_categories menu_content=$smarty.capture.menu cellpadding=$fc_cellpadding}

And you need to create a CSS with "CategorieList3" because it doesn't exist or use another one.
You have
Code:
<li></li>
in the else section not in first one, maybe it's normal, because you gonna have a different display if you select to show the first categorie in the admin panel.

Thank you
__________________
Chris
----------------------------------------
X-Cart Gold 4.1.xx / 4.2.xx
Need some Help in french
Webdesign or else.
----------------------------------------
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 02:08 AM.

   

 
X-Cart forums © 2001-2020