Jump to content

Shopping cart project - product options


adrian28uk

Recommended Posts

I am creating my own shopping cart again, to see how much I know about PHP.

This is a project I come back to every 6 months or so, but when I start again I then realise what a task it is going to be.

 

One thing that is stopping me moving forward is the option to create options for the product and the best way of doing it. I think the way I am doing it is wrong.

 

I have shoes for sale

The user can select the size

 

I have T-Shirts for sale

The user can select the size

The user can also select the colour

 

Now I have sorted something out. I basically check to see if the product_options_group_id field in the products table has some id numbers.

 

In this example the T-Shirts product have the following numbers in the product_options_group_id field, The number 1,2, relate to the T-Shirt size and T-Shirt colour.

 

To display the drop down menus, if the numbers exist they are put into a foreach loop, and each number queries the product_options table and pulls out the information and creates an option value. The mysql query groups the product_options_group_id numbers together, which is how it creates the drop down menus underneath each product.

 

I hope the above makes some sort of sense. If you have created your own cart, what did you do for product options and what was the best way forward. I feel that I am going around this the wrong way, so your help would be appreciated.

Link to comment
https://forums.phpfreaks.com/topic/143251-shopping-cart-project-product-options/
Share on other sites

Archived

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

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.