Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function SucessPayment(){
- global $_CONF;
- $orderID = $_SESSION['order_id'];
- $this->oModel->updateOrderStatus($orderID);
- $orderObj = $this->oModel->getOrderDet($orderID);
- $shippingObj = $this->oModel->getShippingInf($orderID);
- $shippinginfo = $this->oModel->getShippingInfo($order_id);
- $state = $shippinginfo[0]->state;
- $this->member_arrays = parse_ini_file($_CONF['ModulesPath'].'order/ihtml/arrays.conf', true);
- $stateTaxArr = $this->member_arrays[stateTaxArr];
- $tax = $stateTaxArr[$state];
- /********Code for calculating shipping ***************/
- foreach($_SESSION[cart] as $key => $value){
- $weightArray[$key] = $value[0];
- }
- $shippingCharges = $this->oModel->calculateProductWeight($weightArray);
- /***** End of code for calculating shipping **********/
- $total = $subtotal + $shippingCharges + $tax;
- $invoiceTemplate = "
- <table cellspacing='0' cellpadding='0' border='0' width='700' align='center'>
- <tr>
- <td width='60%' align='left'>
- <table cellspacing='0' cellpadding='0' border='0' align='left'>
- <tr><td><strong>#companyName#</strong></td></tr>
- <!--<tr><td>#address1#</td></tr>-->
- <!--<tr><td>#phoneNumbers# #emailAddress#</td></tr>-->
- <tr><td>#website# #emailAddress#</td></tr>
- <tr><td height='30px'></td></tr>
- <!--<tr><td height='20px'><i>Bill To</i></td></tr>
- <tr><td>
- <table cellspacing='0' cellpadding='0' border='0' align='left' width='100%'>
- <tr><td width='50%'>#customerBillingName#</td></tr>
- <tr><td width='50%'>#customerBillingCity# #customerBillingState#, #customerBillingZip#</td></tr>
- <tr><td width='50%'>#billingCode#</td></tr>
- </table>
- </td></tr>-->
- </table>
- </td>
- <td width='40%' valign='top'><table cellspacing='0' cellpadding='0' border='0' align='left' width='100%'>
- <!--<tr><td colspan='2' align='left'><strong>Invoice</strong></td></tr>-->
- <!--<tr><td>Invoice Number</td><td>#invoiceNumber#</td></tr>-->
- <tr><td>Date</td><td>#date#</td></tr>
- </table>
- </td>
- </tr>
- <tr>
- <td colspan='2'>
- <table cellspacing='0' cellpadding='0' border='0' align='left' width='100%'>
- <tr><td colspan='6'><hr/></td></tr>
- <tr><td><strong>S/No</strong></td>
- <td><strong>Item</strong></td>
- <td><strong>Quantity</strong></td>
- <td><strong>Offer</strong></td>
- <td><strong>Unit Price</strong></td>
- <td><strong>Amount</strong></td></tr>
- <tr><td colspan='6'><hr/></td></tr>
- #cartDetail#
- <tr><td colspan='6'><hr/></td></tr>
- <tr><td colspan='4'></td><td>Sub Total</td><td>$ #subTotal#</td></tr>
- <tr><td colspan='4'></td><td>Sub Total</td><td>$ #shipping#</td></tr>
- <tr><td colspan='4'></td><td>Tax</td><td>#tax#</td></tr>
- <tr><td colspan='4'></td><td>Total</td><td>#total#</td></tr>
- <tr><td colspan='6'><hr/></td></tr>
- </table>
- </td>
- </tr>
- <tr>
- <td colspan='2'>
- <table cellspacing='0' cellpadding='0' border='0' align='left' width='100%'>
- <tr><td><i>Ship To</i></td></tr>
- <tr><td width='50%'>#customerShippingName#</td></tr>
- <tr><td width='50%'>#customerShippingAddress1#</td></tr>
- <tr><td width='50%'>#customerShippingAddress2#</td></tr>
- <tr><td width='50%'>#customerShippingCity# #customerShippingState#, #customerShippingZip#</td></tr>
- <!--<tr><td width='50%'>#shippingcode#</td></tr>-->
- <tr><td width='50%'>Country: #customerCountry#</td></tr>
- <tr><td width='50%'>#adminMail# (Will send order confirmation to this mail)</td></tr>
- </table>
- </td>
- </tr>
- </table>";
- $cartDetailString = "";
- $subAmount = 0;
- foreach($orderObj as $key => $itemDetail){
- $srNo = $key + 1;
- $itemName = $itemDetail['name'];
- $qty = $itemDetail['quantity'];
- $unitPrice = $itemDetail['price'];
- $amount = $qty*$unitPrice;
- $subAmount = $subAmount + $amount;
- $cartDetailString.="<tr><td>$srNo</td><td>$itemName</td><td>$qty</td><td></td><td>$ $unitPrice</td><td>$ $amount</td></tr>";
- }
- $invoiceTemplate = str_replace("#website#",'<a href=\'theeaseworkout.com\'>easyworkout.com</a>',$invoiceTemplate);
- $invoiceTemplate = str_replace("#emailAddress#",'<a href=\'mailto:joeyspeakes@msn.com\'>joeyspeakes@msn.com</a>',$invoiceTemplate);
- $invoiceTemplate = str_replace("#companyName#",'EasyWorkout',$invoiceTemplate);
- //$invoiceTemplate = str_replace("#invoiceNumber#",'EasyWorkout',$invoiceTemplate);
- $invoiceTemplate = str_replace("#cartDetail#", $cartDetailString,$invoiceTemplate);
- $invoiceTemplate = str_replace("#subTotal#", $subAmount,$invoiceTemplate);
- $invoiceTemplate = str_replace("#shipping#", $shippingCharges,$invoiceTemplate);
- $invoiceTemplate = str_replace("#tax#",$tax,$invoiceTemplate);
- $invoiceTemplate = str_replace("#total#",$total,$invoiceTemplate);
- $invoiceTemplate = str_replace("#customerShippingName#", $shippingObj->name,$invoiceTemplate);
- $invoiceTemplate = str_replace("#customerShippingAddress1#", $shippingObj->address1,$invoiceTemplate);
- $invoiceTemplate = str_replace("#customerShippingAddress2#", $shippingObj->address2,$invoiceTemplate);
- $invoiceTemplate = str_replace("#customerShippingCity#", $shippingObj->city,$invoiceTemplate);
- $invoiceTemplate = str_replace("#customerShippingState#", $shippingObj->state,$invoiceTemplate);
- $invoiceTemplate = str_replace("#customerShippingZip#", $shippingObj->zip,$invoiceTemplate);
- $invoiceTemplate = str_replace("#customerCountry#", $shippingObj->country_id,$invoiceTemplate);
- $invoiceTemplate = str_replace("#adminMail#", 'joeyspeakes@msn.com',$invoiceTemplate);
- $invoiceTemplate = str_replace("#date#",date("n-j-Y"),$invoiceTemplate);
- /************** Code for sending mails *****************/
- $mailSubject = "Copy of order placed on ".date("n-j-Y");
- $mailContent = $invoiceTemplate."<br><br><strong></strong>";
- $result = SendMail($mailContent, $mailSubject, array('singla100@gmail.com'),$_CONF['sendEmailAdd']);
- $result = SendMail($mailContent, $mailSubject, array($orderObj[0]['email']),$_CONF['sendEmailAdd']);
- /************** Code for sending mails *****************/
- $this->oModel->addInvoice($orderID,$invoiceTemplate);
- echo $invoiceTemplate;
- echo "<script type='text/javascript'>location.href='index.php?stage=order&mode=order_review'</script>";
- die();
- }//ef
Add Comment
Please, Sign In to add comment