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 ;)

natalieb 02-01-2004 10:20 AM

Busy upgrading to 3.5.3, but thanks.
Will test it when I am done :)

anandat 02-21-2004 03:54 AM

Quote:

Originally Posted by amgdg
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


Strangely this code perfectly on my local pc but when I upload to server
It doesn't select the "curent category" !!! what could be the wrong ?

here is my 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}" {if $current_category eq $categories[cat_num]}selected{/if}>{$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}


anandat 03-02-2004 04:01 AM

^BUMP^
Any one ?

B00MER 03-02-2004 11:25 PM

Code:

<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}" {if $cat eq $categories[cat_num].categoryid}selected{/if}>{$categories[cat_num].category_name|escape}</option>
{/section}
</select>
</form>


anandat 03-03-2004 12:34 AM

Thanks a lot Boomer...it's working now :)

Here is my code of categories.tpl if one want to use it.
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}" {if $cat eq $categories[cat_num].categoryid}selected{/if}>{$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}


Just one more question this mode is not useful in html catalog as it doesn't generate the HTML links for categories in catalog pages & still generate the .php pages links :( .....is there any way to correct this bug ?

longhorn180 08-27-2004 03:51 PM

I'm using this mod on 3.5.11 and it works perfectly, but I'm developing a store using 4.0.3 and have been unable to get it to work successfully. Does anyone know how to get this working with 4.x.x series because this is a great mod and I would love to continue using it.

plh 09-14-2004 02:08 AM

This mod is working fine. Thanks to Boomer.

I am wondering what it would take to build it to the next level and include the subcategories indented under each of the main categories and separate each main category with a blank line (to make reading this list a little easier on the eyes.)

I am not sure I understand the reason for the HTML build ?? If someone can explain.

Thanks again to "Master" Boomer for its continuing effort in helping others build a better x-cart.

Philippe

Allan Martel 09-16-2004 08:11 AM

When trying this in v4.0.4, the drop down box shows up, but appears to be empty. However, you can click on one of the "BlankSpaces" and you will be taken to the catagory.

Just fails to actually print the catagory name

Any suggestions?

Heres the code I am using:

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}" {if $cat eq $categories[cat_num].categoryid}selected{/if}>{$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}


sabrina 10-10-2004 04:36 PM

<form name="form_cat" method="get" action="home.php">
<td>
<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}" {if $cat eq $categories[cat_num].categoryid}selected{/if}>{$categories[cat_num].category}</option>
{/section}
</select>
</td>
</form>

PhilJ 10-29-2004 10:52 AM

Category Search Drop Down (v4.x)

Code:

<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="{$categories[cat_num].categoryid}">{$categories[cat_num].category}</option>
      {/section}
    </select>
</form>


Manufacturer Search Drop Down

Code:

<form name="form_manuf" method="get" action="manufacturers.php">
    <select name="manufacturerid" onChange="document.form_manuf.submit()">
      <option value="0" selected>Search By Manufacturer</option>
      {section name=mid loop=$manufacturers_menu}
      <option value="{$manufacturers_menu[mid].manufacturerid}">{$manufacturers_menu[mid].manufacturer}</option>
      {/section}
    </select>
</form>


Static Pages Drop Down

Code:

<form name="form_info" method="get" action="pages.php">
    <select name="pageid" onChange="document.form_info.submit()">
      <option value="0" selected>Help</option>
                {section name=pg loop=$pages_menu}
      <option value="{$pages_menu[pg].pageid}">{$pages_menu[pg].title}</option>
                {/section}
    </select>
</form>


:wink:

shwekhaw 11-26-2004 04:57 PM

I really like this dropdown catagory boxes. Ideal navigation menu for the site I am working on. The site will have main catagories and subcatagories as follows:
> Manufacturer names (HP, Canon, etc...) as main catagories.
> Product Model as sub catagories

But I want to automate a little. When user choose a main catagory, in this case manufacturer name, I like second dropdown box shows only sub catagories under that manufacturer. I know how to do in regular html coding but I have no experience in php coding or whatever X-cart uses.

I tried PhilJ's code and it works for one drop down box. But I need atleast two level dropdown and possible three level in future.

S-H-W-E-K-H-A-W

Ryano 01-07-2005 12:21 PM

Anyone have any samples of what this looks like? I am using version 3.58 and I have many categories listed on the side. However, I would like only some of them to be put in a drop down box above them so that my site will look cleaner and not have so many categories taking up space. I am guessing that if I do this mod, that ALL of my categories will end up in the drop down box? Anyone have a code for me to only have some of the cats in a dropdown? Thanks a lot!

Khar 02-06-2005 03:59 PM

Quote:

Originally Posted by PhilJ
Category Search Drop Down (v4.x)

Code:

<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="{$categories[cat_num].categoryid}">{$categories[cat_num].category}</option>
      {/section}
    </select>
</form>


Manufacturer Search Drop Down

Code:

<form name="form_manuf" method="get" action="manufacturers.php">
    <select name="manufacturerid" onChange="document.form_manuf.submit()">
      <option value="0" selected>Search By Manufacturer</option>
      {section name=mid loop=$manufacturers_menu}
      <option value="{$manufacturers_menu[mid].manufacturerid}">{$manufacturers_menu[mid].manufacturer}</option>
      {/section}
    </select>
</form>


Static Pages Drop Down

Code:

<form name="form_info" method="get" action="pages.php">
    <select name="pageid" onChange="document.form_info.submit()">
      <option value="0" selected>Help</option>
                {section name=pg loop=$pages_menu}
      <option value="{$pages_menu[pg].pageid}">{$pages_menu[pg].title}</option>
                {/section}
    </select>
</form>


:wink:


I would love to use this mod for just my manufacturers menu. In what .tpl would I place this code

PhilJ 02-07-2005 02:52 AM

Quote:

In what .tpl would I place this code

skin1/customer/home.tpl

copy the code to a new file - skin1/customer/manufacturers.tpl

replace the code

Code:

{ include file="modules/Manufacturers/menu_manufacturers.tpl" }

with

Code:

{ include file="customer/manufacturers.tpl" }

Khar 02-08-2005 01:42 PM

Thanks for getting back to me. I just got it working and it's just what I wanted.

Khar 03-06-2005 11:54 AM

I'm having an issue with the number of manufacturers that are sowing up in the drop down menu.
It will only display ten manufacturers. If I deactivate one in the admin area a new one shows up in its place on the customer front end menu. I have twelve manufacturers in the admin area. I only get ten in the customer front end.

I not sure what is going on.

x-online 03-06-2005 04:40 PM

Quote:

Originally Posted by PhilJ
Quote:

In what .tpl would I place this code
skin1/customer/home.tpl
copy the code to a new file - skin1/customer/manufacturers.tpl
replace the code
Code:

{ include file="modules/Manufacturers/menu_manufacturers.tpl" }
with
Code:

{ include file="customer/manufacturers.tpl" }


*** Just wanted to alter PhilJ's words abit but with alot appreciated to you for creating this code tho!! Thanks! ***

I was abit confused when i read his comment.

For manufacturers only!!!
Basicly, you created "manufacturers.tpl" and drop it in "skin1/customer/"
Copy this code below in manufacturers.tpl:
Code:

<form name="form_manuf" method="get" action="manufacturers.php">
    <select name="manufacturerid" onChange="document.form_manuf.submit()">
      <option value="0" selected>Search By Manufacturer</option>
      {section name=mid loop=$manufacturers_menu}
      <option value="{$manufacturers_menu[mid].manufacturerid}">{$manufacturers_menu[mid].manufacturer}</option>
      {/section}
    </select>
</form>

In "skin1/customer/home.tpl":
find:
Code:

{ include file="modules/Manufacturers/menu_manufacturers.tpl" }

replace with
Code:

{ include file="customer/manufacturers.tpl" }

reload your homepage!!! Tada!!

=D>=D>=D>=D>=D>=D>=D>=D> for PhilJ!!

Khar 03-06-2005 05:13 PM

x-online I believe you have misunderstood me. I do however appreciate your help.

The mod works. I was able to to get the mod up and running. The problem is it only displays the first ten manufacturers in the drop down and I have double that.


Thank You
x-online and of-course PhilJ

x-online 03-06-2005 05:52 PM

Khar,

I honestly didn't ready your post before about limited up to 10 manufacturers. Also, i only focused on the codes that philJ was given.

Wheni first read his commend i was hum...
open home.tpl... copied everything to manufactorys.tpl??!!??
then what?.. replaced code in manufactory.tpl??!!??

I just clear things up.. just incase if someone else stupid like me when first read it :P

Anyhow, back to your problem.. i have seen the solution somewhere before int he forum..
Please do a search i am pretty sure that i have seen it before.

Will keep you up to date if i came across again.

Khar 03-07-2005 01:06 PM

thanks I'll start searching

mrbiggles 03-08-2005 05:01 AM

Hello
I think if you go to MODULE SETTINGS/manufacturer list limit in the admin area you can increase the limit from 10 to whatever number you want.
Regards Adam

Khar 03-08-2005 06:46 AM

Yes mrbiggles you are right . That was simple enough.
That should of hit me. It's amazing how something so simple can slip by.



THANK YOU THANK YOU.

DVDirect 05-03-2005 09:30 PM

Quote:

Originally Posted by mrbiggles
Hello
I think if you go to MODULE SETTINGS/manufacturer list limit in the admin area you can increase the limit from 10 to whatever number you want.
Regards Adam


Nice to finally find this answer!!!

_now setting it to a really high number_ :)

here is my version of the Drop Down Menu for Manufacturers:

Code:

{* $Id: menu_manufacturers.tpl,v 1.4 2004/06/22 05:38:52 max Exp $ *}
{if $manufacturers_menu ne ''}
{capture name=menu}
<FORM NAME="formManufacturer">
<SELECT NAME="listManufacturer" onchange="window.location=this.options[selectedIndex].value">
<OPTION VALUE="">- select -</OPTION>
{section name=mid loop=$manufacturers_menu}
<OPTION VALUE="manufacturers.php?manufacturerid={$manufacturers_menu[mid].manufacturerid}"><font  class="VertMenuItems">{$manufacturers_menu[mid].manufacturer}</font></OPTION>
{/section}
</SELECT>
</FORM>
{if $show_other_manufacturers}


{$lng.lbl_other_manufacturers}

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


{/if}


Under v4.0.12... goto: Web Admin -> Modules -> General Settings -> Modules Options... then edit value for "Manufacturers list limit" to something high obsurd like 250.

Doing so will allow a complete list of Manufacturers to be shown.
If you go over this "Manufacturer List Limit" value... then the "Other Manufacturers" link will show up... just up the "Manufacturers list limit" value higher again!

Marko

mpcommercial 05-13-2005 06:54 AM

Hello:

This is the most useful topic! I have another twist to this drop down menu business:

I need a drop drown menu for the subcategories of just one of my categories: Number 5. In on sentence, the form will have all the subcategories of category 5 as options.

How would I code this?

jignacio 05-28-2005 06:24 AM

This code is great.
Thanks to all the contributors. :D

shealey 05-31-2005 05:21 AM

Moving dropdown box into manufacturers box
 
I have applied the above code to create a drop down box for manufacturers. However, I cannot seem to get the dropdown box to move inside the menu box with label Manufacturers, and to be the same width as the box. Can anyone please help me with achieving this? I have searched and searched with no results. I created a file called manufacturers.tpl and called this in customer/home.tpl as below.
Code:

<TD width="150" valign="top">
{if $categories ne "" and ($active_modules.Fancy_Categories ne "" or $config.General.root_categories eq "Y" or $subcategories ne "")}
{ include file="customer/categories.tpl" }


{/if}
{if $active_modules.Bestsellers ne "" and $config.Modules.bestsellers_menu eq "Y"}
{ include file="modules/Bestsellers/menu_bestsellers.tpl" }
{/if}
{if $active_modules.Manufacturers ne "" and $config.Modules.manufacturers_menu eq "Y"}


{ include file="customer/manufacturers.tpl" }

{/if}

this is just a portion of it as its quite long. If anyone could please help me it would really appreciated!! Thanks!

shealey 05-31-2005 05:21 AM

Moving dropdown box into manufacturers box
 
I have applied the above code to create a drop down box for manufacturers. However, I cannot seem to get the dropdown box to move inside the menu box with label Manufacturers, and to be the same width as the box. Can anyone please help me with achieving this? I have searched and searched with no results. I created a file called manufacturers.tpl and called this in customer/home.tpl as below.
Code:

<TD width="150" valign="top">
{if $categories ne "" and ($active_modules.Fancy_Categories ne "" or $config.General.root_categories eq "Y" or $subcategories ne "")}
{ include file="customer/categories.tpl" }


{/if}
{if $active_modules.Bestsellers ne "" and $config.Modules.bestsellers_menu eq "Y"}
{ include file="modules/Bestsellers/menu_bestsellers.tpl" }
{/if}
{if $active_modules.Manufacturers ne "" and $config.Modules.manufacturers_menu eq "Y"}


{ include file="customer/manufacturers.tpl" }

{/if}

this is just a portion of it as its quite long. If anyone could please help me it would really appreciated!! Thanks!

Gio 06-06-2005 06:47 PM

Is there anyway to make the first MENU item on the dropdown menus not clickable?

and does anyone know why when the pages load the categories menu jumps up one place?

thanks

F5Performance 06-07-2005 03:07 PM

I love this mod. :D

One problem. I did the manufacturers and catagories but the catagories verticle box got wider by about 20 pixels. How do I adjust it back down to normal?

Tuner 06-14-2005 01:56 PM

style="width:70%"
or
style="width:120px"
Add or modify this in the <select> tag


All times are GMT -8. The time now is 06:35 AM.

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