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

From Whirlwind eCommerce Wiki
Jump to: navigation, search
(New page: 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 ...)
(No difference)

Revision as of 01:18, 21 October 2008

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
echo "<br><a href=\"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
echo "<br><a href=\"index.php?fa=ORDER.checkoutBilling\">EDIT</a>";
// billing adddress data
echo "<br>" . $payArr['firstName'] . " " . $payArr['firstName'] . "
		<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
echo "<br><a href=\"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
	echo "<br><a href=\"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
echo " <form action=\"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['totalDue']);
 
 
// payment method info
echo "<br>Payment Method: ";
// payment edit link
echo "<br><a href=\"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=\"index.php?fa=ORDER.process\">PROCESS ORDER</a>";