Difference between revisions of "Page Templates:Creating a Confirmation Template"

From Whirlwind eCommerce Wiki
Jump to: navigation, search
(added $securedSiteURL)
(added some missing $securedSiteUrl links)
 
Line 26: Line 26:
 
echo "<br>Shipping to: ";
 
echo "<br>Shipping to: ";
 
// link to change shipping address
 
// link to change shipping address
echo "<br><a href=\"index.php?fa=ORDER.checkoutShipping\">EDIT</a>";
+
// prepend URLs with $securedSiteUrl to ensure the link uses the SSL site link
 +
echo "<br><a href=\"$securedSiteUrl/index.php?fa=ORDER.checkoutShipping\">EDIT</a>";
 
// shipping address data
 
// shipping address data
 
echo "<br>" . $shipArr['firstName'] . " " . $shipArr['lastName'] . "
 
echo "<br>" . $shipArr['firstName'] . " " . $shipArr['lastName'] . "
Line 41: Line 42:
 
echo "<br>Billing Method: ";
 
echo "<br>Billing Method: ";
 
// link to change billing address
 
// link to change billing address
echo "<br><a href=\"" . $iProducts['securedSiteUrl']. "/index.php?fa=ORDER.checkoutBilling\">EDIT</a>";
+
// prepend URLs with $securedSiteUrl to ensure the link uses the SSL site link
 +
echo "<br><a href=\"$securedSiteUrl/index.php?fa=ORDER.checkoutBilling\">EDIT</a>";
 
// billing adddress data
 
// billing adddress data
 
echo "<br>" . $payArr['firstName'] . " " . $payArr['lastName'] . "
 
echo "<br>" . $payArr['firstName'] . " " . $payArr['lastName'] . "
Line 52: Line 54:
 
echo "<br>Items: ";
 
echo "<br>Items: ";
 
// link to go back to cart
 
// link to go back to cart
echo "<br><a href=\"" . $iProducts['securedSiteUrl']. "/index.php?ORDER.cartView\">EDIT</a>";
+
// prepend URLs with $securedSiteUrl to ensure the link uses the SSL site link
 +
echo "<br><a href=\"$securedSiteUrl/index.php?ORDER.cartView\">EDIT</a>";
 
// loop thru items
 
// loop thru items
 
foreach($itemArr as $item){
 
foreach($itemArr as $item){
 
// link back to product page
 
// link back to product page
 
// note we can pass the productId in the URL and it will find the first page with that product in it
 
// note we can pass the productId in the URL and it will find the first page with that product in it
echo "<br><a href=\"" . $iProducts['siteUrl']. "index.php?productId=" . $item['productId'] . "\">" . $item['productName'] . "</a>";
+
// prepend link with $siteUrl to direct back to product page, but out of SSL
 +
echo "<br><a href=\"$siteUrl/index.php?productId=" . $item['productId'] . "\">" . $item['productName'] . "</a>";
 
echo " Item #: " . $item['sku'];
 
echo " Item #: " . $item['sku'];
 
if($item['isDiscontinued']) echo " Discontinued ";
 
if($item['isDiscontinued']) echo " Discontinued ";
Line 76: Line 80:
 
// discount form to submit discount
 
// discount form to submit discount
 
// start discount form
 
// start discount form
echo " <form action=\"index.php\" method=\"post\" name=\"discountForm\">";
+
// prepend URLs with $securedSiteUrl to ensure the link uses the SSL site link
 +
echo " <form action=\"$securedSiteUrl/index.php\" method=\"post\" name=\"discountForm\">";
 
echo "<br>Enter Promo Code: <input name=\"discountCode\" type=\"text\" size=\"7\" />";
 
echo "<br>Enter Promo Code: <input name=\"discountCode\" type=\"text\" size=\"7\" />";
 
echo "<input type=\"submit\" value=\"Apply Code\">";
 
echo "<input type=\"submit\" value=\"Apply Code\">";
Line 91: Line 96:
 
echo "<br>Payment Method: ";
 
echo "<br>Payment Method: ";
 
// payment edit link
 
// payment edit link
echo "<br><a href=\"index.php?fa=ORDER.checkoutPayment\">EDIT</a>";
+
// prepend URLs with $securedSiteUrl to ensure the link uses the SSL site link
 +
echo "<br><a href=\"$securedSiteUrl/index.php?fa=ORDER.checkoutPayment\">EDIT</a>";
 
// payment data
 
// payment data
 
echo "<br>**** **** **** " . substr($payArr['accountNumber'],(strlen($payArr['accountNumber'])-4),4);
 
echo "<br>**** **** **** " . substr($payArr['accountNumber'],(strlen($payArr['accountNumber'])-4),4);
Line 97: Line 103:
 
      
 
      
 
// process order link
 
// process order link
echo "<br><a href=\"" . $iProducts['securedSiteUrl']. "/index.php?fa=ORDER.process\">PROCESS ORDER</a>";
+
echo "<br><a href=\"$securedSiteUrl/index.php?fa=ORDER.process\">PROCESS ORDER</a>";
 
    
 
    
 
</source>
 
</source>

Latest revision as of 17:17, 15 April 2009

Page Template Managers

The confirmation / review template shows the visitor all the order information and provided a link to process the order / payment.

After creating the template, setup a page for it. Place the pageId of this new page in Settings > eCommerce tab: "Confirmation Page Id"

Sample content is below:

// get order data
$orderArray = eV::orderGetCompleteArray();
 
// shortcut order info
$orderArr = $orderArray['order'];
// short cut payment info
$payArr = $orderArray['payments'][0];
// short cut the item info
$itemArr = $orderArray['items'];
// short cut shipping address info
$shipArr = $itemArr[0];
// shortcut discount data
$discArr = $orderArray['discounts'];
 
// output shipping address
echo "<br>Shipping to: ";
// link to change shipping address
// prepend URLs with $securedSiteUrl to ensure the link uses the SSL site link
echo "<br><a href=\"$securedSiteUrl/index.php?fa=ORDER.checkoutShipping\">EDIT</a>";
// shipping address data
echo "<br>" . $shipArr['firstName'] . " " . $shipArr['lastName'] . "
		<br>" . $shipArr['street1'] . "
		<br>" . $shipArr['street2'] . "
		<br>" . $shipArr['city'] . ", " . $shipArr['state'] . " " . $shipArr['zipCode'] . "
		<br>" . $shipArr['country'];
 
// shipping instructions
echo "<br>Instructions: ";
echo "<br>" . $shipArr['instructions'];
 
// output billing address
echo "<br>Billing Method: ";
// link to change billing address
// prepend URLs with $securedSiteUrl to ensure the link uses the SSL site link
echo "<br><a href=\"$securedSiteUrl/index.php?fa=ORDER.checkoutBilling\">EDIT</a>";
// billing adddress data
echo "<br>" . $payArr['firstName'] . " " . $payArr['lastName'] . "
		<br>" . $payArr['street1'] . "
		<br>" . $payArr['street2'] . "
		<br>" . $payArr['city'] . ", " . $payArr['state'] . " " . $payArr['zipCode'] . "
		<br>" . $payArr['country'];
 
// output items in shopping cart
echo "<br>Items: ";
// link to go back to cart
// prepend URLs with $securedSiteUrl to ensure the link uses the SSL site link
echo "<br><a href=\"$securedSiteUrl/index.php?ORDER.cartView\">EDIT</a>";
// loop thru items
foreach($itemArr as $item){
	// link back to product page
	// note we can pass the productId in the URL and it will find the first page with that product in it
// prepend link with $siteUrl to direct back to product page, but out of SSL
	echo "<br><a href=\"$siteUrl/index.php?productId=" . $item['productId'] . "\">" . $item['productName'] . "</a>";
	echo " Item #: " . $item['sku'];
	if($item['isDiscontinued']) echo " Discontinued ";
	echo $item['quantity'] . " x " . eV::dollarFormat($item['pricePer']) . " = " . eV::dollarFormat($item['quantity'] * $item['pricePer']);
	echo "<br>" . $item['cartDescription'];
};
 
// output item total
// this is the merchandise total for all the items in the cart added up		
echo "<br>Merchandise Total: " .  eV::dollarFormat($orderArr['itemTotal']);
 
 
// output shipping method
echo "<br>Shipping Method: " .  $shipArr['shipTypeCode'] . ": " . $shipArr['shipType'];
// shipping cost
echo "<br>Shipping Cost: " .  eV::dollarFormat($orderArr['shippingTotal']);
 
// discount form to submit discount
// start discount form
// prepend URLs with $securedSiteUrl to ensure the link uses the SSL site link
echo " <form action=\"$securedSiteUrl/index.php\" method=\"post\" name=\"discountForm\">";
echo "<br>Enter Promo Code: <input name=\"discountCode\" type=\"text\" size=\"7\" />";
echo "<input type=\"submit\" value=\"Apply Code\">";
 
// output codes already applied
foreach($discArr as $disc) echo "<br>" . $disc['discountCode'] . ": " . $disc['description'] . " :" . eV::dollarFormat($disc['amount']);
 
// tax and total
echo "<br>Tax: " . eV::dollarFormat($orderArr['taxTotal']);
echo "<br>Order Total: " . eV::dollarFormat($orderArr['grandTotal']); // use 'totalDue' if accepting partial payments, this will show how much it oustanding instead of total amount
 
 
// payment method info
echo "<br>Payment Method: ";
// payment edit link
// prepend URLs with $securedSiteUrl to ensure the link uses the SSL site link
echo "<br><a href=\"$securedSiteUrl/index.php?fa=ORDER.checkoutPayment\">EDIT</a>";
// payment data
echo "<br>**** **** **** " . substr($payArr['accountNumber'],(strlen($payArr['accountNumber'])-4),4);
echo "<br>Expires: " . date('m/Y',strtotime($payArr['expDate']));
 
// process order link
echo "<br><a href=\"$securedSiteUrl/index.php?fa=ORDER.process\">PROCESS ORDER</a>";