Hello everyone. Just want to thank you for all the help you have
provided me in the past. I have a new task that I am trying to tackle,
but have come into a snag. I am building a customized shopping cart for
auto accessories. I have gotten about 90% of the cart worked out except
for the search feature. It is not a textual search. It is a vehicle
specific search.
When products are added to the cart, all the standard information is
there along with the vehicle make, model, and year. Example: Honda Civic
Si 1999. So this sounds like a peace of cake, as I would think. But in
the customized car industry, some products fit on multiple cars.
Example: DC Sport 4-1 Header AHS6607s fits all 92-93 Acura Integra's,
but also fits 94-99 Acura Integra's GSR Only.
When adding a product. I have this option that says, "Select Vehicle
Make, Model, and Year". Option for newly created product says, "Not
Selected". So they click to add and a window opens that allows you to
pick these choices from drop down menus. So for the above examples, you
would choose:
Make Drop Down: Acura
Model Drop Down: Integra
Year Text Field: 92-93
Then you click add vehicle to this product. That window stays open and
allows you to put another entry for the current product.
Make Drop Down: Acura
Model Drop Down: Integra
Year Text Field: 94-99
Once again, click add vehicle to this product.
So all this goes into a table that I called cart_search. Here is the
table layout for the cart_search table:
CREATE TABLE `cart_search` (
`pid` INT( 20 ) NOT NULL ,
`make` INT( 20 ) NOT NULL ,
`model` INT( 20 ) NOT NULL ,
`year` INT( 4 ) NOT NULL ,
PRIMARY KEY ( `id` ) 
For the above examples, the following rows would be added: (forgive my
crappy hand coded mysql output)
|    id    |    pid    |    make    |    model    |    year    |
     1        1234          1               1             1992
     2        1234          1               1             1993
     3        1234          1               1             1994
     4        1234          1               1             1995
     5        1234          1               1             1996
     6        1234          1               1             1997
     7        1234          1               1             1998
     8        1234          1               1             1999
in the cart_makes table the id that corresponds with Acura would be 1
in the cart_models table the id that corresponds with Integra would be 1
This is the reason for the 1's in the above simulated mysql output.
When that is all done, the window is closed and you are back at the add
product page. Click Add Product button at the bottom. A new row is
inserted to cart_products and the id row is retrieved with
mysql_insert_id(). Then all the cart_search rows that have 1243 as the
pid would be set to the respective product id that was retrieved by
So now you are a potential customer on the website wishing to search for
some products for your 93 acura integra. You go to the search page and
select Acura from drop down 1, page refresh's and the model dropdown is
populated with all Acura models, you select Integra as the model, Page
refreshes again populating the Year drop down with a list of years, You
choose 1993. Hit the search button and mysql does a query to the db as
$query=mysql_query("SELECT * FROM cart_search WHERE
make='{$_POST["make"]}' AND model='{$_POST["model"]}' AND
If the database was only populated with the entry's from above, It would
then return 1 result with a product id for that dc sports header we
So after all this, I supposed it works. But not like it should, Cause I
have no idea how to sort it, and to top it off, this just seems like a
really long process just to search a database for some products that
match specified make, model and years.
Incase you are wondering the search page would return about 3 columns.
Product Description, Catalog Number, and Price. It would be pulling all
this information out of the cart_products table by its product id number
that was returned by the mysql_query above.
So I am sorry if this seems like a novel to anyone. I just really
believe that there is an easier method to doing all of this. Any help
that someone can provide me would be greatly appreciated. I was looking
at a lot of websites on the net that sale car accessories and no one
really has a search that is this detailed. Most of them are static html
pages created by hand. This business has way to many products to make
hundreds of static pages like that.
So thank you in advanced, and I hope someone could lend a hand.
-Wendell Frohwein

Reply via email to