Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Drop Down Boxes For Categories


Kuujiryo

Recommended Posts

Hi guys, I need a little help. My store will most likely have quite a lot of subcategories which, once shown in the Categories box, will stretch the box down a bit and could be annoying for visitors.

What I'm looking for is an add-on which will add two drop down boxes (those rectangular boxes with the arrow at the side like the currency one); one for categories and one for subcategories.

 

Here's how I want them to function:

 

The subcategory is initially blank (nothing listed), but once you select the category from the category drop down box, the subcategories for the selected category will show in the subcategories drop down box. Once the category and subcategory has been selected, you then click a button to go to the products listing.

 

Thanks for reading.

Link to comment
Share on other sites

Hi

 

That should not be tooo difficult.

All that you need to do is find the file which outputs the categories sidebar (i think its includes/boxes/categories.php)

In there should be the code that currently outputs the category text(and links). You just need to replace the echo within each loop with html to draw options boxes like so..

 

<option value="<?php echo category_id; ?>"><?php echo category_name; ?></option>

 

that will generate the items, and then you need to surround the loop with a form, input item and submit button so when selected, the visitor is acutally sent to the right page e.g.

 

<form method="_GET" action="./index.php">

 

<input type="select" id="cid" name="cid">

 

LOOP from above goes here....

 

</input>

</form>

 

 

 

As you are using the original code, the sub categories will automatically only show when their parent is selected, so the same looping system should work on those too. Although I cant remember off the top of my head whether you have to integrate its parent id as part of its option value. Cross that bridge when we get there I guess.

 

Hope that helps

always here to offer some useless advice....

Link to comment
Share on other sites

Hi, just posting to say I have no idea how to do this with gazza's help :(

 

It would be fantastic if anyone could spare the time to make the code for me... I don't know anyone with experience with OsCommerce so I'm in a desperate situation.

 

Thanks.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...