close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 or 2018 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

add cart product results checkbox

Thread began 5/27/2015 4:49 pm by John | Last modified 5/29/2015 3:53 pm by Ray Borduin | 939 views | 6 replies |

John

add cart product results checkbox

While I was able to add to cart on a product detail page successfully, I'm trying to figure out how to accomplish the same on a product results page as seen at http://citychemical.applinex.com/products_results.php?SearchKey=yellow&Search=Search where I have a checkbox column using the following code:

<input name="itemchecked[]" type="checkbox" id="itemchecked" value="<?php echo($row_WADAproductsearch['ProductID']); ?>">

I tried removing the form tag first but the lettering and the magnifying glass visual got weird. Any first/next/previous/last page buttons would use the onclick method anyways.

Ideally I would like to add to cart only the checked items.

Sign in to reply to this post

Ray BorduinWebAssist

You would add a recordset and filter it with the results from the checked items. Then use "add to cart from recordset" to add the items to the cart.

I think we have a tutorial on this in the tutorial library.

Sign in to reply to this post

John

While I somehow managed to get it so I could add to cart from either the results or details page based on one of the tutorials, at times by no particular sequence it sometimes does not add a checked item to the cart so I'm perplexed as to why this may be happening. Attached are the php pages for the search results, product detail & the cart pages as appended to our site template.

Sign in to reply to this post

Ray BorduinWebAssist

It looks like it would work to me. It should be consistent... maybe if you could narrow down exactly when it doesn't work then I would know what to look for or suggest how to debug it.

The first step is figuring when it happens so you can consistently reproduce the problem. That alone may lead you to the solution, but will at least lead me to the debugging options I might recommend.

Sign in to reply to this post

John

So far I found one instance I was able to replicate this problem starting with a clear cart.
1. go to temporary home page at http://citychemical.applinex.com/index.html
2. type in "winter" under "Search Here for The Chemicals You Need" then click the "GO" button
3. check the 3rd and 4th items indicated as "M1534-500ML, Methyl Salicylate" and "O114-100GM, Birch Oil"
4. click the "Add to Cart" button
5. on shopping cart page, I'm only seeing the 3rd item which is for "Methyl Salicylate" but not for "Birch Oil"

However when I click on the product detail for "Birch Oil" and click the "Add to cart" button from there then it will show up in the shopping cart page.

I'm curious as to how to debug this since I'm using Dreamweaver CS6 and while my skills in php are rather basic, I have debugging experience with visual studio and c# at least.

update: when I clear cart and select the 4th item alone, it works, but not when I select the 3rd and 4th item for this example. There are other examples where it does work when I have multiple checkmark selections though.

Here is a snippet from my products_results.php page that I'm trying to look further into:

<?php
// WA eCart Get Info From RS
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($totalRows_rsATC) && $totalRows_rsATC > 0) {
$Redirect_redirStr="cart.php";
do {
$eCart1_itemID = floatval("".$row_rsATC['ProductID'] ."");
$eCart1_itemName = "".$row_rsATC['Chem1'] ."";
$eCart1_itemDescription = "".$row_rsATC['CAS'] ."";
$eCart1_itemThumbnail = "".$row_rsATC['ProductID'] ."";
$eCart1_itemWeight = floatval("".$row_rsATC['Quantity'] ."");
$eCart1_itemQuantity = floatval("1");
$eCart1_itemPrice = floatval("".$row_rsATC['Price'] ."");

$eCart1->AddToCart(1, "", $eCart1_itemID, $eCart1_itemName, $eCart1_itemDescription, $eCart1_itemThumbnail, $eCart1_itemWeight, $eCart1_itemQuantity, $eCart1_itemPrice);
} while ($row_rsATC = mysql_fetch_assoc($rsATC));
if ($Redirect_redirStr != "") {
$eCart1->redirStr = $Redirect_redirStr;
}
mysql_data_seek($rsATC, 0);
$row_rsATC = mysql_fetch_assoc($rsATC);
}
?>

Sign in to reply to this post

Ray BorduinWebAssist

It looks like you have the ID column in the shopping cart set up to be a number, but you are actually entering a text value. That is causing the code to write:
$eCart1_itemID = floatval("".$row_rsATC['ProductID'] ."");

and it makes it so the itemID isn't recognized. If you update the cart object and specify the ID column as text and then re-apply the server behavior that line should update to:
$eCart1_itemID = "".$row_rsATC['ProductID'] ."";

and I believe that would work correctly.

Sign in to reply to this post

John

Thanks Ray, removing floatval function did the trick here.

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