close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

DoubleCount error - we think at PayPal

Thread began 2/27/2020 9:51 am by Nathon Jones Web Design | Last modified 2/28/2020 9:20 am by Nathon Jones Web Design | 3501 views | 8 replies

Nathon Jones Web Design

We only have two add to cart buttons on the website and we are only passing a single 'product' but are running into all sorts of problems.

This is one of the add to cart buttons, which is basically for new orders on the site....

<form name="eCartSMC_1_ATC_<?php echo($rsEDITFORM->getColumnVal("SMCformID")); ?>" method="POST" action="<?php echo $_SERVER["PHP_SELF"]; ?><?php echo (isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] != "")?"?".htmlentities($_SERVER["QUERY_STRING"]):""; ?>">
<input type="hidden" name="eCartSMC_1_ID_Add" value="<?php echo($rsEDITFORM->getColumnVal("SMCformID")); ?>">
<button type="submit" class="btn btn-info" name="eCartSMC_1_ATC" id="eCartSMC_1_ATC">Add to Basket <i class="fal fa-shopping-cart"></i></button>
</form>



And this is it's corresponding behaviour on the same page...

<?php
// WA eCart AddToCart
if (isset($_POST["eCartSMC_1_ATC"]) || isset($_POST["eCartSMC_1_ATC_x"])) {
$ATC_itemID = $_POST["eCartSMC_1_ID_Add"];
$ATC_AddIfIn = 4;
$ATC_RedirectAfter = "health-screening-form-checkout.php";
$ATC_RedirectIfIn = "";
$ATC_itemName = "Sports Medical Certificate Form Ref. ".$_SESSION['NEWformID'] ."";// column binding
$ATC_itemDescription = "Order Ref. SMC".$_SESSION['eCartSMC_OrderID'] ."";// column binding
$ATC_itemThumbnail = "";// column binding
$ATC_itemWeight = floatval("0");// column binding
$ATC_itemQuantity = floatval("1");// column binding
$ATC_itemPrice = floatval("65");// column binding
$ATC_itemQuantity = floatval($ATC_itemQuantity);
if (is_numeric($ATC_itemQuantity) && $ATC_itemQuantity != 0) {
$eCartSMC->AddToCart($ATC_AddIfIn, $ATC_RedirectIfIn, $ATC_itemID, $ATC_itemName, $ATC_itemDescription, $ATC_itemThumbnail, $ATC_itemWeight, $ATC_itemQuantity, $ATC_itemPrice);
if ($ATC_RedirectAfter != "" && $eCartSMC->redirStr == "") {
$eCartSMC->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'];
}
}
}
?>



This is the other, which appears for orders that customers are returning to (that they haven't yet paid for)....

<form name="eCartSMC_1_ATC_<?php echo($rsEDITFORM->getColumnVal("SMCformID")); ?>" method="POST" action="<?php echo $_SERVER["PHP_SELF"]; ?><?php echo (isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] != "")?"?".htmlentities($_SERVER["QUERY_STRING"]):""; ?>">
<input type="hidden" name="eCartSMC_1_ID_Add" value="<?php echo($rsEDITFORM->getColumnVal("SMCformID")); ?>">
<button type="submit" class="btn btn-info float-right" name="eCartSMC_1_ATC" id="eCartSMC_1_ATC">Proceed to Payment <i class="fal fa-shopping-cart"></i></button>
</form>


And it's corresponding server behaviour...

<?php
// WA eCart AddToCart
if (isset($_POST["eCartSMC_1_ATC"]) || isset($_POST["eCartSMC_1_ATC_x"])) {
$ATC_itemID = $_SESSION["eCartSMC_OrderID"];
$ATC_AddIfIn = 4;
$ATC_RedirectAfter = "../health-screening-form-checkout.php";
$ATC_RedirectIfIn = "";
$ATC_itemName = "Sports Medical Certificate Form Ref ". $rsEDITFORM->getColumnVal("SMCformID") ."";// column binding
$ATC_itemDescription = "Order Ref SMC". $rsEDITFORM->getColumnVal("SMCorderID") ."";// column binding
$ATC_itemThumbnail = "";// column binding
$ATC_itemWeight = floatval("0");// column binding
$ATC_itemQuantity = floatval("1");// column binding
$ATC_itemPrice = floatval("65");// column binding
$ATC_itemQuantity = floatval($ATC_itemQuantity);
if (is_numeric($ATC_itemQuantity) && $ATC_itemQuantity != 0) {
$eCartSMC->AddToCart($ATC_AddIfIn, $ATC_RedirectIfIn, $ATC_itemID, $ATC_itemName, $ATC_itemDescription, $ATC_itemThumbnail, $ATC_itemWeight, $ATC_itemQuantity, $ATC_itemPrice);
if ($ATC_RedirectAfter != "" && $eCartSMC->redirStr == "") {
$eCartSMC->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'];
}
}
}
?>


Is the $ATC_itemID the invoice ID that PayPal uses or is this the product ID?

I believe that it's the later form that's causing the problems because people are arriving at PayPal but are sometimes dumped out at that stage.
Therefore, it could be that $_SESSION["eCartSMC_OrderID"]; is wiped and PayPal has nothing to work with?

I would appreciate clarification on $ATC_itemID as if that's the invoice ID then I should probably look to make that:
$ATC_itemID = ". $rsEDITFORM->getColumnVal("SMCorderID") .";

Thank you.
NJ

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