| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
ALWAYS display first level subcats beneath root cats | ||||
|
|
Thread Tools | Search this Thread |
#21
|
|||||||
|
|||||||
i did try to make it work under 4.1 but no result..
i'm still too young with xcart and smarty.. anybody fixed it? pleease
__________________
Stefano Cecere - krur.com X-cart 4.1.1 Gold on Linux |
|||||||
#22
|
|||||||||
|
|||||||||
Hello ..
I did manage to get it working (with some help from the guys @ XCart Support) This is how it's done: Modify the "<xcart-dir>/include/categories.php" file: 1) find the following line (it is 290th in X-Cart v4.1.0 by default) if (($current_area == "C" && defined("GET_ALL_CATEGORIES")) || defined('MANAGE_CATEGORIES')) { 2) replace it with the next one if (($current_area == "C") || defined('MANAGE_CATEGORIES')) { Then edit categories.tpl replace with the following code after {if $config.General.root_categories eq "Y"} {foreach from=$categories item=c} <font class="CategoriesList">{$c.category}</font> <ul> {foreach from=$allcategories item=cat} {if $cat.parentid eq $c.categoryid}[*]<font class="CategoriesList">{$cat.category}</font> {/if} {/foreach}[/list]{/foreach} Hope this helps ... Regards Shafiq :sK
__________________
Developing in 4.7.x now (Dipping into v5 - Slowly!) Have used 4.1.x, 4.2.x, 4.4.x, 4.5.x, 4.6.x & 4.7.x Multiple Instances of X-Cart MySQL 5.6.37 CentOS 7.4 Chamber Internet - Lancashire, United Kingdom http://www.chamberelancs.co.uk |
|||||||||
#23
|
|||||||
|
|||||||
Quote:
I've tried using this in Version 4.0.18. The links work and i get the right amount for each category. My problem is, instead of displaying the sub-category name, it just displays "Array" over and over. Any ideas anyone? Thanks Dave |
|||||||
#24
|
|||||||
|
|||||||
Re: ALWAYS display first level subcats beneath root cats
This works great on 4.1.3! However, the subcategories are not displaying in the order they are specified to order by (based on pos).. any idea how to do that?
Quote:
__________________
Jeremy Freeman EZWatch Store X-Cart v4.1.5 |
|||||||
#25
|
|||||||
|
|||||||
Re: ALWAYS display first level subcats beneath root cats
Fixed it.. you need to comment out the following line in include/categories.php to sort the subcategories by pos:
usort($all_categories, "func_categories_sort"); I should appear around line 165ish Quote:
__________________
Jeremy Freeman EZWatch Store X-Cart v4.1.5 |
|||||||
#26
|
|||||||
|
|||||||
Re: ALWAYS display first level subcats beneath root cats
Hi,
I am using X-Cart 4.1.2 Gold, and would like to use your modification. I do not see a skin1/categories.tpl file. Am I missing some interpretation of your post? Thanks, Will
__________________
-Michael Shearer ------------------------------------- X-Cart version 4.1.2, PHP 4.4.4, MySQL server 4.0.26, MySQL client 4.0.26, Apache/1.3.37 (Unix) Vortech_PHP/1.0, FrontPage/5.0.2.2623, mod_ssl/2.8.28, OpenSSL/0.9.7e-p1, FreeBSD, Perl 5.008007, XML parser (expat) found |
|||||||
#27
|
|||||||
|
|||||||
Re: ALWAYS display first level subcats beneath root cats
Hope someone is still looking at this one.
I used this code in the /customer/categories.tpl. It does display the subcategories under the Main Categories as hoped. The first issue is, that the subcat list items are not linked to the subcategories pages. The second issue is that I have made the menu column wider, and the sub cat list does not have line breaks, so they run on as one line. Can some one help with this? Thanks, Gary Here is the code I'm using: {* $Id: categories.tpl,v 1.23 2004/06/24 09:53:29 max Exp $ *} {capture name=menu} {if $active_modules.Fancy_Categories ne ""} {include file="`$fancycategories_config.modules_path`/fancy_categories.tpl"} {else} {if $config.General.root_categories eq "Y"} {section name=cat_num loop=$categories} <FONT class="CategoriesList"><A href="home.php?cat={$categories[cat_num].categoryid}" class="VertMenuItems">{$categories[cat_num].category}</A></FONT><BR> {section name=subcat loop=$allcategories} {if $allcategories[subcat].parentid eq $categories[cat_num].categoryid} {$allcategories[subcat].category} {/if} {/section} {/section} {else} {section name=cat_num loop=$subcategories} <FONT class="CategoriesList"><A href="home.php?cat={$subcategories[cat_num].categoryid}" class="VertMenuItems">{$subcategories[cat_num].category}</A></FONT><BR> {/section} {/if} {/if} {/capture} { include file="menu.tpl" dingbats="dingbats_categorie.gif" menu_title=$lng.lbl_categories menu_content=$smarty.capture.menu }
__________________
v4.1.6 Unix OSX 10.5.6 PHP 5.x MySQL various versions |
|||||||
#28
|
|||||||||
|
|||||||||
Re: ALWAYS display first level subcats beneath root cats
Here is my categories.tpl file:
Quote:
The text in bold will correct both issues for you. Thanks, Louise
__________________
Louise Studio 57 Designs - X-Cart Customization Providing X-Cart Services since 2004 Hottest Blog Directory - Submit Your Blog for a Free Listing |
|||||||||
|
#29
|
|||||||
|
|||||||
Re: ALWAYS display first level subcats beneath root cats
Quote:
This works for me using version 4.1.6. Can anyone show me how to keep the 2nd level subcategories showing, all the time? Thanks in advance.
__________________
--------------- Brandon Larsen --------------- X-Cart version 4.4.3 X-Cart version 4.1.9 X-Cart version 4.1.10 |
|||||||
#30
|
|||||||||
|
|||||||||
Re: ALWAYS display first level subcats beneath root cats
Solution for 4.1.6
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
__________________
Chris ---------------------------------------- X-Cart Gold 4.1.xx / 4.2.xx Need some Help in french Webdesign or else. ---------------------------------------- |
|||||||||
|
|||
X-Cart forums © 2001-2020
|