close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Getting Add to Cart buttons, with Size Options, added to Products Page

Thread began 2/11/2016 3:56 pm by graham | Last modified 2/12/2016 8:40 pm by Ray Borduin | 320 views | 11 replies |

graham

Getting Add to Cart buttons, with Size Options, added to Products Page

Ray, I have a details page working properly, with all the bells and whistles, but would like to put Add to Cart buttons on the Products Page too ... no luck in this attempt. I just can't seem to get the recordsets correct.

Would you have a quick suggestion based on the attached? Thanks, Ray.

Sign in to reply to this post

Ray BorduinWebAssist

Is this the page that isn't working? What happens when you click the add to cart button. I need more information to know what I'm looking for.

Sign in to reply to this post

graham

Thanks for taking the time to look at my issue, Ray. Please disregard the previous attachment, it was one version of my attempt to resolve the issue myself. The attachments to this post are more appropriate for demonstrating my request (sorry for any confusion).

Currently, my site flows from a Product Categories page linked to Category Products page (attached example - Face) linked to individual Product details pages - pretty standard and easy to setup with the Webassist tutorials. What I would like to do is offer Add to Cart buttons on the Category Products page, allowing customers who want to skip the formality of clicking through to the details page(s) to add to cart. The newly attached FaceProductsMainPage displays all products in the recordset and their appropriate "OptionPriceIncrement=0" prices correctly, along with a functioning Quantity select. The Add to Cart button will correctly pass on the details to cart.php. However, in trying to create the dynamic size option select for each product, I added the rsSize and rsSizeLookup recordsets to the page, just as I have on my Product details page ... they do not appear on the attached FaceProductsMainPage.

Interestingly, if I alter the rsFaceproducts recordset to sort by DESC, instead of ASC as attached, then size selects do appear for each product (as you might guess, the lowest price product in Face has OptionPriceIncrement=0, while the highest price product has OptionPriceIncrement>0), but with incorrect data - each select initializes with the same OptionName as the first product, but with the correct OptionPriceIncrement=0 price for the specific product, while the dropdown for each product subtracts the first product's OptionPriceIncrement value from each of the other products' prices (not their specific OptionPriceIncrement value).

Regardless of the mixed up size select options, each quantity selected will continue to pass on to the cart page at the particular product's OptionPriceIncrement=0 price - completely ignoring the size options.

The updatePrice function that you helped me with awhile back, works for the first product, but not any others on the page.

Phew - hope you can work with the description - thanks for your thoughts.

Sign in to reply to this post

Ray BorduinWebAssist

Try moving the recordset code that returns the options into the repeat region so it can calculate for each row.

Essentially move lines 78-100 down below line 260.

Sign in to reply to this post

graham

Will do ... thanks, Ray.

UPDATE: <?php if ($totalRows_rsSize > 0) { // Show if recordset not empty ?> now precedes the recordset code and causes undefined variable error.

Sign in to reply to this post

Ray BorduinWebAssist

I think you moved the code down too far. When I said line 260 I meant line 260 before you cut the code above. I have a feeling you cut the code above and then went to line 260, which is now 22 lines lower since you cut the code above. You should have moved it just below these lines:

<div class="wrapper4">
<div class="row">
<?php do { ?>

Sign in to reply to this post

graham

And that is why I am not the President of Webassist ...

Select list populates correctly, but doesn't pass on correct price to cart ... the OptionPriceIncrement not applied. Dreamweaver CS6 in its crashing cycle (insert frown), but will investigate when back running.

and the updatePrice function only works on first product ... I take it I can move that as well?

Sign in to reply to this post

Ray BorduinWebAssist

We are probably going to have to do this in a premier support ticket. We are going to have to append the product ID to the price span and pass it into the update price function.

I made a mistake earlier... lines 88-100 needed to stay above... so move the code that begins with:
$paramOption_rsSizeLookup

and ends with:
$totalRows_rsSizeLookup = mysql_num_rows($rsSizeLookup);

back above the add to cart code on the top of the page with the other recordset. That will fix the add to cart price, but the display price will need some hand editing of the function and html.

I can try to walk you through it....

Where you have: <span id="newPrice">
Update it to: <span id="newPrice_<?php echo $row_rsFaceproducts['ProductID']; ?>">

Then where you have: onchange="updatePrice(this)"
Update it to: onchange="updatePrice(this,<?php echo $row_rsFaceproducts['ProductID']; ?>)"

Update: function updatePrice(list)
To: function updatePrice(list,id)

and update: document.getElementById("newPrice")
to: document.getElementById("newPrice_"+id)

Sign in to reply to this post

graham

Great support, Ray ... thanks as always.

I will work with what you have given me and contact you for a session if needed.

UPDATE: instructions worked perfectly - price amends to select option. However, the Add to Cart still won't pass the appropriate price to cart.

Sign in to reply to this post

Ray BorduinWebAssist

Please attach the current page so I can see what you have done.

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