close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Product Options - Metal/Color and Size

Thread began 9/19/2011 11:39 am by Patbyrne322425963 | Last modified 11/01/2011 6:50 am by Jason Byrnes | 4958 views | 31 replies |

Patbyrne322425963

Product Options - Metal/Color and Size

Alright, so I am creating a wholesale jewelry site and would like to have 2 options - size (different prices by size) and metal (gold/silver, with price difference).

The thing is, not all jewelry items are available in both gold and silver and not all items have a size option (only rings). Also, not every ring is available in every size.

So the way I set it up was I added a column in my products table for ProductCategory, which contains the first few numbers of the SKU.

I would like the product options to show size options for rings (ProductCategory=400) and metal options for ProductCategory=635. I have my tables set up like this:

optiongroups:
OptionGroupID | OptionGroupName
1 | Size
2 | Metal

options:
OptionID | OptionGroupID | OptionName
1 | 2 | Sterling Silver
2 | 2 | 14K Gold
3 | 1 | size 3
4 | 1 | size 4
5 | 1 | size 5

productoptions:
ProductOptionID | ProductCategory | ProductID | OptionID | OptionGroupID | OptionPriceIncrement
1 | 635 | - | 1 | 2 | -
2 | 635 | - | 2 | 2 | 2.00
3 | 400 | 400101 | 3 | 1 | -
4 | 400 | 400101 | 4 | 1 | 0.50
5 | 400 | 400101 | 5 | 1 | 1.00

products:
ProductCategory | ProductID (primary key) | ...Price, Desc, etc
635 | 635101 | ...
635 | 635102 | ...
400 | 400101 | ...
400 | 400102 | ...

Now, starting with metal (because I gave up on size to focus on this part), I have this in the SQL for rsMetal:

SELECT productoptions.OptionPriceincrement, productoptions.ProductOptionID, options.OptionName, options.OptionGroupID, optiongroups.OptionGroupName
FROM options INNER JOIN productoptions ON options.OptionID = productoptions.OptionID INNER JOIN optiongroups ON options.OptionGroupID = optiongroups.OptionGroupID
WHERE optiongroups.OptionGroupName = 'Metal' AND productoptions.ProductCategory = paramItem

With ParamItem default value: -1, runtime value: $row_WADAproducts['ProductCategory']

I'm following the rest of the directions exactly from the Product Options how-to for the dynamic menu and all I'm getting is a blank menu with the heading "Choose a metal." I don't know what I'm doing wrong.

Sign in to reply to this post

Jason ByrnesWebAssist

when dealing with options, you should only have the Add to cart button on the Product Details page.

To load the product detail page, the product ID will be passed as a querystring variable.


the option recordset should filter the productoptions.ProductID column on the passed Querystring, for example if the querysting is named productID:
productsDetail.php?productID=12

the where clause should be:
WHERE optiongroups.OptionGroupName = 'Metal' AND productoptions.ProductID = paramItem


and the run time value for the parameter will be:
$_GET['productID']

Sign in to reply to this post

Patbyrne322425963

I've only got the add to cart button on my product details page. I have it linked from another page as productdetails.php?ProductID=<?php echo $row_products['ProductID']; ?>

On productdetails.php on the products recordset, I have the clause: WHERE ProductID = colname

and runtime value for colname: $_GET['ProductID']

Do I need to create a second copy of the item page for items that have product options and include those clauses instead?

Sign in to reply to this post

Patbyrne322425963

Wait, that's what I have now, only I have it under rsMetal (as posted above). So I changed the runtime value for the paramItem to match what you posted and I got the same result. Do I have those clauses on the wrong recordset?

Sign in to reply to this post

Jason ByrnesWebAssist

you need to create the recordset to look up the options on the product detail page as:

name: reMetalOptions:
SELECT productoptions.OptionPriceincrement, productoptions.ProductOptionID, options.OptionName, options.OptionGroupID, optiongroups.OptionGroupName
FROM options INNER JOIN productoptions ON options.OptionID = productoptions.OptionID INNER JOIN optiongroups ON options.OptionGroupID = optiongroups.OptionGroupID
WHERE optiongroups.OptionGroupName = 'Metal' AND productoptions.ProductID = paramItem

then create the parameter paramItem using the run time variable:
$_GET['ProductID']

Sign in to reply to this post

Patbyrne322425963

Still nothing in the drop down menu.

Sign in to reply to this post

Jason ByrnesWebAssist

send a copy of the page in a zip archive please and a link where i can see this in the browser.

Sign in to reply to this post

Patbyrne322425963

itempage.php?ProductID=635001

Attached Files
itempage.php.zip
Sign in to reply to this post

Jason ByrnesWebAssist

in the rsMetal recordset, you are suing the productoptions.ProductCategory column in the where clause:

WHERE optiongroups.OptionGroupName = 'Metal' AND productoptions.ProductCategory = paramItem


you need to use the productID column:
WHERE optiongroups.OptionGroupName = 'Metal' AND productoptions.ProductID = paramItem

Sign in to reply to this post

Patbyrne322425963

Thing is, on the 635 group, I want everything with the ProductCategory 635 to have the metal option. I have hundreds of products with that product category and don't want to enter them all again separately in a second table. With sizes, because every item isn't available in every size, I understand that I will have to do them individually. The reason I created the ProductCategory column was so I could apply the metal option to an entire grouping of products at once.

edit: Note that the 635 ProductCategory doesn't have a number in the ProductID column (first post).

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...