Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Selected dropdown search box !


vanvoquan

Recommended Posts

Posted

I have search through the forum and contributions but I never found anything that cool like this reselected dropdown search box.Check out the Shop By Vehicle box

If you select the "categories", it will automatically give you a list of the subcategories under that categories, and If you click on one of the subcategories it will automatically take you to the page that list all the sub-subcategories. I know we can do that by using the code from the categories.php file but i still can't figure this out. If anyone experienced with php and mysql please help us make this great contribution so we can make Oscommerce the best it can be.

 

Any suggestion and help wil be appricitate !

Vanvoquan

Posted

I almost there. Here is what I got so far :

 

// select database

mysql_select_db("test1")

or die("Couldn't select database.");

 

$query = mysql_query("SELECT categories_description.categories_name AS name, categories.categories_id AS make_id, categories.parent_id FROM categories_description, categories WHERE categories_description.categories_id = categories.categories_id AND categories.parent_id = '0'");

echo "<select name=make onchange='document.carform.submit();'>n";

if (!isset($make)) { echo "<option value=null selected>Choose a Make</option>n";}

while(list($name,$make_id) = mysql_fetch_row($query))

{

echo "<option value=$make_id";

if ($make_id == $make) { echo " selected"; }

echo ">$name</option>n";

}

echo "</select>n";

echo "</form>";

echo "<form name=subform action='index.php?cPath=<?php echo $categories_id ."_". $paren_id;?>' method=post>";

echo "<select name=model onchange='document.subform.submit();'>n";

if (!isset($make)) { echo "<option value=null selected>Choose Make First</option>n";}

else

{

$categories = mysql_query("SELECT categories_id FROM categories WHERE parent_id = '0'");

while($category = mysql_fetch_array($categories))

{

 

$result = mysql_query("SELECT categories_description.categories_name, categories.categories_id, categories.parent_id FROM categories_description, categories WHERE categories_description.categories_id = categories.categories_id AND categories.parent_id = '" . $category['categories_id'] ."'");

echo "<option value=null selected>Choose a Model</option>n";

while(list($model_id,$name) = mysql_fetch_row($result))

{

echo "<option value=$name";t

if ($model_id == $model) { echo " selected"; }

echo ">$model_id</option>n";

}

}

}

 

echo "</select>n";

echo" </form>";

?>

 

The problem is how to get to the proper page after I click the submit button. I noticed that when I click categories and then subcategories through my site menu, I got the URL like this : http://localhost/test/index.php?cPath=56_5...73c7d6dd9d56806

56 is my categories_id and 57 is my subcategories_id. They are connect together by an underline.

Is there anyway we can make the form action to something like this

<form action="index.php?cPath='$categories_id' ."_". '$subcategories_id'">

If anyone know how to make this happen, PLEASE please help.

Thank you so much.

Vanvoquan

Posted

I have just finished doing a very similar thing, but based on attributes as oppossed to categories.

 

If you want the url structure for the form action, why not just name one of the selects 'cPath' and the other '_'. then making sure you use get, you should be fine.

 

I appologise if you have already tried this, it just seems like an easy way foward! Also I see you are only including the 'choose make' option when nothing has been selected, this might get in the way if customers make the wrong selection, i would do a similar thing to the other box; just have the null option at the top and then then add selected to an option if its chosen. that way if nothing is chosen it will default to the null value as its at the top of the list.

 

Hope it goes well! :)

Posted

Thanks Beny for replying. Anything you said is what I want. Can you please help me with the cPath and the and the null value. I'm already spent hours to do the thing like you said but no hope. I'm kind of newbie to php. Can you please help me with the code. Thanks million times for your help.

Vavoquan

Posted
Thanks Beny for replying. Anything you said is what I want. Can you please help me with the cPath and the and the null value. I'm already spent hours to do the thing like you said but no hope. I'm kind of newbie to php. Can you please help me with the code. Thanks million times for your help.

Vavoquan

 

 

Hi Beny and Vavoquan,

 

I am also looking for this functionality. Could you please share it? thanks all.

 

Laurent

Posted

Guys,

 

I do not have the source code on me at the moment, but i will package it up tomorrow and upload it as a contribution.

 

here is a more concise guide to what i have written:

 

1. it is a block which appears in either the left or the right column, could be changed to be in the center.

 

2. you simply add deffinitions to an array at the top of the file which specifies the option id's and the corrisopnding names of what you want to appear in the list of drop-down boxes.

 

3. there are a few deffinitions lines that have to be changed in advanced_search_result.php

 

This will then allow a fully customiseable drop-down selection in the left or right column. I have two instances of these menus in one site. this is entirely based on the attributes system. you need to have access to php-my-admin to find out the option ids, but other than that is fairly straight foward.

 

Ben

Posted
Guys,

 

I do not have the source code on me at the moment, but i will package it up tomorrow and upload it as a contribution.

 

here is a more concise guide to what i have written:

 

1. it is a block which appears in either the left or the right column, could be changed to be in the center.

 

2. you simply add deffinitions to an array at the top of the file which specifies the option id's and the corrisopnding names of what you want to appear in the list of drop-down boxes.

 

3. there are a few deffinitions lines that have to be changed in advanced_search_result.php

 

This will then allow a fully customiseable drop-down selection in the left or right column. I have two instances of these menus in one site. this is entirely based on the attributes system. you need to have access to php-my-admin to find out the option ids, but other than that is fairly straight foward.

 

Ben

 

 

Hi Ben:

 

I have trouble to find a good search function with the ability to search on any field of the database. For instance, i use the add new product field contribution to add author, isbn, binding but the search provided by OsC cannot search it.

I use the ISBN-13 and product_model# has only 12 characters only. I changed the size of the field on product and product description table but still cannot import more than 12 characters. (error message appears).

 

Maybe someone has the solution. :D

 

So, i kind of stock with it.

 

regards,

 

Laurent

Posted

Hello all,

 

I have uploaded the the package to the contributions section, with the title 'attribute search drop down'. There are some instructions in the package and the two required files.

 

Laurent, I would say there are several ways to solve your problem. if you are looking for someone to implement one for you send me a private message and we can take it from there.

 

I hope the package meets all of your requirements!

 

Ben

  • 5 months later...
Posted

the idea is good , but nice feature would be that insteadding of hardcoding the attributes, a query would be used to look for all atributes used in the shop

strange that nobody updated your work

MS2

Archived

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

×
×
  • Create New...