X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Direct Link to parent category (https://forum.x-cart.com/showthread.php?t=9607)

coneme 09-28-2004 09:10 PM

Direct Link to parent category
 
Just say I have one category:

Intel

and underneath this 'parent' category I have 3 subcategories:

Celeron
Pentium
Pentium Mobile

If a customer is viewing the products listed in the "Pentium" category, but wants to 'jump back' one level to "Intel" - is there a way I can provide such a direct link back to this 'parent' category?

I want to achieve this *without* using the full length breadcrumbs (location.tpl).


I had a stab at this, but the code below produces a link for the *current* category - if somebody knows how to refer to the *2nd* last element of the $location array I think it might do the trick:

Code:

          {if !$subcategories}
                  {section name=position loop=$location}
                        {if %position.last% eq "true"} {if $location[position].1 ne "" }
                                <a href="{$location[position].1}">{/if}
                        <font class=NavigationPath>{$location[position].0}</font>
                    {if $location[position].1 ne "" }</a>{/if}
                        {/if}
                {/section}
          {/if}


coneme 10-03-2004 10:51 PM

I pasted this elsewhere, but it might be useful here too..


Hi Everyone

found it. For anyone else with a similar problem:

$location[1].1 will give the immediate parent category id.

Cheers.

coneme 10-03-2004 11:08 PM

Actually, this is not COMPLETE. Please disregard till next post...


All times are GMT -8. The time now is 01:44 PM.

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