X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Main Categories as a drop down list (https://forum.x-cart.com/showthread.php?t=5297)

issay 11-22-2003 01:34 AM

Main Categories as a drop down list
 
I couldn't find a post dealing with this.
By default, main categories are listed showing all categories either on the right or left side of the page. What I would like to do is show all main categories as a drop down list. Selecting a category will take the user to the respective subcategories page as happens now. This must be quite simple, I guess....

shan 11-22-2003 05:35 AM

try this one

http://forum.x-cart.com/viewtopic.php?t=4248&highlight=

issay 11-22-2003 06:43 AM

not exactly what I am looking for.

Here is a drawing of how I want it to appear...

http://www.shopping.com.mv/mall/images/images2/cat.GIF

issay 11-24-2003 07:34 AM

I am sure this is quite simple to do ... Waiting for someone to save the day...

chycor 11-25-2003 01:52 AM

Hi there,

We have done this already.

Backup /skin1/customer/categories.tpl

Old Code

Code:

{* $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"}
{section name=cat_num loop=$categories}
<font class=CategoriesList>{ $categories[cat_num].category_name|escape }</font>

{/section}
{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 }


Replace with this - New Code

Code:

{* $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">Select...</option>
{section name=cat_num loop=$categories}
<option class=CategoriesList value="{$categories[cat_num].categoryid}">{$categories[cat_num].category_name|escape}</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}


This for 3.5.0. May be incompatible with 3.4.x series.

Always back up first!!!!!

chycor 11-25-2003 01:55 AM

Could a moderator move this thread to "custom mods" for the benefit of other xcart users.

issay 11-25-2003 07:20 AM

Thanks a lot for this mod... I was able to get it working on 3.4 with some minor modifications....
One question though: How can we make the selected category be shown in the drop down list even if we browse thorugh the subcategories... Now, when we select a subcategory the option select shown gets reset to "Select a category...."?

amgdg 01-22-2004 10:17 PM

To select the current category, change your option statement to:

<option class=CategoriesList value="{$categories[cat_num].categoryid}" {if $current_category eq $categories[cat_num]}selected{/if}>{$categories[cat_num].category_name|escape}</option>

-> Al

natalieb 01-23-2004 11:10 PM

MOD possible also for just 1 category?
 
Great MOD!
Is it possible to have this MOD on just 1 category.
I have setup categories for different products and 1 which is the main, this is the "Shop by brand".
What would I need to change in this MOD to have it just for the shop by brand category so the customer is taken right to the selected brand page with subcategories?
Thanks for any input.

B00MER 01-23-2004 11:32 PM

Inside the {section} loop use
Code:

{if $cateogires[cat_num].categoryid eq "55"}
Regular Cat
{else}
Dropdown Cat
{/if}

In order to have a single category branch in the dropdown you'll need to modify include/categories.php ;)


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

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