function m_dspOrderDetails() { $comFunc = new c_commonFunctions(); $comFunc->obDb = $this->obDb; $this->tComments = ""; $this->vSid = ""; #INTIALIZING TEMPLATES $this->ObTpl = new template(); $this->ObTpl->set_file("TPL_ORDER_FILE", $this->orderTemplate); $this->ObTpl->set_block("TPL_ORDER_FILE", "TPL_CART_BLK", "cart_blk"); $this->ObTpl->set_block("TPL_ORDER_FILE", "TPL_MSG_BLK", "msg_blk"); $this->ObTpl->set_block("TPL_CART_BLK", "TPL_DISPATCHED_BLK", "dispatched_blk"); $this->ObTpl->set_block("TPL_CART_BLK", "TPL_BLK_REGISTERED_USER", "registereduser_blk"); $this->ObTpl->set_block("TPL_CART_BLK", "TPL_BLK_NOTREGISTERED_USER", "notregistereduser_blk"); $this->ObTpl->set_block("TPL_CART_BLK", "TPL_DELIVERY_BLK", "delivery_blk"); $this->ObTpl->set_block("TPL_ORDER_FILE", "TPL_LINK_BLK", "link_blk"); $this->ObTpl->set_block("TPL_CART_BLK", "TPL_PRODUCT_BLK", "cartproduct_blk"); $this->ObTpl->set_block("TPL_CART_BLK", "TPL_GIFTCERT_BLK", "giftcert_blk"); $this->ObTpl->set_block("TPL_CART_BLK", "TPL_DISCOUNT_BLK", "discount_blk"); $this->ObTpl->set_block("TPL_CART_BLK", "TPL_COD_BLK", "cod_blk"); $this->ObTpl->set_block("TPL_CART_BLK", "TPL_PROMODISCOUNTS_BLK", "promodiscounts_blk"); $this->ObTpl->set_block("TPL_CART_BLK", "TPL_VOLDISCOUNTS_BLK", "volDiscounts_blk"); $this->ObTpl->set_block("TPL_CART_BLK", "TPL_POSTAGE_BLK", "postage_blk"); $this->ObTpl->set_block("TPL_CART_BLK", "TPL_MPOINTS_BLK", "memberpoint_blk"); # Added for earned member point $this->ObTpl->set_block("TPL_CART_BLK", "TPL_EMPOINTS_BLK", "earnedmemberpoint_blk"); # Added for total member point $this->ObTpl->set_block("TPL_CART_BLK", "TPL_TMPOINTS_BLK", "totalmemberpoint_blk"); $this->ObTpl->set_block("TPL_CART_BLK", "TPL_CARTWEIGHT_BLK", "cartWeight_blk"); $this->ObTpl->set_block("TPL_CART_BLK", "TPL_VAT_BLK", "vat_blk"); $this->ObTpl->set_block("TPL_PRODUCT_BLK", "TPL_KIT_BLK", "kit_blk"); $this->ObTpl->set_block("TPL_KIT_BLK", "TPL_KITELEMENT_BLK", "kitElement_blk"); $this->ObTpl->set_var("TPL_VAR_MESSAGE", "Sorry,No order details available."); #INTAILAIZING $this->ObTpl->set_var("GRAPHICSMAINPATH", GRAPHICS_PATH); $this->ObTpl->set_var("TPL_VAR_SITEURL", SITE_URL); $this->ObTpl->set_var("TPL_VAR_CURRENCY", CONST_CURRENCY); $this->ObTpl->set_var("TPL_VAR_CART_VOLDISCOUNT", ""); $this->ObTpl->set_var("TPL_VAR_SAMEASBILLING", ""); $this->ObTpl->set_var("TPL_VAR_CUSTOMER_IP", "Not available"); $this->ObTpl->set_var("msg_blk", ""); $this->ObTpl->set_var("kit_blk", ""); $this->ObTpl->set_var("kitElement_blk", ""); $this->ObTpl->set_var("vat_blk", ""); $this->ObTpl->set_var("dispatched_blk", ""); $this->ObTpl->set_var("delivery_blk", ""); $this->ObTpl->set_var("cartproduct_blk", ""); $this->ObTpl->set_var("cart_blk", ""); $this->ObTpl->set_var("link_blk", ""); $this->ObTpl->set_var("cartWeight_blk", ""); $this->ObTpl->set_var("giftcert_blk", ""); $this->ObTpl->set_var("discount_blk", ""); $this->ObTpl->set_var("cartproduct_blk", ""); $this->ObTpl->set_var("kit_blk", ""); $this->ObTpl->set_var("promodiscounts_blk", ""); $this->ObTpl->set_var("volDiscounts_blk", ""); $this->ObTpl->set_var("postage_blk", ""); $this->ObTpl->set_var("cod_blk", ""); $this->ObTpl->set_var("memberpoint_blk", ""); # Added for earned member point $this->ObTpl->set_var("earnedmemberpoint_blk", ""); # Added for total member point $this->ObTpl->set_var("totalmemberpoint_blk", ""); $this->ObTpl->set_var("registereduser_blk", ""); $this->ObTpl->set_var("notregistereduser_blk", ""); $this->ObTpl->set_var("ORDERID", $this->request['orderid']); $this->ObTpl->set_var("TPL_VAR_MSG", ""); if (!isset($this->request['orderid'])) { $this->libFunc->m_mosRedirect(SITE_URL . "order/adminindex.php?action=orders.home"); exit; } else { $this->request['orderid'] = intval($this->request['orderid']); } if ($this->request['orderid'] < 1) { #URL TEMPER $this->libFunc->m_mosRedirect(SITE_URL . "order/adminindex.php?action=orders.home"); } else { #QUERY ORDER TABLE $this->obDb->query = "SELECT vAuthCode,iOrderid_PK,tmOrderDate,vPayMethod,vShipDescription,fShipTotal,"; $this->obDb->query .= "vFirstName,vLastName,vEmail,vAddress1,vAddress2,vCity,iInvoice,"; $this->obDb->query .= "vState,vStateName,vCountry,vZip,vCompany,vPhone,vHomepage,"; $this->obDb->query .= "vAltCompany,vAltName,vAltAddress1,vAltAddress2,vAltCity,vAltState,"; $this->obDb->query .= "vAltCountry,vAltStateName,vAltZip,vAltPhone,fCodCharge,"; $this->obDb->query .= "fPromoValue,vDiscountCode,fDiscount,iGiftcert_FK,fGiftcertTotal,"; $this->obDb->query .= "fMemberPoints,fShipByWeightPrice,fShipByWeightKg,iSameAsBilling,"; $this->obDb->query .= "fTaxRate,fTaxPrice,tComments,vCustomerIP,tAdminComments,vStatus,iPayStatus,fTotalPrice, "; $this->obDb->query .= "iCustomerid_FK,vSid,iOrderStatus,iEarnedPoints FROM " . ORDERS . " WHERE iInvoice='" . $this->request['orderid'] . "' "; $rsOrder = $this->obDb->fetchQuery(); $rsOrderCount = $this->obDb->record_count; if ($rsOrderCount > 0) { #ORDER ID FOR COMMON FUNCTION $comFunc->orderId = $rsOrder[0]->iOrderid_PK; $this->obDb->query = "SELECT * FROM " . COMPANYSETTINGS; $CompanySettings = $this->obDb->fetchQuery(); # sprSimple Invoice Integration $htmlString = "<!doctype html><html dir=\"ltr\" lang=\"en\" class=\"no-js\"><meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge,chrome=1\"><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" /><meta name=\"viewport\" content=\"width=device-width\" /><title>Invoice #" . $rsOrder[0]->iInvoice . "</title><link rel=\"stylesheet\" href=\"" . SITE_URL . "css/reset.css\" /><link rel=\"stylesheet\" href=\"" . SITE_URL . "css/invstyle.css\" media=\"all\"/><style>@media print {\t tr {border:1px solid #000;}\t body { background-color:#fff !important; )\t #invoice { background-color:transparent !important; ) } </style><!--[if lte IE 8]><script src=\"http://html5shim.googlecode.com/svn/trunk/html5.js\"><\\/script><![endif]--><script>(function(H){H.className=H.className.replace(/\\bno-js\\b/,\"js\")})(document.documentElement)<\\/script></head><body>"; $this->datePost = ""; if ($rsOrder[0]->vStatus == 'Shipped') { $this->obDb->query = "SELECT vShipper,vTracking,tmShipDate FROM " . SHIPPINGDETAILS . " WHERE iOrderid_FK='" . $rsOrder[0]->iOrderid_PK . "'"; $queryResult = $this->obDb->fetchQuery(); $recordNum = $this->obDb->record_count; if ($recordNum > 0) { $this->ObTpl->set_var("TPL_VAR_MODE", "update"); $this->ObTpl->set_var("TPL_VAR_MSG", MSG_POSTAGE_DEFINED); $this->shipper = $queryResult[0]->vShipper; $this->datePost = $queryResult[0]->tmShipDate; $this->trackNum = $queryResult[0]->vTracking; $this->ObTpl->set_var("TPL_VAR_SHIPPER", $this->libFunc->m_displayContent($this->shipper)); $this->ObTpl->set_var("TPL_VAR_DATEPOST", $this->libFunc->dateFormat2($this->datePost)); $this->ObTpl->set_var("TPL_VAR_TRACKNUM", $this->trackNum); $this->ObTpl->parse("dispatched_blk", "TPL_DISPATCHED_BLK"); } } if ($rsOrder[0]->iPayStatus == 1) { $htmlString = $htmlString . "<div id=\"invoice\" class=\"paid\">"; } else { $htmlString = $htmlString . "<div id=\"invoice\" class=\"unpaid\">"; } $htmlString = $htmlString . "<div class=\"this-is\">\t\t<strong>Invoice</strong>\t</div>\t<header id=\"header\">\t\t<div class=\"invoice-intro\">\t\t\t<img src=" . SITE_URL . "images/company/" . $CompanySettings[0]->vLogo . " />\t\t\t<p>" . $CompanySettings[0]->vSlogan . "</p>\t\t</div>\t\t<dl class=\"invoice-meta\">\t\t\t<dt class=\"invoice-number\">Invoice #</dt>\t\t\t<dd>" . $rsOrder[0]->iInvoice . "</dd>\t\t\t<dt class=\"invoice-date\">Date of Invoice</dt>\t\t\t<dd>" . $this->libFunc->dateFormat2($rsOrder[0]->tmOrderDate) . "</dd>\t\t\t<dt class=\"invoice-due\">Due Date</dt>\t\t\t<dd>" . $this->libFunc->dateFormat2($rsOrder[0]->tmOrderDate) . "</dd>\t\t</dl>\t</header>\t<section id=\"parties\">\t\t<table class=\"fromtostatus\"><tr>\t\t<td valign=\"top\" class=\"invoice-to\">\t\t\t<h2>Invoice To:</h2>\t\t\t<div id=\"hcard-Hiram-Roth\" class=\"vcard\">\t\t\t\t<a class=\"url fn\" href=\"#\">" . $rsOrder[0]->vFirstName . " " . $rsOrder[0]->vLastName . "</a>\t\t\t\t<div class=\"org\">" . $rsOrder[0]->vCompany . "</div>\t\t\t\t<a class=\"email\" href=\"mailto:" . $rsOrder[0]->vEmail . "\">" . $rsOrder[0]->vEmail . "</a>\t\t\t\t\t\t\t\t<div class=\"adr\">\t\t\t\t\t<div class=\"street-address\">" . $rsOrder[0]->vAddress1 . "<br/>" . $rsOrder[0]->vAddress2 . "</div>\t\t\t\t\t<span class=\"locality\">" . $rsOrder[0]->vCity . "," . $rsOrder[0]->vStateName . " " . $rsOrder[0]->vZip . "</span>"; $this->obDb->query = "SELECT vCountryName FROM " . COUNTRY . " where iCountryId_PK = '" . $rsOrder[0]->vCountry . "'"; $row_country = $this->obDb->fetchQuery(); $htmlString = $htmlString . "<br/><span class=\"country-name\">" . $this->libFunc->m_displayContent($row_country[0]->vCountryName) . "</span>\t\t\t\t</div>\t\t\t\t<div class=\"tel\">" . $rsOrder[0]->vPhone . "</div>\t\t\t</div>\t\t</td>\t\t<td valign=\"top\" class=\"invoice-from\">\t\t\t<h2>Invoice From:</h2>\t\t\t<div id=\"hcard-Admiral-Valdore\" class=\"vcard\">\t\t\t\t<div class=\"org\">" . $CompanySettings[0]->vCname . "</div>\t\t\t\t\t\t\t\t<div class=\"adr\">\t\t\t\t\t<div class=\"street-address\">" . $CompanySettings[0]->vAddress . "</div>\t\t\t\t\t<span class=\"locality\">" . $CompanySettings[0]->vCity . ", " . $CompanySettings[0]->vStateName . " " . $CompanySettings[0]->vZip . "</span>"; $this->obDb->query = "SELECT vCountryName FROM " . COUNTRY . " where "; $this->obDb->query .= "iCountryId_PK = '" . $CompanySettings[0]->vCountry . "'"; $row_country = $this->obDb->fetchQuery(); $htmlString = $htmlString . "<br/><span class=\"country-name\">" . $this->libFunc->m_displayContent($row_country[0]->vCountryName) . "</span>\t\t\t\t</div>\t\t\t\t<div class=\"tel\">" . $CompanySettings[0]->vPhone . "</div>\t\t\t</div>\t\t</td>\t\t<td valign=\"top\" class=\"invoice-status\">\t\t\t<h2>Invoice Status</h2>"; if ($rsOrder[0]->iPayStatus == 1) { $htmlString = $htmlString . "<strong>Invoice is <em>Paid</em></strong>"; } else { $htmlString = $htmlString . "<strong>Invoice is <em>Unpaid</em></strong>"; } $htmlString = $htmlString . "</td></tr></table>\t</section>\t<section class=\"invoice-financials\">\t\t<div class=\"invoice-items\">\t\t\t<table>\t\t\t\t<caption>Your Invoice</caption>\t\t\t\t<thead>\t\t\t\t\t<tr>\t\t\t\t\t\t<th>Item & Description</th>\t\t\t\t\t\t<th>Quantity</th>\t\t\t\t\t\t<th>Price</th>\t\t\t\t\t</tr>\t\t\t\t</thead>\t\t\t\t<tbody>"; $this->obDb->query = "SELECT iOrderProductid_PK,iProductid_FK,iQty,iGiftwrapFK,fPrice,"; $this->obDb->query .= "iVendorid_FK,fDiscount,vTitle,vSku,iKit,tShortDescription,seo_title,"; $this->obDb->query .= "iTaxable,iFreeship,vPostageNotes FROM " . ORDERPRODUCTS; $this->obDb->query .= " WHERE iOrderid_FK='" . $rsOrder[0]->iOrderid_PK . "'"; $rsOrderProduct = $this->obDb->fetchQuery(); $rsOrderProductCount = $this->obDb->record_count; foreach ($rsOrderProduct as $i => $v) { $comFunc->productId = $rsOrderProduct[$i]->iProductid_FK; $comFunc->qty = $rsOrderProduct[$i]->iQty; $comFunc->price = $rsOrderProduct[$i]->fPrice; $comFunc->orderProductId = $rsOrderProduct[$i]->iOrderProductid_PK; $tempItem = "<h3>" . $this->libFunc->m_displayContent($rsOrderProduct[$i]->vTitle) . "</h3>"; if ($rsOrderProduct[$i]->iKit == 1) { $this->obDb->query = "SELECT iProdId_FK,iQty,vTitle,vSeoTitle,vSku FROM " . PRODUCTKITS . "," . PRODUCTS . " WHERE iProdId_FK=iProdId_PK AND iKitId ='" . $rsOrderProduct[$i]->iProductid_FK . "'"; $rsKit = $this->obDb->fetchQuery(); $rsKitCount = $this->obDb->record_count; if ($rsKitCount > 0) { for ($j = 0; $j < $rsKitCount; $j++) { $kitElementUrl = SITE_URL . "ecom/index.php?action=ecom.pdetails&mode=" . $rsKit[$j]->vSeoTitle; $comFunc->kitProductId = $rsKit[$j]->iProdId_FK; $comFunc->productId = $rsKit[$j]->iProdId_FK; #GET CART OPTIONS $kitOptions = $comFunc->m_orderKitProductOptions(); $tempItem = $tempItem . "<h6>" . $rsKit[$j]->vSku . "</h6>"; if (!empty($kitOptions)) { $tempItem = $tempItem . "<h6>" . $kitOptions . "</h6>"; $tempItem = $tempItem . "<h6>" . $rsKit[$j]->iQty . "</h6>"; } } #END FOR I LOOP } #END IF } else { $options = $comFunc->m_orderProductOptions(); $choices = $comFunc->m_orderProductChoices(); if (!empty($rsOrderProduct[$i]->vSku)) { $tempItem = $tempItem . "<h6>" . $rsOrderProduct[$i]->vSku . "</h6>"; } #GET OPTIONS if (!empty($options)) { $tempItem = $tempItem . "<h6>" . $options . "</h6>"; } #GET CHOICES if (!empty($choices)) { $tempItem = $tempItem . "<h6>" . $choices . "</h6>"; } } $htmlString = $htmlString . "<tr>\t\t\t\t\t\t<th>" . $tempItem . "</th>\t\t\t\t\t\t<td style=\"text-align:left;\">" . $rsOrderProduct[$i]->iQty . "</td>\t\t\t\t\t\t<td>" . CONST_CURRENCY . $comFunc->price . "</td>\t\t\t\t\t</tr>"; } $htmlString = $htmlString . "</tbody>\t\t\t\t<tfoot>\t\t\t\t\t<tr>\t\t\t\t\t\t<td colspan=\"3\" style=\"text-align:left;\"><strong>Customer Comments:</strong> " . $rsOrder[0]->tComments . "</td>\t\t\t\t\t</tr>\t\t\t\t</tfoot>\t\t\t</table>\t\t</div>"; $htmlString = str_replace(array("'", "\n", "\r\n", "\r"), array("\\'", " ", " ", " "), $htmlString); $this->ObTpl->set_var("TPL_VAR_PRINTABLE_INVOICE", $htmlString); $this->ObTpl->set_var("TPL_VAR_ORDERID", $rsOrder[0]->iOrderid_PK); $this->ObTpl->set_var("TPL_VAR_MEMBERPOINTS_USED", $rsOrder[0]->fMemberPoints); $this->ObTpl->set_var("TPL_VAR_MEMBERPOINTS_EARNED", $rsOrder[0]->iEarnedPoints); $this->ObTpl->set_var("TPL_VAR_GIFTCERTAMOUNT", $rsOrder[0]->fGiftcertTotal); $this->ObTpl->set_var("TPL_VAR_GIFTCERTID", $rsOrder[0]->iGiftcert_FK); $this->ObTpl->set_var("TPL_VAR_CUSTOMERID", $rsOrder[0]->iCustomerid_FK); if ($rsOrder[0]->iPayStatus == 1) { $this->ObTpl->set_var("CHECK1", "checked"); $this->ObTpl->set_var("TPL_MSG1", "<font class='message'>Invoice paid</font>"); } else { $this->ObTpl->set_var("CHECK1", ""); $this->ObTpl->set_var("TPL_MSG1", "Mark order as paid"); } if ($rsOrder[0]->iOrderStatus == 1) { $this->ObTpl->set_var("CHECK2", "checked"); $this->ObTpl->set_var("TPL_MSG2", "<font class='message'>Order Complete</font>"); } else { $this->ObTpl->set_var("CHECK2", ""); $this->ObTpl->set_var("TPL_MSG2", "Mark order as complete"); } if ($rsOrder[0]->vCustomerIP != 0) { $this->ObTpl->set_var("TPL_VAR_CUSTOMER_IP", $rsOrder[0]->vCustomerIP); } $this->ObTpl->set_var("TPL_VAR_AUTH", $rsOrder[0]->vAuthCode); $this->ObTpl->set_var("SEL1", ""); $this->ObTpl->set_var("SEL2", ""); $this->ObTpl->set_var("SEL3", ""); $this->ObTpl->set_var("SEL4", ""); $this->ObTpl->set_var("SEL5", ""); $this->ObTpl->set_var("SEL6", ""); if ($rsOrder[0]->vStatus == "New") { $this->ObTpl->set_var("SEL1", "selected"); } elseif ($rsOrder[0]->vStatus == "Received") { $this->ObTpl->set_var("SEL2", "selected"); } elseif ($rsOrder[0]->vStatus == "Backorder") { $this->ObTpl->set_var("SEL3", "selected"); } elseif ($rsOrder[0]->vStatus == "Shipped") { $this->ObTpl->set_var("SEL4", "selected"); } elseif ($rsOrder[0]->vStatus == "Void") { $this->ObTpl->set_var("SEL5", "selected"); } elseif ($rsOrder[0]->vStatus == "Delete") { $this->ObTpl->set_var("SEL6", "selected"); } else { $this->ObTpl->set_var("SEL1", "selected"); } $comFunc->orderId = $rsOrder[0]->iOrderid_PK; $this->ObTpl->set_var("TPL_VAR_INVOICE", $rsOrder[0]->iInvoice); $this->ObTpl->set_var("TPL_VAR_ORDERDATE", $this->libFunc->dateFormat2($rsOrder[0]->tmOrderDate)); if ($rsOrder[0]->vPayMethod == 'cod') { $vPayMethod = $comFunc->m_paymentMethod($rsOrder[0]->vPayMethod, $rsOrder[0]->fCodCharge); } elseif ($rsOrder[0]->vPayMethod == 'cc') { $vPayMethod = $comFunc->m_paymentMethod($rsOrder[0]->vPayMethod); $returnInfo = $comFunc->m_dspCreditCardInfo(); if (empty($returnInfo)) { $vPayMethod .= "<br />CC info not available"; } else { $vPayMethod .= $comFunc->m_dspCreditCardInfo(); } } else { $vPayMethod = $comFunc->m_paymentMethod($rsOrder[0]->vPayMethod); } $this->ObTpl->set_var("TPL_VAR_PAYMETHOD", $vPayMethod); $this->ObTpl->set_var("TPL_VAR_SHIPDESC", $this->libFunc->m_displayContent1($rsOrder[0]->vShipDescription)); $this->ObTpl->set_var("TPL_VAR_ORDERSTATUS", $rsOrder[0]->vStatus); if (empty($rsOrder[0]->tComments) && empty($rsOrder[0]->vSid)) { $this->ObTpl->set_var("TPL_VAR_COMMENTS", "None"); } else { if (!empty($rsOrder[0]->tComments)) { $this->tComments = $rsOrder[0]->tComments . "<br /><br />"; } if (!empty($rsOrder[0]->vSid)) { $this->vSid = "Source ID: " . $rsOrder[0]->vSid . "<br />"; } $this->ObTpl->set_var("TPL_VAR_COMMENTS", $this->tComments . $this->vSid); } # handle admin comments - MCB, 10/09/08 # copy-and-pasted from regular comments handler block above if (empty($rsOrder[0]->tAdminComments) && empty($rsOrder[0]->vSid)) { $this->ObTpl->set_var("TPL_VAR_ADMIN_COMMENTS", "None"); } else { if (!empty($rsOrder[0]->tAdminComments)) { $this->tAdminComments = $rsOrder[0]->tAdminComments; } else { $this->tAdminComments = ""; } if (!empty($rsOrder[0]->vSid)) { $this->vSid = "Source ID: " . $rsOrder[0]->vSid . "<br />"; } else { $this->vSid = "Sourice ID: None."; } //$this->ObTpl->set_var("TPL_VAR_ADMIN_COMMENTS", $this->tAdminComments.$this->vSid); $this->ObTpl->set_var("TPL_VAR_ADMIN_COMMENTS", $this->tAdminComments); } $this->ObTpl->set_var("TPL_VAR_CUSTOMERID", $rsOrder[0]->iCustomerid_FK); if (isset($rsOrder[0]->vState) && !empty($rsOrder[0]->vState)) { $this->obDb->query = "SELECT vStateName FROM " . STATES . " where iStateId_PK = '" . $rsOrder[0]->vState . "'"; $row_state = $this->obDb->fetchQuery(); if ($this->libFunc->m_displayContent($row_state[0]->vStateName) === 'Other') { $this->ObTpl->set_var("TPL_VAR_BILLSTATE", $this->libFunc->m_displayContent($rsOrder[0]->vStateName)); } else { $this->ObTpl->set_var("TPL_VAR_BILLSTATE", $this->libFunc->m_displayContent($row_state[0]->vStateName)); } } else { $this->ObTpl->set_var("TPL_VAR_BILLSTATE", $this->libFunc->m_displayContent($rsOrder[0]->vStateName)); } $this->obDb->query = "SELECT vCountryName FROM " . COUNTRY . " where iCountryId_PK = '" . $rsOrder[0]->vCountry . "'"; $row_country = $this->obDb->fetchQuery(); $this->ObTpl->set_var("TPL_VAR_BILLCOUNTRY", $this->libFunc->m_displayContent($row_country[0]->vCountryName)); if (isset($rsOrder[0]->vAltState) && !empty($rsOrder[0]->vAltState)) { $this->obDb->query = "SELECT vStateName FROM " . STATES . " where iStateId_PK = '" . $rsOrder[0]->vAltState . "'"; $row_state = $this->obDb->fetchQuery(); if ($this->libFunc->m_displayContent($row_state[0]->vStateName) === 'Other') { $this->ObTpl->set_var("TPL_VAR_SHIPSTATE", $this->libFunc->m_displayContent($rsOrder[0]->vAltStateName)); } else { $this->ObTpl->set_var("TPL_VAR_SHIPSTATE", $this->libFunc->m_displayContent($row_state[0]->vStateName)); } } else { $this->ObTpl->set_var("TPL_VAR_SHIPSTATE", $this->libFunc->m_displayContent($rsOrder[0]->vAltStateName)); } $this->obDb->query = "SELECT vCountryName FROM " . COUNTRY . " where iCountryId_PK = '" . $rsOrder[0]->vAltCountry . "'"; $row_country = $this->obDb->fetchQuery(); $this->ObTpl->set_var("TPL_VAR_SHIPCOUNTRY", $this->libFunc->m_displayContent($row_country[0]->vCountryName)); $this->ObTpl->set_var("TPL_VAR_BILLNAME", $this->libFunc->m_displayContent($rsOrder[0]->vFirstName) . " " . $this->libFunc->m_displayContent($rsOrder[0]->vLastName)); if ($rsOrder[0]->iCustomerid_FK > 0) { #IF ORDER PLACED BY REGISTERED USER $this->ObTpl->parse("registereduser_blk", "TPL_BLK_REGISTERED_USER"); } else { #IF ORDER IS PLACED BY NOT REGISTERD USER $this->ObTpl->parse("notregistereduser_blk", "TPL_BLK_NOTREGISTERED_USER"); } $this->ObTpl->set_var("TPL_VAR_EMAIL", $this->libFunc->m_displayContent($rsOrder[0]->vEmail)); $this->ObTpl->set_var("TPL_VAR_BILLADDRESS1", $this->libFunc->m_displayContent($rsOrder[0]->vAddress1)); $this->ObTpl->set_var("TPL_VAR_BILLADDRESS2", $this->libFunc->m_displayContent($rsOrder[0]->vAddress2)); $this->ObTpl->set_var("TPL_VAR_CITY", $this->libFunc->m_displayContent($rsOrder[0]->vCity)); $this->ObTpl->set_var("TPL_VAR_BILLZIP", $this->libFunc->m_displayContent($rsOrder[0]->vZip)); $this->ObTpl->set_var("TPL_VAR_COMPANY", $this->libFunc->m_displayContent($rsOrder[0]->vCompany)); $this->ObTpl->set_var("TPL_VAR_BILLPHONE", $this->libFunc->m_displayContent($rsOrder[0]->vPhone)); $this->ObTpl->set_var("TPL_VAR_HOMEPAGE", $this->libFunc->m_displayContent($rsOrder[0]->vHomepage)); $this->ObTpl->set_var("TPL_VAR_MPOINTS", ""); if ($rsOrder[0]->iSameAsBilling == 1) { $this->ObTpl->set_var("TPL_VAR_SAMEASBILLING", "Same as billing address"); } else { $this->ObTpl->parse("delivery_blk", "TPL_DELIVERY_BLK"); } $this->ObTpl->set_var("TPL_VAR_ALTCOMPANY", $this->libFunc->m_displayContent($rsOrder[0]->vAltCompany)); $this->ObTpl->set_var("TPL_VAR_SHIPNAME", $this->libFunc->m_displayContent($rsOrder[0]->vAltName)); $this->ObTpl->set_var("TPL_VAR_SHIPADDRESS1", $this->libFunc->m_displayContent($rsOrder[0]->vAltAddress1)); $this->ObTpl->set_var("TPL_VAR_SHIPADDRESS2", $this->libFunc->m_displayContent($rsOrder[0]->vAltAddress2) . "<br />"); $this->ObTpl->set_var("TPL_VAR_ALTCITY", $this->libFunc->m_displayContent($rsOrder[0]->vAltCity)); $this->ObTpl->set_var("TPL_VAR_SHIPZIP", $this->libFunc->m_displayContent($rsOrder[0]->vAltZip)); $this->ObTpl->set_var("TPL_VAR_SHIPPHONE", $this->libFunc->m_displayContent($rsOrder[0]->vAltPhone)); if ($rsOrderProductCount > 0) { for ($i = 0; $i < $rsOrderProductCount; $i++) { $this->ObTpl->set_var("TPL_VAR_CART_VOLDISCOUNT", ""); $this->ObTpl->set_var("TPL_VAR_MAINOPTIONS", ""); $this->ObTpl->set_var("TPL_VAR_MAINCHOICES", ""); $this->ObTpl->set_var("kit_blk", ""); $this->ObTpl->set_var("TPL_VAR_FREESHIPMSG", ""); $this->ObTpl->set_var("TPL_VAR_TAXABLE", ""); $this->ObTpl->set_var("TPL_VAR_NOTES", ""); $this->price = 0; #INTIALIZING $this->total = 0; $comFunc->orderProductId = $rsOrderProduct[$i]->iOrderProductid_PK; $comFunc->qty = $rsOrderProduct[$i]->iQty; $comFunc->price = $this->price; ##CHECK FOR DROPSHIP FEATURE and SHOW IF SUPPLIER CONFIRMED THE PRODUCTS IN ORDER if ($rsOrderProduct[$i]->iVendorid_FK != 0 && DROP_SHIP_FEATURE != 0) { $this->obDb->query = "SELECT status FROM " . CONFIRMATIONORDERS . " WHERE iInvoice='" . $rsOrder[0]->iInvoice . "' AND iVendorid_FK='" . $rsOrderProduct[$i]->iVendorid_FK . "'"; $rsSOrderStatus = $this->obDb->fetchQuery(); if ($rsSOrderStatus[0]->status != "") { $this->ObTpl->set_var("TPL_VAR_SUPPLIERS_STATUS", "Supplier Status:" . $rsSOrderStatus[0]->status); } else { $this->ObTpl->set_var("TPL_VAR_SUPPLIERS_STATUS", ""); } } else { $this->ObTpl->set_var("TPL_VAR_SUPPLIERS_STATUS", ""); } ##GIFTWRAP URL if ($rsOrderProduct[$i]->iGiftwrapFK != 0) { $this->ObTpl->set_var("TPL_VAR_GIFTWRAP", $comFunc->m_dspGiftWrap($rsOrderProduct[$i]->iGiftwrapFK)); } else { $this->ObTpl->set_var("TPL_VAR_GIFTWRAP", ""); } $this->ObTpl->set_var("TPL_VAR_ISKIT", "0"); #PRODUCT ID FOR COMMON FUNCTION CLASS $comFunc->productId = $rsOrderProduct[$i]->iProductid_FK; if ($rsOrderProduct[$i]->iKit == 1) { $this->ObTpl->set_var("kit_blk", ""); $this->ObTpl->set_var("TPL_VAR_ISKIT", "1"); $this->obDb->query = "SELECT iProdId_FK,iQty,vTitle,vSeoTitle,vSku FROM " . PRODUCTKITS . "," . PRODUCTS . " WHERE iProdId_FK=iProdId_PK AND iKitId ='" . $rsOrderProduct[$i]->iProductid_FK . "'"; $rsKit = $this->obDb->fetchQuery(); $rsKitCount = $this->obDb->record_count; if ($rsKitCount > 0) { $this->ObTpl->set_var("kit_blk", ""); $this->ObTpl->set_var("kitElement_blk", ""); for ($j = 0; $j < $rsKitCount; $j++) { $this->ObTpl->set_var("TPL_VAR_OPTIONS", ""); $this->ObTpl->set_var("TPL_VAR_COUNT", $j + 1); $kitElementUrl = SITE_URL . "ecom/index.php?action=ecom.pdetails&mode=" . $rsKit[$j]->vSeoTitle; $comFunc->kitProductId = $rsKit[$j]->iProdId_FK; $comFunc->productId = $rsKit[$j]->iProdId_FK; #GET CART OPTIONS $kitOptions = $comFunc->m_orderKitProductOptions(); $this->ObTpl->set_var("TPL_VAR_KITSKU", $rsKit[$j]->vSku); $this->ObTpl->set_var("TPL_VAR_QTY", $rsKit[$j]->iQty); // print_r($comFunc->selectedOrderOptionId); #GET OPTIONS $this->ObTpl->set_var("TPL_VAR_OPTIONS", $comFunc->m_getOptions('1', $comFunc->selectedOptions, $comFunc->selectedOrderOptionId)); $this->ObTpl->set_var("TPL_VAR_KITELEMENT_URL", $this->libFunc->m_safeUrl($kitElementUrl)); $this->ObTpl->set_var("TPL_VAR_KITELEMENT", $this->libFunc->m_displayContent($rsKit[$j]->vTitle)); $this->ObTpl->parse("kitElement_blk", "TPL_KITELEMENT_BLK", true); } #END FOR I LOOP $this->ObTpl->parse("kit_blk", "TPL_KIT_BLK"); } #END IF } else { $comFunc->m_orderProductOptions(); $comFunc->m_orderProductChoices(); #GET OPTIONS $this->ObTpl->set_var("TPL_VAR_MAINOPTIONS", $comFunc->m_getOptions('0', $comFunc->selectedOptions, $comFunc->selectedOrderOptionId)); #GET CHOICES $this->ObTpl->set_var("TPL_VAR_MAINCHOICES", $comFunc->m_getChoices($comFunc->selectedChoices)); } # (OPTION And choice effected amount) $this->price = $comFunc->price; #VOLUME DISCOUNT #DISCOUNT ACCORDING TO QTY $vDiscountPerCartElement = number_format($rsOrderProduct[$i]->fDiscount, 2); if ($vDiscountPerCartElement > 0) { $totalDiscountItem = $vDiscountPerCartElement * $rsOrderProduct[$i]->iQty; $this->ObTpl->set_var("TPL_VAR_CART_VOLDISCOUNT", "Volume Discount: " . CONST_CURRENCY . $vDiscountPerCartElement . " each Total: " . CONST_CURRENCY . $totalDiscountItem . "<br />"); $this->volDiscount = $this->volDiscount + $totalDiscountItem; } if ($rsOrderProduct[$i]->iFreeship == 1) { $this->ObTpl->set_var("TPL_VAR_FREESHIPMSG", "<em>" . LBL_FREEPP . "</em><br />"); } if ($rsOrderProduct[$i]->iTaxable != 1) { if (HIDENOVAT != 1) { $this->ObTpl->set_var("TPL_VAR_TAXABLE", "<em>" . LBL_NOTAX . "</em><br />"); } else { $this->ObTpl->set_var("TPL_VAR_TAXABLE", ""); } } if (!empty($rsOrderProduct[$i]->vPostageNotes)) { $this->ObTpl->set_var("TPL_VAR_NOTES", "Notes: " . $this->libFunc->m_displayContent($rsOrderProduct[$i]->vPostageNotes) . "<br />"); } $productUrl = SITE_URL . "ecom/index.php?action=ecom.pdetails&mode=" . $rsOrderProduct[$i]->seo_title; $this->ObTpl->set_var("TPL_VAR_PRODUCTURL", $productUrl); $this->ObTpl->set_var("TPL_VAR_ORDERPRODUCTID", $rsOrderProduct[$i]->iOrderProductid_PK); $this->ObTpl->set_var("TPL_VAR_PRODUCTID", $rsOrderProduct[$i]->iProductid_FK); $this->ObTpl->set_var("TPL_VAR_TITLE", $this->libFunc->m_displayContent($rsOrderProduct[$i]->vTitle)); $this->ObTpl->set_var("TPL_VAR_SKU", $this->libFunc->m_displayContent($rsOrderProduct[$i]->vSku)); $this->price = $this->price + $rsOrderProduct[$i]->fPrice; $this->ObTpl->set_var("TPL_VAR_PRICE", number_format($this->price, 2)); $this->ObTpl->set_var("TPL_VAR_QTY", $rsOrderProduct[$i]->iQty); $this->totalQty += $rsOrderProduct[$i]->iQty; $this->total += $rsOrderProduct[$i]->iQty * $this->price; $this->ObTpl->set_var("TPL_VAR_TOTAL", number_format($this->total, 2)); $this->subTotal = $this->subTotal + $this->total; $this->ObTpl->parse("cartproduct_blk", "TPL_PRODUCT_BLK", true); } #END FOR #END PRODUCT DISPLAY #******************** SUB TOTAL **************** ************* $this->ObTpl->set_var("TPL_VAR_SUBTOTAL", number_format($this->subTotal, 2)); $this->grandTotal = $this->subTotal; $this->subTotal -= $this->volDiscount; #******************** PROMOTION CODE ************************ if ($rsOrder[0]->fPromoValue > 0) { $this->ObTpl->set_var("TPL_VAR_PDISCOUNTS", number_format($rsOrder[0]->fPromoValue, 2)); $this->grandTotal -= $rsOrder[0]->fPromoValue; $this->ObTpl->parse("promodiscounts_blk", "TPL_PROMODISCOUNTS_BLK"); } #******************** VOLUME DISCOUNT ************************ if ($this->volDiscount > 0) { $this->ObTpl->set_var("TPL_VAR_VOLDISCOUNT", number_format($this->volDiscount, 2)); $this->ObTpl->parse("volDiscounts_blk", "TPL_VOLDISCOUNTS_BLK"); } #CART WEIGHT ******* if ($rsOrder[0]->fShipByWeightPrice > 0) { $this->ObTpl->set_var("TPL_VAR_WEIGHT", $rsOrder[0]->fShipByWeightKg); $this->ObTpl->set_var("TPL_VAR_WEIGHTPRICE", number_format($rsOrder[0]->fShipByWeightPrice, 2)); $this->grandTotal += $rsOrder[0]->fShipByWeightPrice; $this->ObTpl->parse("cartWeight_blk", "TPL_CARTWEIGHT_BLK"); } #MEMBER POINTS if ($rsOrder[0]->fMemberPoints > 0) { $this->ObTpl->set_var("TPL_VAR_MPOINTS", number_format($rsOrder[0]->fMemberPoints, 2)); $this->grandTotal -= number_format($rsOrder[0]->fMemberPoints, 2); $this->ObTpl->parse("memberpoint_blk", "TPL_MPOINTS_BLK"); } # code added for getting total earned points if ($rsOrder[0]->iEarnedPoints > 0) { $this->ObTpl->set_var("TPL_VAR_EMPOINTS", $rsOrder[0]->iEarnedPoints); $this->ObTpl->parse("earnedmemberpoint_blk", "TPL_EMPOINTS_BLK"); } # code added for getting total points $this->obDb->query = "SELECT fMemberPoints FROM " . CUSTOMERS . " WHERE iCustmerid_PK=" . $rsOrder[0]->iCustomerid_FK; $rsCust = $this->obDb->fetchQuery(); if ($rsCust[0]->fMemberPoints > 0) { $this->ObTpl->set_var("TPL_VAR_TMPOINTS", $rsCust[0]->fMemberPoints); $this->ObTpl->parse("totalmemberpoint_blk", "TPL_TMPOINTS_BLK"); } #POSTAGE CALCULATION if ($rsOrder[0]->fShipTotal > 0) { $this->ObTpl->set_var("TPL_VAR_POSTAGEMETHOD", "Postage method (" . $rsOrder[0]->vShipDescription . ")"); $this->ObTpl->set_var("TPL_VAR_POSTAGEPRICE", CONST_CURRENCY . number_format($rsOrder[0]->fShipTotal, 2)); $this->grandTotal += number_format($rsOrder[0]->fShipTotal, 2); $this->ObTpl->parse("postage_blk", "TPL_POSTAGE_BLK"); } elseif ($rsOrder[0]->vShipDescription == "Free P&P") { $this->ObTpl->set_var("TPL_VAR_POSTAGEMETHOD", $rsOrder[0]->vShipDescription); $this->ObTpl->set_var("TPL_VAR_POSTAGEPRICE", "No Charge"); $this->ObTpl->parse("postage_blk", "TPL_POSTAGE_BLK"); } #COD PRICE(PAYMENT GATEWAY ADDITIONAL PRICE) if ($rsOrder[0]->fCodCharge > 0) { $this->ObTpl->set_var("TPL_VAR_CODPRICE", number_format($rsOrder[0]->fCodCharge, 2)); $this->grandTotal += number_format($rsOrder[0]->fCodCharge, 2); $this->ObTpl->parse("cod_blk", "TPL_COD_BLK"); } #CHECK FOR DISCOUNTS if ($rsOrder[0]->fDiscount != 0) { $this->ObTpl->set_var("TPL_VAR_DISCOUNTPRICE", number_format($rsOrder[0]->fDiscount, 2)); $this->grandTotal -= number_format($rsOrder[0]->fDiscount, 2); $this->ObTpl->parse("discount_blk", "TPL_DISCOUNT_BLK"); } #END DIS #CHECK FOR GIFTCERTIFICATES if ($rsOrder[0]->fGiftcertTotal != 0) { $this->grandTotal -= number_format($rsOrder[0]->fGiftcertTotal, 2); $this->ObTpl->set_var("TPL_VAR_GIFTCERTPRICE", number_format($rsOrder[0]->fGiftcertTotal, 2)); $this->ObTpl->parse("giftcert_blk", "TPL_GIFTCERT_BLK"); } #END GIFT CERTIFICATE #CHECK FOR VAT if ($rsOrder[0]->fTaxPrice > 0) { $this->ObTpl->set_var("TPL_VAR_VAT", number_format($rsOrder[0]->fTaxRate, 2)); $this->ObTpl->set_var("TPL_VAR_VATPRICE", number_format($rsOrder[0]->fTaxPrice, 2)); $this->grandTotal += number_format($rsOrder[0]->fTaxPrice, 2); $this->ObTpl->parse("vat_blk", "TPL_VAT_BLK"); } $this->ObTpl->set_var("TPL_VAR_CURRENTTOTAL", number_format($rsOrder[0]->fTotalPrice, 2)); $this->ObTpl->parse("cart_blk", "TPL_CART_BLK"); $this->ObTpl->parse("link_blk", "TPL_LINK_BLK"); $this->ObTpl->set_var("TPL_VAR_MESSAGE", ""); } else { $this->ObTpl->set_var("TPL_VAR_MESSAGE", MSG_NO_ORDER); $this->ObTpl->parse("msg_blk", "TPL_MSG_BLK"); } } else { $this->ObTpl->set_var("TPL_VAR_MESSAGE", MSG_NO_ORDER); $this->ObTpl->parse("msg_blk", "TPL_MSG_BLK"); } } #END URL TEMPER IF return $this->ObTpl->parse("return", "TPL_ORDER_FILE"); }