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

Link to sub-category in menu

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 11-15-2013, 01:14 AM
 
AKassing AKassing is offline
 

Member
  
Join Date: Jun 2013
Posts: 17
 

Default Link to sub-category in menu

I've created language variables for all my categories, but I don't know how to add a link to a (sub-)categoryto another menu properly.
I used "<li><a href="home.php?cat=47">Horror</a></li>" and this works, but the names are static.
What do I need to change so the title of this link automaticaly displays the correct language variable?

Thanks,

Alexandra
Reply With Quote
  #2  
Old 11-15-2013, 02:13 AM
 
carpeperdiem carpeperdiem is offline
 

X-Guru
  
Join Date: Jul 2006
Location: New York City, USA
Posts: 5,399
 

Default Re: Link to sub-category in menu

Quote:
Originally Posted by AKassing
I've created language variables for all my categories, but I don't know how to add a link to a (sub-)categoryto another menu properly.
I used "<li><a href="home.php?cat=47">Horror</a></li>" and this works, but the names are static.
What do I need to change so the title of this link automaticaly displays the correct language variable?

Huh? There is no need to make language vars for categories or products.
Use Smarty vars to make your links... such as:

{$catid}

look at the code used in fancy categories for examples.
/skin/common_files/modules/Flyout_Menus/Icons/fancy_subcategories.tpl

Basically, let xcart (smarty) do the work.
__________________
xcart 4.5.4 gold+ w/x-payments 1.0.6; xcart gold 4.4.4
Reply With Quote
  #3  
Old 11-15-2013, 02:22 AM
  vasilis's Avatar 
vasilis vasilis is offline
 

X-Adept
  
Join Date: Feb 2009
Posts: 758
 

Default Re: Link to sub-category in menu

If you mean, displaying a category name in alternative site language in a different place in the page, you could try the following code (I am not sure if this is what you mean):

Code:
{foreach from=$categories_menu_list item=c name=categories} {if $c.categoryid eq '47'} <li{interline name=categories}><a href="home.php?cat={$c.categoryid}" title="{$c.category|escape}">{$c.category|amp}</a></li> {/if} {/foreach}

The variable names might differ, according to your xcart version.
Reply With Quote
  #4  
Old 11-15-2013, 02:34 AM
 
AKassing AKassing is offline
 

Member
  
Join Date: Jun 2013
Posts: 17
 

Default Re: Link to sub-category in menu

Quote:
Originally Posted by carpeperdiem
Huh? There is no need to make language vars for categories or products.
Use Smarty vars to make your links... such as:

{$catid}

look at the code used in fancy categories for examples.
/skin/common_files/modules/Flyout_Menus/Icons/fancy_subcategories.tpl

Basically, let xcart (smarty) do the work.

Thanks for the reply, but although I've checked fancy_subcategories.tpl, I still don't understand how to fix my problem.
__________________
X-Cart 4.5
Reply With Quote
  #5  
Old 11-15-2013, 02:40 AM
 
AKassing AKassing is offline
 

Member
  
Join Date: Jun 2013
Posts: 17
 

Default Re: Link to sub-category in menu

Quote:
Originally Posted by vasilis
If you mean, displaying a category name in alternative site language in a different place in the page, you could try the following code (I am not sure if this is what you mean):

Code:
{foreach from=$categories_menu_list item=c name=categories} {if $c.categoryid eq '47'} <li{interline name=categories}><a href="home.php?cat={$c.categoryid}" title="{$c.category|escape}">{$c.category|amp}</a></li> {/if} {/foreach}

The variable names might differ, according to your xcart version.

I just want the sub-categories from category "All Products" to be visible in another menu. I got this to work by adding this:
<li><a href="home.php?cat=47">Horror</a></li>
<li><a href="home.php?cat=50">Sci-Fi Science Fiction</a></li>
<li><a href="home.php?cat=6">Disney</a></li>
<li><a href="home.php?cat=40">Music & Dance</a></li>
<li><a href="home.php?cat=44">Western</a></li>
<li><a href="home.php?cat=48">War</a></li>
<li><a href="home.php?cat=42">Martial Arts</a></li>
<li><a href="home.php?cat=45">James Bond 007</a></li>
<li><a href="home.php?cat=41">Kids & Animation</a></li>
<li><a href="home.php?cat=43">(S)exploitation</a></li>
<li><a href="home.php?cat=46">Marvel & Superheroes</a></li>
<li><a href="home.php?cat=49">Vintage-Classic Pre-1970</a></li>

However, I want X-Cart to automaticaly display the corresponding title of that sub-category in the correct language. The way I did it they are the same in all languages. What code do I need to add or replace the above titles with?
__________________
X-Cart 4.5
Reply With Quote
  #6  
Old 11-15-2013, 02:53 AM
  vasilis's Avatar 
vasilis vasilis is offline
 

X-Adept
  
Join Date: Feb 2009
Posts: 758
 

Default Re: Link to sub-category in menu

In your initial post, you had referred to one specific subcategory with id 47.
If you mean displaying all subcategories in a different place, you could just insert:
Quote:
{include file="customer/categories.tpl"}
in the template that renders this menu. That's the snippet by which x-cart displays categories.
If I missed something, let me know.
Reply With Quote
  #7  
Old 11-15-2013, 03:05 AM
 
AKassing AKassing is offline
 

Member
  
Join Date: Jun 2013
Posts: 17
 

Default Re: Link to sub-category in menu

Quote:
Originally Posted by vasilis
In your initial post, you had referred to one specific subcategory with id 47.
If you mean displaying all subcategories in a different place, you could just insert:

in the template that renders this menu. That's the snippet by which x-cart displays categories.
If I missed something, let me know.

The specific subcategory with id 47 was used as an example, because I want to be able to add links to specific subcategories.

When I try your code it adds a clone of the original categories menu. I just need links to all the sub-categories, minus the first one (All Our Products), from the main category "All Products".
__________________
X-Cart 4.5
Reply With Quote
  #8  
Old 11-19-2013, 04:58 AM
 
AKassing AKassing is offline
 

Member
  
Join Date: Jun 2013
Posts: 17
 

Default Re: Link to sub-category in menu

Okay I fixed this problem:
I used "<li><a href="home.php?cat=47">Horror</a></li>"

Changed this to:
<li><a href="home.php?cat=47">{$lng.lbl_genre_horror}</a></li>

Now you can set different titles for all languages and they can be different from the actual category name. Hope someone else can profit from this solution.
__________________
X-Cart 4.5
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 06:57 PM.

   

 
X-Cart forums © 2001-2020