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

If ticked, the categories list always shows root categories:

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 12-13-2008, 07:35 AM
  davidsaldana's Avatar 
davidsaldana davidsaldana is offline
 

Senior Member
  
Join Date: Oct 2005
Posts: 187
 

Default If ticked, the categories list always shows root categories:

We would like to use this feature but are running into a problem, at the level when "products.tpl" or "products_t.tpl" kicks in, the entire menu disappears. Would anyone know how to show, just the parent subcategories there, instead of having it disappear.

Thanks,
David
__________________
4.4
Code:
Hello World
Reply With Quote
  #2  
Old 12-15-2008, 12:21 AM
  Holub's Avatar 
Holub Holub is offline
 

X-Adept
  
Join Date: Jan 2008
Posts: 432
 

Default Re: If ticked, the categories list always shows root categories:

Hm, it is have sense only in case of two levels menu tree - root categories and one level per root category. Can you confirm that you have only two levels category structure? I'll make some research which allow to show subcategories menu.
__________________
Regards,
Anthony Holub

X-Cart Skins Store
- twenty two different skins available;
- both 4.1.x and 4.2.x versions compatible;
- refresh you store now!

Smart menu X-Cart add-on
Featured Products Slide Show X-Cart add-on
"What's New?" FREE X-Cart add-on
Reply With Quote
  #3  
Old 12-15-2008, 05:22 AM
  davidsaldana's Avatar 
davidsaldana davidsaldana is offline
 

Senior Member
  
Join Date: Oct 2005
Posts: 187
 

Default Re: If ticked, the categories list always shows root categories:

Quote:
Originally Posted by Holub
Hm, it is have sense only in case of two levels menu tree - root categories and one level per root category. Can you confirm that you have only two levels category structure? I'll make some research which allow to show subcategories menu.

Yes, that is correct, there are only two levels on the site.


BTW, Nice Skins!!
__________________
4.4
Code:
Hello World
Reply With Quote
  #4  
Old 12-15-2008, 06:07 AM
  Holub's Avatar 
Holub Holub is offline
 

X-Adept
  
Join Date: Jan 2008
Posts: 432
 

Default Re: If ticked, the categories list always shows root categories:

Here is decision, tested on 4.1.9 and 4.1.11:

find this code in include/categories.php

Code:
# # Gather the array of categories and extract into separated arrays: # $all_categories, $categories and $subcategories # if (($current_area == "C" && defined("GET_ALL_CATEGORIES")) || defined('MANAGE_CATEGORIES')) { $_categories = func_get_categories_list($cat); } elseif($current_area == "C") { $_categories = func_get_categories_list($cat, true, "current"); } else { $_categories = func_get_categories_list($cat, true, "all"); }

between comments and
Code:
if (($current_area == "C" && defined("GET_ALL_CATEGORIES"))
insert

Code:
$old_cat = $cat; if ($current_category["parentid"] != 0) $cat = $current_category["parentid"];

and find

Code:
if ($cat == 0) $subcategories = $categories;

and insert after
Code:
$cat = $old_cat;

You should get something like this

Code:
# # Gather the array of categories and extract into separated arrays: # $all_categories, $categories and $subcategories # $old_cat = $cat; if ($current_category["parentid"] != 0) $cat = $current_category["parentid"]; if (($current_area == "C" && defined("GET_ALL_CATEGORIES")) || defined('MANAGE_CATEGORIES')) { $_categories = func_get_categories_list($cat); } elseif($current_area == "C") { $_categories = func_get_categories_list($cat, true, "current"); } else { $_categories = func_get_categories_list($cat, true, "all"); } extract($_categories); unset($_categories); # # Prepare data for FancyCategories module # if ($current_area == "C" && !empty($active_modules["Fancy_Categories"])) @include $xcart_dir."/modules/Fancy_Categories/fancy_categories.php"; if (!empty($all_categories)) $smarty->assign("allcategories", $all_categories); if (!empty($categories)) $smarty->assign("categories", $categories); if ($cat == 0) $subcategories = $categories; $cat = $old_cat;

All done. Just save it and upload file on server.

You will always see subcategories menu (if subcategories exist) in any root category.
__________________
Regards,
Anthony Holub

X-Cart Skins Store
- twenty two different skins available;
- both 4.1.x and 4.2.x versions compatible;
- refresh you store now!

Smart menu X-Cart add-on
Featured Products Slide Show X-Cart add-on
"What's New?" FREE X-Cart add-on
Reply With Quote
  #5  
Old 12-15-2008, 07:04 AM
  davidsaldana's Avatar 
davidsaldana davidsaldana is offline
 

Senior Member
  
Join Date: Oct 2005
Posts: 187
 

Default Re: If ticked, the categories list always shows root categories:

Thank you so much... did the trick.
__________________
4.4
Code:
Hello World
Reply With Quote
  #6  
Old 04-06-2011, 01:59 PM
 
RJ Michaels RJ Michaels is offline
 

Newbie
  
Join Date: Nov 2010
Posts: 1
 

Default Re: If ticked, the categories list always shows root categories:

This is exactly what I need - except that I need it for 4.4. This version doesn't seem to have a include/categories.php file and I can't find a reference on a system wide search for the code. Is this fix still applicable?
__________________
* 4.4.1
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



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 11:16 AM.

   

 
X-Cart forums © 2001-2020