close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Multiple Add-To-Cart by Qty Field

Thread began 9/13/2009 6:55 pm by B Tonkin | Last modified 10/02/2009 11:53 am by Dave Buchholz | 4248 views | 10 replies |

B Tonkin

Multiple Add-To-Cart by Qty Field

I've been able to set up a multiple add-to-cart by adding to cart from a recordset lookup, using the check box method. Works, but I'm not happy with it as most people will be ordering with a quantity in mind, rather than in a yes or no sense. Adds an additional step that I want to get rid of ... but I'm stuck. Can't find anything in your support files or in the forums.

I can work out how to do a recordset lookup for all products (there's about 15), but I think my problem is getting the itemQuantity from the posted quantity values lined up with the product. I've tried a couple of variations, but right now the value field is called ATCQty_PRODUCTID (where PRODUCTID represents the ID # for that product).

On adding the item to the cart it calls on $_POST["ATCQty_x"] for the value, which I'm guessing is wrong. I've tried using ATCQty[PRODUCTID] and doing the lookup using that, but I think it's easier to add all products using a quantity of 0 unless it says otherwise ... or am I wrong there too?

Code as follows (just the add to cart part) ...

<?php
// WA eCart Get Info From RS
if (isset($_POST["AddToCartButton_x"]) && isset($totalRows_AddSelected) && $totalRows_AddSelected > 0) {
$Redirect_redirStr="";
do {
$shoppingCart_itemID = floatval("".$row_AddSelected['product_code'] ."");
$shoppingCart_itemName = "".$row_AddSelected['product_title'] ."";
$shoppingCart_itemDescription = "".$row_AddSelected['product_blurb'] ."";
$shoppingCart_itemWeight = floatval("".$row_AddSelected['product_single_weight'] ."");
$shoppingCart_itemQuantity = floatval("".((isset($_POST["ATCQty_x"]))?$_POST["ATCQty_x"]:"") ."");
$shoppingCart_itemPrice = floatval("".$row_AddSelected['product_single_price'] ."");
$shoppingCart_itemDiscExempt = floatval("".$row_AddSelected['product_discount_exempt'] ."");

$shoppingCart->AddToCart(1, "", $shoppingCart_itemID, $shoppingCart_itemName, $shoppingCart_itemDescription, $shoppingCart_itemWeight, $shoppingCart_itemQuantity, $shoppingCart_itemPrice, $shoppingCart_itemDiscExempt);
} while ($row_AddSelected = mysql_fetch_assoc($AddSelected));
if ($Redirect_redirStr != "") {
$shoppingCart->redirStr = $Redirect_redirStr;
}
mysql_data_seek($AddSelected, 0);
$row_AddSelected = mysql_fetch_assoc($AddSelected);
}
?>

... and the part of the form that adds the quantity ...

<input name="ATCQty_<?php echo $row_products['product_id']; ?>" type="text" id="ATCQty_<?php echo $row_products['product_id']; ?>" value="0" size="3" maxlength="2" />

... any help here would be most appreciated.

Sign in to reply to this post

Jason ByrnesWebAssist

Unfortunately, it is not possible to add the quantity in the multiple add to cart scenario. The customer will need to update the quantity once the item is added to the cart.

Sign in to reply to this post

B Tonkin

Elaborate

Are you able to elaborate why it can't be done, Jason? If you can add all items to the cart with quantities of 0 why couldn't the quantities be controlled with a quantity field? Just seems a bit strange that it can't be done.

Sign in to reply to this post

Jason ByrnesWebAssist

The checkbooks are being used to filter a recordset, then it is looping through the recordset to populate the cart contents. Once inside the recordset loop, it is not possible to match up the currant record with the correct quantity filed from the form collection.


The quantity being used is hard coded into tyhe add to cart behavior, it doesnt have to be 0, it can be what ever you select in the add to cart behavior for the default value of the quantity column.

Since the items are being added to the cart by looping through the recordset, not by looping through the form, it is impossible to link the currant record with the corresponding qty form element.

Sign in to reply to this post

carleneBeta Tester

Jason, Could you please tell your development team that this is something that is very badly needed in future versions of the program?? In fact - had I know in advance that this was impossible, I wouldn't have purchased eCart. This seems to be a major omission.

So what you're saying is to have the customer check off the items that they might want (and this is almost unacceptable from a usability POV) and then once the shopping cart comes up they put in quantities? That is so clunky and unprofessional from a webstore.

Is there no other work - around for this? Can you please try to inquire further?

Sign in to reply to this post

Jason ByrnesWebAssist

No, there is not another work around for this.

Sign in to reply to this post

Dave BuchholzBeta Tester

With a bit of lateral thinking it is possible to achieve multiple add to carts with quantities, this is one of the mods that I have done on a few sites Cotswold Kitchen & Bath, Murranji Photography and Red Dirt Photography
It involves setting up a unique session for each customers shopping session via php's session_id() then insert the selected products into a temporary table with Data Assist's Multiple Insert Behavior, create a recordset based on the session_id() to draw out any products selected, use eCarts Get Info from Recordset Behaviour to put the products into the cart from this recordset and then delete the contents of the temporary table before taking the customer to the view-cart page.

Sign in to reply to this post

carleneBeta Tester

Dave,
Thanks! Your sites look great BTW. I will try your fix. I usually customize all of the pages that use WebAssist. Did you need to custom hack any of the PHP on the pages - or did you just use the Data Assist and eCart php as is?

Thanks!

Carlene

Sign in to reply to this post

Dave BuchholzBeta Tester

Carlene,

Thanks, most of my eCart Sites are modified from the stock WA behaviours as I always seem to need extra functionality but in saying that eCart and DataAssist are great starting points for any dynamic site.

Sign in to reply to this post

vjc111265867

a little more detail

Dave , would you be able to give an example of the process you just described. I have a cart where I need to add to the cart all at once different sizes and quantities of the same item.

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