close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Use Form Variables to add to cart?

Thread begun 10/14/2009 10:43 pm by kevin347925 | Last modified 10/15/2009 12:41 pm by kevin347925 | 2920 views | 4 replies |

kevin347925

Use Form Variables to add to cart?

Instead of using a recordset to add data to my cart, I would like to use form variables from a previous page. However, I have been unsuccessful in attempting to bind the form variables to the shopping cart fields. Is there a way to do this?

Thanks,
Kevin

Sign in to reply to this post

Eric Mittman

You will need to have your form post to the page with the add to cart server behavior on it. In the add to cart server behavior in the bindings tab you need to associate each column in the cart with it's corresponding form element using the lightning bolt icons.

If the form is on another page you may need to go to bindings > Form Data on the page that form posts to and select the form page. This will put the bindings from that form into the bindings panel on this new page. You can then associate the columns of the cart with the new forms elements from the bindings panel.

Sign in to reply to this post

kevin347925

No Luck

Thanks for the reply, Erik.

I have followed your instructions, and when I look at the source code of my shopping cart page, no information shows up where the form binding data should be. I am sure that the form variables work on this page because the bindings show up in the text of the page.

Do I need to make sure that the add to cart behavior is set to static? I have tried it set both to static mode and "find in recordset" mode.

After I made the changes you mentioned, I end up with a "headers already sent error." The following is the problem code I think.

<?php
// WA eCart AddToCart
if (isset($_POST["CommonScentsCart_1_ATC"]) || isset($_POST["CommonScentsCart_1_ATC_x"])) {
$ATC_itemID = $_POST["CommonScentsCart_1_ID_Add"];
$ATC_AddIfIn = 0;
$ATC_RedirectAfter = "cart.php";
$ATC_RedirectIfIn = "";
$ATC_itemName = "".$_POST['Message'] ."";// column binding
$ATC_itemDescription = "";// column binding
$ATC_itemWeight = floatval("1");// column binding
$ATC_itemQuantity = "".$_POST["CommonScentsCart_1_Quantity_Add"] ."";// column binding
$ATC_itemPrice = floatval("".$_POST['Price'] ."");// column binding
$ATC_itemItemtype = "SN";// column binding
$ATC_itemCDshippingbase = "0";// column binding
$ATC_itemSNshippingbase = "0";// column binding
$ATC_itemCDshippingvar = "0";// column binding
$ATC_itemSNshippingvar = "0";// column binding
$ATC_itemCDnetweight = floatval("0");// column binding
$ATC_itemCDfragrance = "";// column binding
$ATC_itemSNlength = "".$_POST['Length'] ."";// column binding
$ATC_itemSNframecolor = "".$_POST['FrameColor'] ."";// column binding
$ATC_itemSNfacecolor = "".$_POST['FaceColor'] ."";// column binding
$ATC_itemSNfontcolor = "".$_POST['FontColor'] ."";// column binding
$ATC_itemSNmessage = "";// column binding
$ATC_itemImage = "";// column binding
$ATC_itemDate = "";// column binding
$ATC_itemBackorderNote = "";// column binding
$ATC_itemBackorder = "";// column binding
$ATC_itemCDprice = "";// column binding
$ATC_itemSNprice = "".$_POST['Price'] ."";// column binding
$ATC_itemQuantity = floatval($ATC_itemQuantity);
if (is_numeric($ATC_itemQuantity) && $ATC_itemQuantity != 0) {
$CommonScentsCart->AddToCart($ATC_AddIfIn, $ATC_RedirectIfIn, $ATC_itemID, $ATC_itemName, $ATC_itemDescription, $ATC_itemWeight, $ATC_itemQuantity, $ATC_itemPrice, $ATC_itemItemtype, $ATC_itemCDshippingbase, $ATC_itemSNshippingbase, $ATC_itemCDshippingvar, $ATC_itemSNshippingvar, $ATC_itemCDnetweight, $ATC_itemCDfragrance, $ATC_itemSNlength, $ATC_itemSNframecolor, $ATC_itemSNfacecolor, $ATC_itemSNfontcolor, $ATC_itemSNmessage, $ATC_itemImage, $ATC_itemDate, $ATC_itemBackorderNote, $ATC_itemBackorder, $ATC_itemCDprice, $ATC_itemSNprice);
if ($ATC_RedirectAfter != "" && $CommonScentsCart->redirStr == "") {
$CommonScentsCart->redirStr = $ATC_RedirectAfter;
}
if (isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING'] != "") {
$_SESSION['WAEC_ContinueRedirect'] = $_SERVER['PHP_SELF']."?".$_SERVER['QUERY_STRING'];
}
else {
$_SESSION['WAEC_ContinueRedirect'] = $_SERVER['PHP_SELF'];
}
}
}
?>
<?php
// WA eCart Redirect
if ($CommonScentsCart->redirStr != "") {
header("Location: ".$CommonScentsCart->redirStr);
}
?>


Thank you for you patience. I am still learning the ropes.

Kevin

Sign in to reply to this post

kevin347925

Progress

I realized that I forgot to make the bindings updatable and hidden. That answers question 1, but but has raised a new issue.

The following shows up in my browser in place of the "add to cart" button:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

Sign in to reply to this post

kevin347925

Got it.

I figured it out. Thanks.

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