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

x5 Navigating category tree

 
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)
 
Thread Tools Search this Thread
  #1  
Old 03-12-2015, 08:35 AM
 
xgarb xgarb is online now
 

eXpert
  
Join Date: Jul 2004
Location: UK
Posts: 263
 

Default x5 Navigating category tree

Anyone have any pointers on navigating the category tree on a page in x5

I've created a module to put little icons for the subcats at the top of category pages. I want them to display the same top level cats on all sub levels though.

IE

CARS TOP LEVEL CATEGORY PAGE (icons at top for Ford, GM, Ferrari, Fiat etc)
--- FORD SUB - CATEGORY PAGE (icons at top for Ford, GM, Ferrari, Fiat etc)
------ FORD PICKUPS SUB - CATEGORY PAGE (icons at top for Ford, GM, Ferrari, Fiat etc)
__________________
Core version: 5.5.xx
Reply With Quote
  #2  
Old 03-18-2015, 06:36 AM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,431
 

Default Re: x5 Navigating category tree

Hi @xgarb!

Do I understand you correctly that all you need is to put top category icons in the sidebar:
http://awesomescreenshot.com/0414nqho6a

In this case, you can change it by altering the skins/default/en/categories/list/body.tpl template.
Here is an article how you can apply template changes: http://kb.x-cart.com/display/XDD/Step+2+-+applying+design+changes
Here is an example of how to work with image widget: http://kb.x-cart.com/display/XDD/Using+images+widget
__________________
Found a bug in X-Cart? Post it to our bug tracker!
Know how to make X-Cart better? Suggest an idea!
Reply With Quote
  #3  
Old 03-19-2015, 07:24 AM
 
xgarb xgarb is online now
 

eXpert
  
Join Date: Jul 2004
Location: UK
Posts: 263
 

Default Re: x5 Navigating category tree

Hi,

No.. I wanted every sub-category page to have the top level categories for that area at the top.

I worked out one way of getting the top level category (moving up the tree). It might not be the best way but it works...

Code:
/** * xgarb - Find root cat by going through the path and taking the first result * */ protected function xgarbFindRoot() { $result = array(); foreach ($this->getCategoryPath() as $category) { $result[] = $category->getID(); } return $result[0]; }
__________________
Core version: 5.5.xx
Reply With Quote
  #4  
Old 03-23-2015, 05:22 AM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,431
 

Default Re: x5 Navigating category tree

Actually, this block always displays top level categories. Even on sub-categories pages, e.g.
http://demostore.x-cart.com/toys

As you can see we are in Toys directory, which has sub-categories, but top level categories are displayed in the top-left corner.

If I still did not grasp a problem, please let me know how would you need to display this block on the http://demostore.x-cart.com/toys page?

Tony.
__________________
Found a bug in X-Cart? Post it to our bug tracker!
Know how to make X-Cart better? Suggest an idea!
Reply With Quote
  #5  
Old 04-02-2015, 07:36 AM
 
xgarb xgarb is online now
 

eXpert
  
Join Date: Jul 2004
Location: UK
Posts: 263
 

Default Re: x5 Navigating category tree

HI,

I don't think I explained it very clearly.

It's second level cats so in the example I gave...

CARS TOP LEVEL CATEGORY PAGE (icons at top for Ford, GM, Ferrari, Fiat etc)
--- FORD SUB - CATEGORY PAGE (icons at top for Ford, GM, Ferrari, Fiat etc)
------ FORD PICKUPS SUB - CATEGORY PAGE (icons at top for Ford, GM, Ferrari, Fiat etc)

CARS are one of the top level categories on the site. Once you are in the CARS category I want the icons for the car brands to show at the top of all the pages below so if you are in the Compact Fords subcat you still see all the car brands at the top.

I've found that in my code return $result[0]; works quite nicely as I've got more parent categories now (for structural reasons) and I can change the 0 to a 1 or a 2 depending how far up the tree I want to go.
__________________
Core version: 5.5.xx
Reply With Quote
  #6  
Old 04-03-2015, 03:57 AM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,431
 

Default Re: x5 Navigating category tree

@xgarb, to be honest, I still feel that it works this way already in X-Cart 5.
Have a look at http://demostore.x-cart.com/toys/cube-goodies
We are in 2nd level category, but it still displays root categories in the top left corner. Should it be different?
__________________
Found a bug in X-Cart? Post it to our bug tracker!
Know how to make X-Cart better? Suggest an idea!
Reply With Quote
  #7  
Old 04-07-2015, 06:58 AM
 
xgarb xgarb is online now
 

eXpert
  
Join Date: Jul 2004
Location: UK
Posts: 263
 

Default Re: x5 Navigating category tree

Imagine you are here: http://demostore.x-cart.com/toys/rc-toys

We want to see

Cube Goodies, RC Toys, Science Toys as icons above the products. Also if the three categories had more subcats then the same three icons would show. It's a quick way to navigate where you are without having to jump to the Toys main category.

I've worked out how to do this and some other tricks with the navigation so I wouldn't worry about it too much.
__________________
Core version: 5.5.xx
Reply With Quote
  #8  
Old 04-08-2015, 11:56 AM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,431
 

Default Re: x5 Navigating category tree

Quote:
Originally Posted by xgarb
Imagine you are here: http://demostore.x-cart.com/toys/rc-toys

We want to see

Cube Goodies, RC Toys, Science Toys as icons above the products. Also if the three categories had more subcats then the same three icons would show. It's a quick way to navigate where you are without having to jump to the Toys main category.

I've worked out how to do this and some other tricks with the navigation so I wouldn't worry about it too much.

OK, glad to hear you have worked out that. Thanks for clarification, though!
__________________
Found a bug in X-Cart? Post it to our bug tracker!
Know how to make X-Cart better? Suggest an idea!
Reply With Quote
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may 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 10:25 PM.

   

 
X-Cart forums © 2001-2020