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)
-   -   Drop Down Menu For Categories (https://forum.x-cart.com/showthread.php?t=45608)

thefizix 02-16-2009 10:04 AM

Drop Down Menu For Categories
 
I have read a previous thread about creating a drop down menu for the categories.tpl. I am able to view the category drop down, but the text is not visible and when clicked on redirects to the home page. Code Shown Below...

{* $Id: categories.tpl,v 1.19 2003/11/11 14:02:32 svowl Exp $ *}
{capture name=menu}
{if $active_modules.Fancy_Categories ne ""}
{include file="`$fancycategories_config.modules_path`/fancy_categories.tpl"}
{else}
{if $config.General.root_categories eq "Y"}
<form name="form_cat" method="get" action="home.php">
<select name="cat" onChange="document.form_cat.submit()">
<option value="0" selected>Search By Category</option>
{section name=cat_num loop=$categories}
<option value="home.php?cat={$c.categoryid}">{$categories[cat_num].category}</option>
{/section}
</select>
</form>
{else}
{section name=cat_num loop=$subcategories}
<font class=CategoriesList>{ $subcategories[cat_num].category_name|escape }</font>

{/section}
{/if}
{/if}


{/capture}
{include file="menu.tpl" dingbats="dingbats_categorie.gif" menu_title=$lng.lbl_categories menu_content=$smarty.capture.menu}

balinor 02-16-2009 10:04 AM

Re: Drop Down Menu For Categories
 
Please don't post questions in the completed custom mods forum. Moving to Template Editing.

Yurij 02-17-2009 04:10 AM

Re: Drop Down Menu For Categories
 
Code:

{section name=cat_num loop=$categories}
<option value="{$c.categoryid}">{$categories[cat_num].category}</option>
{/section}


Use this section code instead of your variant.

thefizix 02-18-2009 09:51 PM

Re: Drop Down Menu For Categories
 
1 Attachment(s)
I am still getting the same issue. I have attached a screenshot. Basically the form box opens but the font is not visible and when clicked on it redirects me to a homepage and not to a specific category.

PhilJ 02-19-2009 03:39 AM

Re: Drop Down Menu For Categories
 
Code:

<form method="get" action="home.php">
<select name="cat" onchange="this.form.submit()">
<option value="0"{if $cat eq "0"} selected{/if}>{$lng.lbl_categories}...</option>
{foreach from=$categories item=c}
<option value="{$c.categoryid}"{if $cat eq $c.categoryid} selected{/if}>{$c.category}</option>
{/foreach}
</select>
</form>


Holub 02-19-2009 04:19 AM

Re: Drop Down Menu For Categories
 
Yes, PhilJ is right. I've copied code of "section" and did not checked, is it right. There is foreach should be.

thefizix 02-20-2009 09:14 AM

Re: Drop Down Menu For Categories
 
Thanks alot guys! It works!

dpm 05-12-2009 12:16 PM

Re: Drop Down Menu For Categories
 
Does this work with SEO friendly URL's? When I change the drop down I get a domian.com/?cat=285 instead of what it should be.


All times are GMT -8. The time now is 07:05 AM.

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