close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Passing option price to e-cart after option is selected from Menulist.

Thread began 4/11/2009 1:12 pm by Larsort2375074 | Last modified 4/12/2009 7:12 pm by Larsort2375074 | 1253 views | 1 replies |

Larsort2375074

Passing option price to e-cart after option is selected from Menulist.

I just can't seem to get my head wrapped around this one, so I'm hoping I can get some information to get me started down the right path.
I am implementing product options in a dynamic product details page. I have 2 tables to define the options, one is option categories, and the other is option values.
In the Option values table, I have fields for option ID, option name, option price and a textarea field for later use.
On the detail page I have successfully added a menulist to the add to cart button for the option and it displays the option names properly for each product based on the option category defined to the product. The option name passes to the cart page for the product OK.

What I can't seem to figure out is how to assign the option price to the proper ecart field, when the option is picked from the menu, so it can be passed to the cart page. I have the calculation set up to add the option price to the product price, but the option price is staying at 0. The option price field in the ecart object is set to currency.

more info... On my details page I have 2 recordsets. One is the WADAProducts recordset that was created when the details page was created. The second is one I added for the dynamic menulist for the option..

SELECT prod.ProdID, prod.ProdRuleGrpID1, oc1.OptCatID, oc1.OptCatName, ov1.OptValueID, ov1.OptValueName, ov1.OptValuePrice, ov1.OptValueTxt, ov1.OptOptCatID
FROM products AS prod LEFT JOIN optionvalues AS ov1 ON prod.ProdRuleGrpID1 = ov1.OptOptCatID LEFT JOIN optioncategory AS oc1 ON prod.ProdRuleGrpID1 = oc1.OptCatID
WHERE ProdName = ParamProdName OR ( -1= ParamProdName2 AND ProdName= ParamSessionProdName)

I know I left off the parameter statements, but the menulist is performing as I expect it to.
I am very new to PHP and MYSQL, and I may be handling this in the wrong way. I have followed the ecommerce help that was in the help documentation, but it didn't touch on including price changes with the options.
Thanks for the help.

Sign in to reply to this post

Larsort2375074

Nevermind, I was able to solve my problem.

I created another recordset on the optionvalues table, and filtered on OptValueName = $_POST['name-of-select-field'], Then I moved the query into the add to cart function just after the <?php tag. I added $row_optPrice1['OptValuePrice'] into the ecart object field for Option1Price. Now when I press the add to cart button, it creates the query for the option price based on the value selected and populates the Option1Price field in the ecart object. Everything passes to the cart just fine now, and the final price shows the added price from the option.

Sign in to reply to this post

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...