Saturday, 12 March 2011

View products by category/ price/ colour etc working!

Today I have been working on the 'view by' pages. I wanted to create these pages so the users can search for products that are in a certain category, price range or colour. Example: If the user wanted to look at all the Jewellery on the website they would go to 'view gifts by category' on the main navigation and it would take them to the page below:

They would then click on the 'Jewellery' link and it would take them to a page displaying all the products within the 'Jewellery' category on the website.

This would work the same for all the categories, price ranges and colours.

The code I used to make these pages function this way is:

The bit I change for the other categories e.g. for the page that displays all the bags and purses, I would change the
$result = mysql_query ("SELECT * from shopproducts WHERE productCategory = 'Jewellery'");

to

$result = mysql_query ("SELECT * from shopproducts WHERE productCategory = 'Bags and Purses'");

No comments:

Post a Comment