X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (X-Cart 5) (https://forum.x-cart.com/forumdisplay.php?f=56)
-   -   x5 Navigating category tree (https://forum.x-cart.com/showthread.php?t=71606)

xgarb 03-12-2015 08:35 AM

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)

tony_sologubov 03-18-2015 06:36 AM

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

xgarb 03-19-2015 07:24 AM

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];
    }


tony_sologubov 03-23-2015 05:22 AM

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.

xgarb 04-02-2015 07:36 AM

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.

tony_sologubov 04-03-2015 03:57 AM

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?

xgarb 04-07-2015 06:58 AM

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.

tony_sologubov 04-08-2015 11:56 AM

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!


All times are GMT -8. The time now is 07:43 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.