Guest User

Untitled

a guest
May 30th, 2018
288
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.42 KB | None | 0 0
  1. function SucessPayment(){
  2. global $_CONF;
  3. $orderID = $_SESSION['order_id'];
  4. $this->oModel->updateOrderStatus($orderID);
  5. $orderObj = $this->oModel->getOrderDet($orderID);
  6. $shippingObj = $this->oModel->getShippingInf($orderID);
  7. $shippinginfo = $this->oModel->getShippingInfo($order_id);
  8. $state = $shippinginfo[0]->state;
  9. $this->member_arrays = parse_ini_file($_CONF['ModulesPath'].'order/ihtml/arrays.conf', true);
  10. $stateTaxArr = $this->member_arrays[stateTaxArr];
  11. $tax = $stateTaxArr[$state];
  12.  
  13. /********Code for calculating shipping ***************/
  14. foreach($_SESSION[cart] as $key => $value){
  15. $weightArray[$key] = $value[0];
  16. }
  17. $shippingCharges = $this->oModel->calculateProductWeight($weightArray);
  18. /***** End of code for calculating shipping **********/
  19.  
  20. $total = $subtotal + $shippingCharges + $tax;
  21.  
  22. $invoiceTemplate = "
  23. <table cellspacing='0' cellpadding='0' border='0' width='700' align='center'>
  24. <tr>
  25. <td width='60%' align='left'>
  26. <table cellspacing='0' cellpadding='0' border='0' align='left'>
  27. <tr><td><strong>#companyName#</strong></td></tr>
  28. <!--<tr><td>#address1#</td></tr>-->
  29. <!--<tr><td>#phoneNumbers# #emailAddress#</td></tr>-->
  30. <tr><td>#website# #emailAddress#</td></tr>
  31. <tr><td height='30px'></td></tr>
  32. <!--<tr><td height='20px'><i>Bill To</i></td></tr>
  33. <tr><td>
  34. <table cellspacing='0' cellpadding='0' border='0' align='left' width='100%'>
  35. <tr><td width='50%'>#customerBillingName#</td></tr>
  36. <tr><td width='50%'>#customerBillingCity# #customerBillingState#, #customerBillingZip#</td></tr>
  37. <tr><td width='50%'>#billingCode#</td></tr>
  38. </table>
  39. </td></tr>-->
  40. </table>
  41. </td>
  42. <td width='40%' valign='top'><table cellspacing='0' cellpadding='0' border='0' align='left' width='100%'>
  43. <!--<tr><td colspan='2' align='left'><strong>Invoice</strong></td></tr>-->
  44. <!--<tr><td>Invoice Number</td><td>#invoiceNumber#</td></tr>-->
  45. <tr><td>Date</td><td>#date#</td></tr>
  46. </table>
  47. </td>
  48. </tr>
  49. <tr>
  50. <td colspan='2'>
  51. <table cellspacing='0' cellpadding='0' border='0' align='left' width='100%'>
  52. <tr><td colspan='6'><hr/></td></tr>
  53. <tr><td><strong>S/No</strong></td>
  54. <td><strong>Item</strong></td>
  55. <td><strong>Quantity</strong></td>
  56. <td><strong>Offer</strong></td>
  57. <td><strong>Unit Price</strong></td>
  58. <td><strong>Amount</strong></td></tr>
  59. <tr><td colspan='6'><hr/></td></tr>
  60. #cartDetail#
  61. <tr><td colspan='6'><hr/></td></tr>
  62. <tr><td colspan='4'></td><td>Sub Total</td><td>$ #subTotal#</td></tr>
  63. <tr><td colspan='4'></td><td>Sub Total</td><td>$ #shipping#</td></tr>
  64. <tr><td colspan='4'></td><td>Tax</td><td>#tax#</td></tr>
  65. <tr><td colspan='4'></td><td>Total</td><td>#total#</td></tr>
  66. <tr><td colspan='6'><hr/></td></tr>
  67. </table>
  68. </td>
  69. </tr>
  70. <tr>
  71. <td colspan='2'>
  72. <table cellspacing='0' cellpadding='0' border='0' align='left' width='100%'>
  73. <tr><td><i>Ship To</i></td></tr>
  74. <tr><td width='50%'>#customerShippingName#</td></tr>
  75. <tr><td width='50%'>#customerShippingAddress1#</td></tr>
  76. <tr><td width='50%'>#customerShippingAddress2#</td></tr>
  77. <tr><td width='50%'>#customerShippingCity# #customerShippingState#, #customerShippingZip#</td></tr>
  78. <!--<tr><td width='50%'>#shippingcode#</td></tr>-->
  79. <tr><td width='50%'>Country: #customerCountry#</td></tr>
  80. <tr><td width='50%'>#adminMail# (Will send order confirmation to this mail)</td></tr>
  81. </table>
  82. </td>
  83. </tr>
  84. </table>";
  85. $cartDetailString = "";
  86. $subAmount = 0;
  87. foreach($orderObj as $key => $itemDetail){
  88. $srNo = $key + 1;
  89. $itemName = $itemDetail['name'];
  90. $qty = $itemDetail['quantity'];
  91. $unitPrice = $itemDetail['price'];
  92. $amount = $qty*$unitPrice;
  93. $subAmount = $subAmount + $amount;
  94. $cartDetailString.="<tr><td>$srNo</td><td>$itemName</td><td>$qty</td><td></td><td>$ $unitPrice</td><td>$ $amount</td></tr>";
  95. }
  96. $invoiceTemplate = str_replace("#website#",'<a href=\'theeaseworkout.com\'>easyworkout.com</a>',$invoiceTemplate);
  97. $invoiceTemplate = str_replace("#emailAddress#",'<a href=\'mailto:joeyspeakes@msn.com\'>joeyspeakes@msn.com</a>',$invoiceTemplate);
  98. $invoiceTemplate = str_replace("#companyName#",'EasyWorkout',$invoiceTemplate);
  99. //$invoiceTemplate = str_replace("#invoiceNumber#",'EasyWorkout',$invoiceTemplate);
  100. $invoiceTemplate = str_replace("#cartDetail#", $cartDetailString,$invoiceTemplate);
  101. $invoiceTemplate = str_replace("#subTotal#", $subAmount,$invoiceTemplate);
  102. $invoiceTemplate = str_replace("#shipping#", $shippingCharges,$invoiceTemplate);
  103. $invoiceTemplate = str_replace("#tax#",$tax,$invoiceTemplate);
  104. $invoiceTemplate = str_replace("#total#",$total,$invoiceTemplate);
  105. $invoiceTemplate = str_replace("#customerShippingName#", $shippingObj->name,$invoiceTemplate);
  106. $invoiceTemplate = str_replace("#customerShippingAddress1#", $shippingObj->address1,$invoiceTemplate);
  107. $invoiceTemplate = str_replace("#customerShippingAddress2#", $shippingObj->address2,$invoiceTemplate);
  108. $invoiceTemplate = str_replace("#customerShippingCity#", $shippingObj->city,$invoiceTemplate);
  109. $invoiceTemplate = str_replace("#customerShippingState#", $shippingObj->state,$invoiceTemplate);
  110. $invoiceTemplate = str_replace("#customerShippingZip#", $shippingObj->zip,$invoiceTemplate);
  111. $invoiceTemplate = str_replace("#customerCountry#", $shippingObj->country_id,$invoiceTemplate);
  112. $invoiceTemplate = str_replace("#adminMail#", 'joeyspeakes@msn.com',$invoiceTemplate);
  113. $invoiceTemplate = str_replace("#date#",date("n-j-Y"),$invoiceTemplate);
  114.  
  115. /************** Code for sending mails *****************/
  116. $mailSubject = "Copy of order placed on ".date("n-j-Y");
  117. $mailContent = $invoiceTemplate."<br><br><strong></strong>";
  118. $result = SendMail($mailContent, $mailSubject, array('singla100@gmail.com'),$_CONF['sendEmailAdd']);
  119. $result = SendMail($mailContent, $mailSubject, array($orderObj[0]['email']),$_CONF['sendEmailAdd']);
  120. /************** Code for sending mails *****************/
  121.  
  122. $this->oModel->addInvoice($orderID,$invoiceTemplate);
  123. echo $invoiceTemplate;
  124. echo "<script type='text/javascript'>location.href='index.php?stage=order&mode=order_review'</script>";
  125. die();
  126. }//ef
Add Comment
Please, Sign In to add comment