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

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Cash On Delivery Option- Ecart

Thread began 6/21/2010 7:22 pm by Maplemac | Last modified 6/23/2010 9:35 am by Maplemac | 1110 views | 9 replies

Jason ByrnesWebAssist

if you are using Paypal Payments pro as the payment gateway, locate the Local Checkout code on the confirm page, it will look similar to:

php:
<?php

if (($_SERVER["REQUEST_METHOD"] == "POST") && (isset($_SERVER["HTTP_REFERER"]) && strpos(urldecode($_SERVER["HTTP_REFERER"]), urldecode($_SERVER["SERVER_NAME"].$_SERVER["PHP_SELF"])) > 0) && isset($_POST))  {
  
$PP_DirectPayment_required = array();
  
$PP_DirectPayment_required[0] = array();
  
$PP_DirectPayment_required[1] = array();
  
$PP_DirectPayment_itemized = array();
  
$PP_DirectPayment_itemized[0] = array();
  
$PP_DirectPayment_itemized[1] = array();
  
$PP_DirectPayment_optional = array();
  
$PP_DirectPayment_optional[0] = array();
  
$PP_DirectPayment_optional[1] = array();
  
$cartIndex 0;
  
$nextIndex 0;
  
$nextIndex count($PP_DirectPayment_required[0]);
  
$PP_DirectPayment_required[0][$nextIndex] = "Username";
  
$PP_DirectPayment_required[1][$nextIndex] = "".$WAGLOBAL_Paypal_User  ."";
  
$nextIndex count($PP_DirectPayment_required[0]);
  
$PP_DirectPayment_required[0][$nextIndex] = "Password";
  
$PP_DirectPayment_required[1][$nextIndex] = "".$WAGLOBAL_Paypal_Password  ."";
  
$nextIndex count($PP_DirectPayment_required[0]);
  
$PP_DirectPayment_required[0][$nextIndex] = "Signature";
  
$PP_DirectPayment_required[1][$nextIndex] = "".$WAGLOBAL_Paypal_Signature  ."";
  
$nextIndex count($PP_DirectPayment_required[0]);
  
$PP_DirectPayment_required[0][$nextIndex] = "PaymentAction";
  
$PP_DirectPayment_required[1][$nextIndex] = "Sale";
  
$nextIndex count($PP_DirectPayment_required[0]);
  
$PP_DirectPayment_required[0][$nextIndex] = "Currency";
  
$PP_DirectPayment_required[1][$nextIndex] = "USD";
  
$nextIndex count($PP_DirectPayment_required[0]);
  
$PP_DirectPayment_required[0][$nextIndex] = "IPAddress";
  
$PP_DirectPayment_required[1][$nextIndex] = "".$_SERVER["REMOTE_ADDR"]  ."";
  
$nextIndex count($PP_DirectPayment_required[0]);
  
$PP_DirectPayment_required[0][$nextIndex] = "CreditCardType";
  
$PP_DirectPayment_required[1][$nextIndex] = "".((isset($_POST["cc_type"]))?$_POST["cc_type"]:"")  ."";
  
$nextIndex count($PP_DirectPayment_required[0]);
  
$PP_DirectPayment_required[0][$nextIndex] = "CreditCardNumber";
  
$PP_DirectPayment_required[1][$nextIndex] = "".((isset($_POST["cc_number"]))?$_POST["cc_number"]:"")  ."";
  
$nextIndex count($PP_DirectPayment_required[0]);
  
$PP_DirectPayment_required[0][$nextIndex] = "ExpMonth";
  
$PP_DirectPayment_required[1][$nextIndex] = "".((isset($_POST["exp_month"]))?$_POST["exp_month"]:"")  ."";
  
$nextIndex count($PP_DirectPayment_required[0]);
  
$PP_DirectPayment_required[0][$nextIndex] = "ExpYear";
  
$PP_DirectPayment_required[1][$nextIndex] = "".((isset($_POST["exp_year"]))?$_POST["exp_year"]:"")  ."";
  
$nextIndex count($PP_DirectPayment_required[0]);
  
$PP_DirectPayment_required[0][$nextIndex] = "FirstName";
  
$PP_DirectPayment_required[1][$nextIndex] = "".((isset($_POST["firstname"]))?$_POST["firstname"]:"")  ."";
  
$nextIndex count($PP_DirectPayment_required[0]);
  
$PP_DirectPayment_required[0][$nextIndex] = "LastName";
  
$PP_DirectPayment_required[1][$nextIndex] = "".((isset($_POST["lastname"]))?$_POST["lastname"]:"")  ."";
  
$nextIndex count($PP_DirectPayment_required[0]);
  
$PP_DirectPayment_required[0][$nextIndex] = "Street1";
  
$PP_DirectPayment_required[1][$nextIndex] = "".((isset($_POST["street1"]))?$_POST["street1"]:"")  ."";
  
$nextIndex count($PP_DirectPayment_required[0]);
  
$PP_DirectPayment_required[0][$nextIndex] = "CityName";
  
$PP_DirectPayment_required[1][$nextIndex] = "".((isset($_POST["city"]))?$_POST["city"]:"")  ."";
  
$nextIndex count($PP_DirectPayment_required[0]);
  
$PP_DirectPayment_required[0][$nextIndex] = "StateOrProvince";
  
$PP_DirectPayment_required[1][$nextIndex] = "".((isset($_POST["state_province"]))?$_POST["state_province"]:"")  ."";
  
$nextIndex count($PP_DirectPayment_required[0]);
  
$PP_DirectPayment_required[0][$nextIndex] = "PostalCode";
  
$PP_DirectPayment_required[1][$nextIndex] = "".((isset($_POST["postcode"]))?$_POST["postcode"]:"")  ."";
  
$nextIndex count($PP_DirectPayment_required[0]);
  
$PP_DirectPayment_required[0][$nextIndex] = "Country";
  
$PP_DirectPayment_required[1][$nextIndex] = "".((isset($_POST["country"]))?$_POST["country"]:"")  ."";
  
$nextIndex count($PP_DirectPayment_required[0]);
  
$PP_DirectPayment_required[0][$nextIndex] = "UseSandbox";
  
$PP_DirectPayment_required[1][$nextIndex] = "".($WAGLOBAL_Paypal_Sandbox == 1)?"true":"false"  ."";

  
$PP_DirectPayment_itemized[0][0] = "OrderTotal";
  
$PP_DirectPayment_itemized[1][0] = "".$WA_Store_Cart->GrandTotal()  ."";
  
$PP_DirectPayment_itemized[0][1] = "OrderDescription";
  
$PP_DirectPayment_itemized[1][1] = "";
  while ( !
$WA_Store_Cart->EOF() )      {
  
$nextIndex count($PP_DirectPayment_itemized[0]);
  
$PP_DirectPayment_itemized[0][$nextIndex] = "Amount" strval($cartIndex+1) . "";
  
$PP_DirectPayment_itemized[1][$nextIndex] = "".$WA_Store_Cart->DisplayInfo("Price")  ."";
  
$nextIndex count($PP_DirectPayment_itemized[0]);
  
$PP_DirectPayment_itemized[0][$nextIndex] = "Name" strval($cartIndex+1) . "";
  
$PP_DirectPayment_itemized[1][$nextIndex] = "".$WA_Store_Cart->DisplayInfo("Name")  ."";
  
$nextIndex count($PP_DirectPayment_itemized[0]);
  
$PP_DirectPayment_itemized[0][$nextIndex] = "Number" strval($cartIndex+1) . "";
  
$PP_DirectPayment_itemized[1][$nextIndex] = "".$WA_Store_Cart->DisplayInfo("ID")  ."";
  
$nextIndex count($PP_DirectPayment_itemized[0]);
  
$PP_DirectPayment_itemized[0][$nextIndex] = "Quantity" strval($cartIndex+1) . "";
  
$PP_DirectPayment_itemized[1][$nextIndex] = "".$WA_Store_Cart->DisplayInfo("Quantity")  ."";

    
$WA_Store_Cart->MoveNext();
    
$cartIndex ++;
  }
  
$WA_Store_Cart->MoveFirst();
  
$nextIndex count($PP_DirectPayment_optional[0]);
  
$PP_DirectPayment_optional[0][$nextIndex] = "MerchantSessionID";
  
$PP_DirectPayment_optional[1][$nextIndex] = "".session_id()  ."";
  
$nextIndex count($PP_DirectPayment_optional[0]);
  
$PP_DirectPayment_optional[0][$nextIndex] = "Payer";
  
$PP_DirectPayment_optional[1][$nextIndex] = "".((isset($_POST["email"]))?$_POST["email"]:"")  ."";
  
$nextIndex count($PP_DirectPayment_optional[0]);
  
$PP_DirectPayment_optional[0][$nextIndex] = "Street2";
  
$PP_DirectPayment_optional[1][$nextIndex] = "".((isset($_POST["street2"]))?$_POST["street2"]:"")  ."";
  
$nextIndex count($PP_DirectPayment_optional[0]);
  
$PP_DirectPayment_optional[0][$nextIndex] = "Phone";
  
$PP_DirectPayment_optional[1][$nextIndex] = "".((isset($_POST["phone"]))?$_POST["phone"]:"")  ."";
  
$nextIndex count($PP_DirectPayment_optional[0]);
  
$PP_DirectPayment_optional[0][$nextIndex] = "CVV2";
  
$PP_DirectPayment_optional[1][$nextIndex] = "".((isset($_POST["cvv"]))?$_POST["cvv"]:"")  ."";
  
$nextIndex count($PP_DirectPayment_optional[0]);
  
$PP_DirectPayment_optional[0][$nextIndex] = "ItemTotal";
  
$PP_DirectPayment_optional[1][$nextIndex] = "".$WA_Store_Cart->TotalColumn("TotalPrice")  ."";
  
$nextIndex count($PP_DirectPayment_optional[0]);
  
$PP_DirectPayment_optional[0][$nextIndex] = "ShippingTotal";
  
$PP_DirectPayment_optional[1][$nextIndex] = "".$WA_Store_Cart->GetShipping()  ."";
  
$nextIndex count($PP_DirectPayment_optional[0]);
  
$PP_DirectPayment_optional[0][$nextIndex] = "HandlingTotal";
  
$PP_DirectPayment_optional[1][$nextIndex] = "".$WA_Store_Cart->GetCharges() - $WA_Store_Cart->GetDiscounts()  ."";
  
$nextIndex count($PP_DirectPayment_optional[0]);
  
$PP_DirectPayment_optional[0][$nextIndex] = "TaxTotal";
  
$PP_DirectPayment_optional[1][$nextIndex] = "".$WA_Store_Cart->GetTax()  ."";
  
$nextIndex count($PP_DirectPayment_optional[0]);
  
$PP_DirectPayment_optional[0][$nextIndex] = "SH_Name";
    
$PP_DirectPayment_optional[1][$nextIndex] = "".((isset($_POST["shipping_firstname"]))?$_POST["shipping_firstname"]:"") ." ".((isset($_POST["shipping_lastname"]))?$_POST["shipping_lastname"]:"") ."";
  
$nextIndex count($PP_DirectPayment_optional[0]);
  
$PP_DirectPayment_optional[0][$nextIndex] = "SH_Street1";
  
$PP_DirectPayment_optional[1][$nextIndex] = "".((isset($_POST["shipping_street1"]))?$_POST["shipping_street1"]:"")  ."";
  
$nextIndex count($PP_DirectPayment_optional[0]);
  
$PP_DirectPayment_optional[0][$nextIndex] = "SH_Street2";
  
$PP_DirectPayment_optional[1][$nextIndex] = "".((isset($_POST["shipping_street2"]))?$_POST["shipping_street2"]:"")  ."";
  
$nextIndex count($PP_DirectPayment_optional[0]);
  
$PP_DirectPayment_optional[0][$nextIndex] = "SH_CityName";
  
$PP_DirectPayment_optional[1][$nextIndex] = "".((isset($_POST["shipping_city"]))?$_POST["shipping_city"]:"")  ."";
  
$nextIndex count($PP_DirectPayment_optional[0]);
  
$PP_DirectPayment_optional[0][$nextIndex] = "SH_StateOrProvince";
  
$PP_DirectPayment_optional[1][$nextIndex] = "".((isset($_POST["shipping_state_province"]))?$_POST["shipping_state_province"]:"")  ."";
  
$nextIndex count($PP_DirectPayment_optional[0]);
  
  
$WAGatewayResponse PP_DirectPayment_Post($PP_DirectPayment_required,$PP_DirectPayment_itemized,$PP_DirectPayment_optional);
  if (
$WAGatewayResponse)  {
    
$WA_Store_Cart->redirStr "checkout_success.php";
  }
  else if (
"checkout_failured.php" != "") {
    
header("Location: ""checkout_failure.php");
    exit();
  }
}
?>




and place an if statement around it so the transaction will only be sent to the gateway if the COD option is not selected:

php:
<?php if(isset($_POST["cashondelivery"]) && $_POST["cashondelivery"] != "1") { ?>

< Local Checkout code block>
<?php } else { $WA_Store_Cart->redirStr "checkout_success.php"; } ?>




in the last line of the code above, replace WA_Store_Cart with the name of your eCart object.

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