function m_sendOrdersDetails() { $comFunc = new c_commonFunctions(); $comFunc->obDb = $this->obDb; #INTIALIZING TEMPLATES $this->ObTpl = new template(); $this->ObTpl->set_file("TPL_ORDERMAIL_FILE", MODULES_PATH . "order/templates/admin/orderMailDownload.tpl.htm"); #SETTING BLOCKS $this->ObTpl->set_block("TPL_ORDERMAIL_FILE", "TPL_CART_BLK", "cart_blk"); $this->ObTpl->set_block("TPL_ORDERMAIL_FILE", "TPL_DELIVERY_BLK", "delivery_blk"); $this->ObTpl->set_block("TPL_CART_BLK", "TPL_VAR_CARTPRODUCTS", "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_VAR_CARTPRODUCTS", "TPL_KIT_BLK", "kit_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"); $this->ObTpl->set_block("TPL_CART_BLK", "TPL_EMPOINTS_BLK", "earnedmemberpoint_blk"); $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"); #INTIALIZING $this->ObTpl->set_var("TPL_VAR_SITEURL", SITE_SAFEURL); $this->ObTpl->set_var("TPL_VAR_GRAPHICSURL", GRAPHICS_PATH); $this->ObTpl->set_var("TPL_VAR_CURRENCY", CONST_CURRENCY); $this->ObTpl->set_var("TPL_VAR_CART_VOLDISCOUNT", ""); #INTAILAIZING $this->ObTpl->set_var("delivery_blk", ""); $this->ObTpl->set_var("cart_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", ""); $this->ObTpl->set_var("earnedmemberpoint_blk", ""); $this->ObTpl->set_var("totalmemberpoint_blk", ""); $this->ObTpl->set_var("vat_blk", ""); $this->ObTpl->set_var("TPL_VAR_MSG", ""); $this->ObTpl->set_var("TPL_VAR_SAMEASBILLING", ""); $this->ObTpl->set_var("TPL_VAR_COMPANY_DETAILS", $comFunc->m_mailFooter()); $downloadVariable = ""; #QUERY ORDER TABLE $this->obDb->query = "SELECT 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 .= "vAltName,vAltAddress1,vAltAddress2,vAltCity,vAltState,vAltCountry,"; $this->obDb->query .= "vAltStateName,vAltZip,vAltPhone,fCodCharge,fPromoValue,"; $this->obDb->query .= "vDiscountCode,fDiscount,iGiftcert_FK,fGiftcertTotal,fMemberPoints,"; $this->obDb->query .= "fShipByWeightPrice,fShipByWeightKg,iSameAsBilling,"; $this->obDb->query .= "fTaxRate,fTaxPrice,tComments,vStatus,iPayStatus,fTotalPrice,iEarnedPoints,iCustomerid_FK"; $this->obDb->query .= " FROM " . ORDERS . " WHERE iOrderid_PK='" . $this->request['orderid'] . "'"; $qryResult = $this->obDb->fetchQuery(); //echo "<pre>";print_r($qryResult);exit; $rCount = $this->obDb->record_count; if ($rCount != 1) { $errrorUrl = SITE_URL . "index.php?action=error&mode=order"; $this->libFunc->m_mosRedirect($this->libFunc->m_safeUrl($errrorUrl)); } if ($rCount > 0) { $this->ObTpl->set_var("TPL_VAR_INVOICE", $qryResult[0]->iInvoice); $this->ObTpl->set_var("TPL_VAR_ORDERDATE", $this->libFunc->dateFormat2($qryResult[0]->tmOrderDate)); if ($qryResult[0]->vPayMethod == 'cod') { $vPayMethod = $comFunc->m_paymentMethod($qryResult[0]->vPayMethod, $qryResult[0]->fCodCharge); } else { $vPayMethod = $comFunc->m_paymentMethod($qryResult[0]->vPayMethod); } $this->ObTpl->set_var("TPL_VAR_PAYMENTMETHOD", $vPayMethod); $this->ObTpl->set_var("TPL_VAR_POSTAGEMETHOD", $qryResult[0]->vShipDescription); $this->ObTpl->set_var("TPL_VAR_ORDERSTATUS", $this->request['status']); if (empty($qryResult[0]->tComments)) { $this->ObTpl->set_var("TPL_VAR_COMMENTS", "None"); } else { $this->ObTpl->set_var("TPL_VAR_COMMENTS", $qryResult[0]->tComments); } if (isset($qryResult[0]->vState) && !empty($qryResult[0]->vState)) { $this->obDb->query = "SELECT vStateName FROM " . STATES . " where iStateId_PK = '" . $qryResult[0]->vState . "'"; $row_state = $this->obDb->fetchQuery(); $this->ObTpl->set_var("TPL_VAR_BILLSTATE", $this->libFunc->m_displayContent($row_state[0]->vStateName)); } else { $this->ObTpl->set_var("TPL_VAR_BILLSTATE", $qryResult[0]->vStateName); } $this->obDb->query = "SELECT vCountryName FROM " . COUNTRY . " where iCountryId_PK = '" . $qryResult[0]->vCountry . "'"; $row_country = $this->obDb->fetchQuery(); $this->ObTpl->set_var("TPL_VAR_BILLCOUNTRY", $this->libFunc->m_displayContent($row_country[0]->vCountryName)); if (isset($qryResult[0]->vAltState) && !empty($qryResult[0]->vAltState)) { $this->obDb->query = "SELECT vStateName FROM " . STATES . " where iStateId_PK = '" . $qryResult[0]->vAltState . "'"; $row_state = $this->obDb->fetchQuery(); $this->ObTpl->set_var("TPL_VAR_SHIPSTATE", $this->libFunc->m_displayContent($row_state[0]->vStateName)); } else { $this->ObTpl->set_var("TPL_VAR_SHIPSTATE", $qryResult[0]->vAltStateName); } $this->obDb->query = "SELECT vCountryName FROM " . COUNTRY . " where iCountryId_PK = '" . $qryResult[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_FIRSTNAME", $this->libFunc->m_displayContent($qryResult[0]->vFirstName)); $this->ObTpl->set_var("TPL_VAR_LASTNAME", $this->libFunc->m_displayContent($qryResult[0]->vLastName)); $this->ObTpl->set_var("TPL_VAR_COMPANY", "(" . $this->libFunc->m_displayContent($qryResult[0]->vCompany) . ")"); $this->ObTpl->set_var("TPL_VAR_EMAIL", $this->libFunc->m_displayContent($qryResult[0]->vEmail)); $this->ObTpl->set_var("TPL_VAR_ADDRESS1", $this->libFunc->m_displayContent($qryResult[0]->vAddress1)); $this->ObTpl->set_var("TPL_VAR_ADDRESS2", $this->libFunc->m_displayContent($qryResult[0]->vAddress2)); $this->ObTpl->set_var("TPL_VAR_CITY", $this->libFunc->m_displayContent($qryResult[0]->vCity)); $this->ObTpl->set_var("TPL_VAR_ZIP", $this->libFunc->m_displayContent($qryResult[0]->vZip)); $this->ObTpl->set_var("TPL_VAR_COMPANY", $this->libFunc->m_displayContent($qryResult[0]->vCompany)); $this->ObTpl->set_var("TPL_VAR_PHONE", $this->libFunc->m_displayContent($qryResult[0]->vPhone)); $this->ObTpl->set_var("TPL_VAR_HOMEPAGE", $this->libFunc->m_displayContent($qryResult[0]->vHomepage)); $this->ObTpl->set_var("TPL_VAR_MPOINTS", ""); if ($this->libFunc->ifSet($_SESSION, "cssSelectedFile", "")) { $this->ObTpl->set_var("TPL_VAR_CSSFILE", trim($_SESSION['cssSelectedFile'])); } else { $this->ObTpl->set_var("TPL_VAR_CSSFILE", trim(DEFAULT_CSS)); } $this->ObTpl->set_var("TPL_VAR_CSSFILE", ""); if ($qryResult[0]->iSameAsBilling == 1) { $this->ObTpl->set_var("TPL_VAR_SAMEASBILLING", MSG_SAMEASBILLING); } else { $this->ObTpl->parse("delivery_blk", "TPL_DELIVERY_BLK"); } $this->ObTpl->set_var("TPL_VAR_ALTNAME", $this->libFunc->m_displayContent($qryResult[0]->vAltName)); $this->ObTpl->set_var("TPL_VAR_ALTADDR1", $this->libFunc->m_displayContent($qryResult[0]->vAltAddress1)); $this->ObTpl->set_var("TPL_VAR_ALTADDR2", $this->libFunc->m_displayContent($qryResult[0]->vAltAddress2)); $this->ObTpl->set_var("TPL_VAR_ALTCITY", $this->libFunc->m_displayContent($qryResult[0]->vAltCity)); $this->ObTpl->set_var("TPL_VAR_ALTZIP", $this->libFunc->m_displayContent($qryResult[0]->vAltZip)); $this->ObTpl->set_var("TPL_VAR_ALTPHONE", $this->libFunc->m_displayContent($qryResult[0]->vAltPhone)); $this->obDb->query = "SELECT iOrderProductid_PK,iProductid_FK,iQty,iGiftwrapFK,fPrice,"; $this->obDb->query .= "fDiscount,vTitle,vSku,iKit,tShortDescription,seo_title,iTaxable,iFreeship,vPostageNotes "; $this->obDb->query .= " FROM " . ORDERPRODUCTS . " WHERE iOrderid_FK='" . $this->request['orderid'] . "'"; $rsOrderProduct = $this->obDb->fetchQuery(); $rsOrderProductCount = $this->obDb->record_count; foreach ($rsOrderProduct as $key => $value) { $this->obDb->query = "SELECT vDownloadablefile FROM " . PRODUCTS . " WHERE iProdid_PK = '" . $rsOrderProduct[$key]->iProductid_FK . "'"; $downloadProduct = $this->obDb->fetchQuery(); $rsOrderProduct[$key]->vDownloadablefile = $downloadProduct[0]->vDownloadablefile; } if ($rsOrderProductCount > 0) { $id_rows = array(); for ($iSup = 0; $iSup < $rsOrderProductCount; $iSup++) { $id_rows[$iSup] = $rsOrderProduct[$iSup]->iProductid_FK; } #GETTING SUPPLIERS FROM PRODUCT TABLE $this->obDb->query = " SELECT distinct iVendorid_FK FROM " . PRODUCTS . " WHERE iVendorid_FK>0 AND iProdid_PK IN (" . implode(",", $id_rows) . ")"; $row = $this->obDb->fetchQuery(); $totalVendor = $this->obDb->record_count; if ($totalVendor > 0) { $this->ObTpl->set_var("TPL_VAR_TOTAL_SUPPLIER", $totalVendor); } else { $this->ObTpl->set_var("TPL_VAR_TOTAL_SUPPLIER", ""); } $comFunc->orderId = $this->request['orderid']; for ($i = 0; $i < $rsOrderProductCount; $i++) { $this->ObTpl->set_var("TPL_VAR_OPTIONS", ""); $this->ObTpl->set_var("TPL_VAR_CHOICES", ""); $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; $this->ObTpl->set_var("TPL_VAR_GIFTWRAP", ""); ##GIFTWRAP URL if ($rsOrderProduct[$i]->iGiftwrapFK != 0) { $this->ObTpl->set_var("TPL_VAR_GIFTWRAP", $comFunc->m_dspGiftWrap($rsOrderProduct[$i]->iGiftwrapFK)); } if ($rsOrderProduct[$i]->iKit == 1) { $this->obDb->query = "SELECT iKitItem_title,iProductid_FK FROM " . ORDERKITS . " WHERE iKitId='" . $rsOrderProduct[$i]->iProductid_FK . "' AND iProductOrderid_FK='" . $rsOrderProduct[$i]->iOrderProductid_PK . "'"; $rsKit = $this->obDb->fetchQuery(); $rsKitCount = $this->obDb->record_count; for ($j = 0; $j < $rsKitCount; $j++) { $comFunc->kitProductId = $rsKit[$j]->iProductid_FK; #GET CART OPTIONS $kitOptions = $comFunc->m_orderKitProductOptions(); if ($kitOptions == ' ') { $this->ObTpl->set_var("TPL_VAR_KITOPTIONS", ""); } else { $this->ObTpl->set_var("TPL_VAR_KITOPTIONS", $kitOptions); } $this->ObTpl->set_var("TPL_VAR_KITTITLE", $this->libFunc->m_displayContent($rsKit[$j]->iKitItem_title)); $this->ObTpl->parse("kit_blk", "TPL_KIT_BLK", true); } } else { #GET ORDERED PRODUCT OPTIONS $this->ObTpl->set_var("TPL_VAR_OPTIONS", $comFunc->m_orderProductOptions()); #GET ORDERED PRODUCT CHOICES $this->ObTpl->set_var("TPL_VAR_CHOICES", $comFunc->m_orderProductChoices()); } # (OPTION And choice effected amount) $this->price = $comFunc->price; #CHECK FOR DOWNLOADABLE FILE if ($qryResult[0]->vPayMethod == "mail" || $qryResult[0]->vPayMethod == "cod") { if (!empty($rsOrderProduct[$i]->vDownloadablefile)) { $downloadVariable = 1; $this->libFunc->m_checkFileExist($rsOrderProduct[$i]->vDownloadablefile, "files"); if ($this->libFunc->m_checkFileExist($rsOrderProduct[$i]->vDownloadablefile, "files")) { $downloadUrl = $this->libFunc->m_safeUrl(SITE_URL . "index.php?action=download&mode=" . $rsOrderProduct[$i]->iProductid_FK); $this->fileLink = "<a href='" . $downloadUrl . "'>Click here to download</a>"; $this->ObTpl->set_var("TPL_VAR_FILELINK", $this->fileLink); $this->ObTpl->parse("download_blk", "TPL_DOWNLOAD_BLK"); } } else { $this->ObTpl->set_var("TPL_VAR_FILELINK", ""); $this->ObTpl->parse("download_blk", "TPL_DOWNLOAD_BLK"); } } else { $this->ObTpl->set_var("TPL_VAR_FILELINK", ""); $this->ObTpl->parse("download_blk", "TPL_DOWNLOAD_BLK"); } #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; } $productUrl = SITE_URL . "ecom/index.php?action=ecom.pdetails&mode=" . $rsOrderProduct[$i]->seo_title; $this->ObTpl->set_var("TPL_VAR_PRODUCTURL", $this->libFunc->m_safeUrl($productUrl)); $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; if ($rsOrderProduct[$i]->iFreeship == 1) { $this->ObTpl->set_var("TPL_VAR_FREESHIPMSG", "<em>" . LBL_FREEPP . "</em><br />"); } if ($rsOrderProduct[$i]->iTaxable != 1) { $this->ObTpl->set_var("TPL_VAR_TAXABLE", "<em>" . LBL_NOTAX . "</em><br />"); } if (!empty($rsOrderProduct[$i]->vPostageNotes)) { $this->ObTpl->set_var("TPL_VAR_NOTES", "Notes: " . $this->libFunc->m_displayContent($rsOrderProduct[$i]->vPostageNotes) . "<br />"); } $this->ObTpl->parse("cartproduct_blk", "TPL_VAR_CARTPRODUCTS", true); } #END PRODUCT DISPLAY #******************** SUB TOTAL **************** ************* $this->ObTpl->set_var("TPL_VAR_SUBTOTAL", number_format($this->subTotal, 2, '.', '')); $this->grandTotal = $this->subTotal; #******************** PROMOTION CODE ************************ if ($qryResult[0]->fPromoValue > 0) { $this->ObTpl->set_var("TPL_VAR_PDISCOUNTS", number_format($qryResult[0]->fPromoValue, 2, '.', '')); $this->grandTotal -= number_format($qryResult[0]->fPromoValue, 2, '.', ''); $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->grandTotal -= $this->volDiscount; $this->ObTpl->parse("volDiscounts_blk", "TPL_VOLDISCOUNTS_BLK"); } #CART WEIGHT ******* if ($qryResult[0]->fShipByWeightPrice > 0 && ISACTIVE_ITEMWEIGHT == 1) { $this->ObTpl->set_var("TPL_VAR_WEIGHT", $qryResult[0]->fShipByWeightKg); $this->ObTpl->set_var("TPL_VAR_WEIGHTPRICE", number_format($qryResult[0]->fShipByWeightPrice, 2, '.', '')); $this->grandTotal += $qryResult[0]->fShipByWeightPrice; $this->ObTpl->parse("cartWeight_blk", "TPL_CARTWEIGHT_BLK"); } if ($qryResult[0]->fMemberPoints > 0) { $this->ObTpl->set_var("TPL_VAR_MPOINTS", number_format($qryResult[0]->fMemberPoints, 2, '.', '')); $this->grandTotal -= number_format($qryResult[0]->fMemberPoints, 2, '.', ''); $this->ObTpl->parse("memberpoint_blk", "TPL_MPOINTS_BLK"); } # code added for getting total earned points if ($qryResult[0]->iEarnedPoints > 0) { $this->ObTpl->set_var("TPL_VAR_EMPOINTS", number_format($qryResult[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=" . $qryResult[0]->iCustomerid_FK; $rsCust = $this->obDb->fetchQuery(); if ($rsCust[0]->fMemberPoints > 0) { $this->ObTpl->set_var("TPL_VAR_TMPOINTS", number_format($rsCust[0]->fMemberPoints, 0)); $memberpoint_price = MPOINTVALUE * $rsCust[0]->fMemberPoints; $this->ObTpl->set_var("TPL_VAR_TMPOINTS_PRICE", number_format($memberpoint_price, 2, '.', '')); $this->ObTpl->parse("totalmemberpoint_blk", "TPL_TMPOINTS_BLK"); } #POSTAGE CALCULATION************************** if ($qryResult[0]->fShipTotal > 0) { $this->ObTpl->set_var("TPL_VAR_POSTAGEMETHOD", "Postage method (" . $qryResult[0]->vShipDescription . ")"); $this->ObTpl->set_var("TPL_VAR_POSTAGEPRICE", CONST_CURRENCY . number_format($qryResult[0]->fShipTotal, 2, '.', '')); $this->grandTotal += number_format($qryResult[0]->fShipTotal, 2, '.', ''); $this->ObTpl->parse("postage_blk", "TPL_POSTAGE_BLK"); } elseif ($qryResult[0]->vShipDescription == "Free P&P") { $this->ObTpl->set_var("TPL_VAR_POSTAGEMETHOD", $qryResult[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 ($qryResult[0]->fCodCharge > 0) { $this->ObTpl->set_var("TPL_VAR_CODPRICE", number_format($qryResult[0]->fCodCharge, 2, '.', '')); $this->grandTotal += number_format($qryResult[0]->fCodCharge, 2, '.', ''); $this->ObTpl->parse("cod_blk", "TPL_COD_BLK"); } #CHECK FOR DISCOUNTS if ($qryResult[0]->fDiscount != 0) { $this->ObTpl->set_var("TPL_VAR_DISCOUNTPRICE", number_format($qryResult[0]->fDiscount, 2, '.', '')); $this->grandTotal -= number_format($qryResult[0]->fDiscount, 2, '.', ''); $this->ObTpl->parse("discount_blk", "TPL_DISCOUNT_BLK"); $curTime = time(); $this->obDb->query = "UPDATE " . DISCOUNTS . " SET iState=0 WHERE vCode='" . $qryResult[0]->vDiscountCode . "' AND tmStartDate<{$curTime} AND tmEndDate>{$curTime} AND iUseonce=1"; $this->obDb->updateQuery(); } #CHECK FOR GIFTCERTIFICATES if ($qryResult[0]->fGiftcertTotal != 0) { $this->grandTotal -= number_format($qryResult[0]->fGiftcertTotal, 2, '.', ''); $this->ObTpl->set_var("TPL_VAR_GIFTCERTPRICE", number_format($qryResult[0]->fGiftcertTotal, 2, '.', '')); $this->ObTpl->parse("giftcert_blk", "TPL_GIFTCERT_BLK"); } if ($qryResult[0]->fTaxPrice > 0) { $this->ObTpl->set_var("TPL_VAR_TAXNAME", VAT_TAX_TEXT); $this->ObTpl->set_var("TPL_VAR_VAT", number_format($qryResult[0]->fTaxRate, 2, '.', '')); $this->ObTpl->set_var("TPL_VAR_VATPRICE", number_format($qryResult[0]->fTaxPrice, 2, '.', '')); $this->ObTpl->parse("vat_blk", "TPL_VAT_BLK"); } $this->grandTotal += number_format($qryResult[0]->fDiscount, 2, '.', ''); $this->ObTpl->set_var("TPL_VAR_CURRENTTOTAL", number_format($qryResult[0]->fTotalPrice, 2, '.', '')); $this->ObTpl->parse("cart_blk", "TPL_CART_BLK"); } } #END ORDERS IF CONDITION $message = $this->ObTpl->parse("return", "TPL_ORDERMAIL_FILE"); $obMail = new htmlMimeMail(); $obMail->setReturnPath(ADMIN_EMAIL); $obMail->setFrom(SITE_NAME . "<" . ADMIN_EMAIL . ">"); $obMail->setSubject("Thank You for your order at " . SITE_NAME); $obMail->setCrlf("\n"); //to handle mails in Outlook Express $htmlcontent = $message; $txtcontent = preg_replace("/<([^>]+)>/", "", preg_replace("/<br(\\/{0,1})>/", "\r\n", $message)); $obMail->setHtml($htmlcontent, $txtcontent); $obMail->buildMessage(); if (preg_match("/^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,3})\$/i", ADMIN_EMAIL)) { if ($downloadVariable == "1" && ($qryResult[0]->vPayMethod == "mail" || $qryResult[0]->vPayMethod == "cod")) { $result = $obMail->send(array($qryResult[0]->vEmail)); } } $obMail->setSubject("Thank You for your order at " . SITE_NAME); $this->ObTpl->set_var("customer_blk", ""); $this->ObTpl->parse("admin_blk", "TPL_ADMIN_BLK"); $obMail->setSubject(SITE_NAME . " Invoice " . $qryResult[0]->iInvoice); $obMail->setCrlf("\n"); //to handle mails in Outlook Express $message = $this->ObTpl->parse("return", "TPL_ORDERMAIL_FILE"); $htmlcontent = $message; $txtcontent = preg_replace("/<([^>]+)>/", "", preg_replace("/<br(\\/{0,1})>/", "\r\n", $message)); $obMail->setHtml($htmlcontent, $txtcontent); $obMail->buildMessage(); if (preg_match("/^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,3})\$/i", ORDER_EMAIL)) { $result = $obMail->send(array(ORDER_EMAIL)); } #WIRELESS EMAIL $Name = $this->libFunc->m_displayContent($qryResult[0]->vFirstName) . " " . $this->libFunc->m_displayContent($qryResult[0]->vLastName); $obMail->setSubject(SITE_NAME . " Invoice " . $qryResult[0]->iInvoice); $obMail->setCrlf("\n"); //to handle mails in Outlook Express $wirelesscontent = "Invoice: " . $qryResult[0]->iInvoice . "<br />"; $wirelesscontent .= "Customer: " . $Name . "<br />"; $wirelesscontent .= "Total: " . CONST_CURRENCY . number_format($qryResult[0]->fTotalPrice, 2, '.', ''); $txtcontent = preg_replace("/<([^>]+)>/", "", preg_replace("/<br(\\/{0,1})>/", "\r\n", $wirelesscontent)); $obMail->setHtml($wirelesscontent, $txtcontent); $obMail->buildMessage(); if (preg_match("/^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,3})\$/i", WIRELESS_EMAIL)) { $result = $obMail->send(array(WIRELESS_EMAIL)); } }
function m_dspreceipt() { $comFunc = new c_commonFunctions(); $comFunc->obDb = $this->obDb; if (!isset($this->request['mode']) || empty($this->request['mode'])) { $errrorUrl = SITE_URL . "index.php?action=error&mode=order"; $this->libFunc->m_mosRedirect($this->libFunc->m_safeUrl($errrorUrl)); } $this->ObTpl = new template(); $this->ObTpl->set_file("TPL_REVIEW_FILE", $this->receiptTemplate); #SETTING BLOCKS $this->ObTpl->set_block("TPL_REVIEW_FILE", "TPL_CART_BLK", "cart_blk"); $this->ObTpl->set_block("TPL_REVIEW_FILE", "TPL_DELIVERY_BLK", "delivery_blk"); $this->ObTpl->set_block("TPL_REVIEW_FILE", "TPL_VAR_CARTPRODUCTS", "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_VAR_CARTPRODUCTS", "TPL_KIT_BLK", "kit_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"); $this->ObTpl->set_block("TPL_CART_BLK", "TPL_EMPOINTS_BLK", "earnedmemberpoint_blk"); $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"); #INTIALIZING $this->ObTpl->set_var("TPL_VAR_SITEURL", SITE_SAFEURL); $this->ObTpl->set_var("TPL_VAR_GRAPHICSURL", GRAPHICS_PATH); $this->ObTpl->set_var("TPL_VAR_CURRENCY", CONST_CURRENCY); $this->ObTpl->set_var("TPL_VAR_CART_VOLDISCOUNT", ""); $this->ObTpl->set_var("TPL_VAR_VAUTHCODE", "-"); #INTAILAIZING $this->ObTpl->set_var("delivery_blk", ""); $this->ObTpl->set_var("cart_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", ""); $this->ObTpl->set_var("earnedmemberpoint_blk", ""); $this->ObTpl->set_var("totalmemberpoint_blk", ""); $this->ObTpl->set_var("vat_blk", ""); $this->ObTpl->set_var("TPL_VAR_MSG", ""); $this->ObTpl->set_var("TPL_VAR_SAMEASBILLING", ""); // [DRK][MODIFIED BY NSI] $this->ObTpl->set_var("TPL_VAR_COMPANY_DETAILS", $comFunc->m_mailFooter()); // [/DRK] #QUERY ORDER TABLE $this->obDb->query = "SELECT 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,vAltCountry,"; $this->obDb->query .= "vAltStateName,vAltZip,vAltPhone,fCodCharge,fPromoValue,"; $this->obDb->query .= "vDiscountCode,fDiscount,iGiftcert_FK,fGiftcertTotal,fMemberPoints,"; $this->obDb->query .= "fShipByWeightPrice,fShipByWeightKg,iSameAsBilling,vAuthCode,"; $this->obDb->query .= "fTaxRate,fTaxPrice,tComments,vStatus,iPayStatus,fTotalPrice,iEarnedPoints,iCustomerid_FK"; $this->obDb->query .= " FROM " . ORDERS . " WHERE iOrderid_PK='" . $this->request['mode'] . "'"; if (isset($_SESSION['userid']) && !empty($_SESSION['userid'])) { $this->obDb->query .= " AND iCustomerid_FK='" . $_SESSION['userid'] . "'"; } else { $this->obDb->query .= " AND vEmail='" . $_SESSION['email'] . "'"; } $rsOrder = $this->obDb->fetchQuery(); $rsOrderCount = $this->obDb->record_count; $this->ObTpl->set_var("TPL_VAR_VAUTHCODE", $rsOrder[0]->vAuthCode); if ($rsOrderCount != 1) { $errrorUrl = SITE_URL . "index.php?action=error&mode=order"; $this->libFunc->m_mosRedirect($this->libFunc->m_safeUrl($errrorUrl)); } if ($rsOrderCount > 0) { $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); } else { $vPayMethod = $comFunc->m_paymentMethod($rsOrder[0]->vPayMethod); } $this->ObTpl->set_var("TPL_VAR_PAYMENTMETHOD", $vPayMethod); $this->ObTpl->set_var("TPL_VAR_POSTAGEMETHOD", $rsOrder[0]->vShipDescription); $this->ObTpl->set_var("TPL_VAR_ORDERSTATUS", ucfirst($rsOrder[0]->vStatus)); if (empty($rsOrder[0]->tComments)) { $this->ObTpl->set_var("TPL_VAR_COMMENTS", "None"); } else { $this->ObTpl->set_var("TPL_VAR_COMMENTS", $rsOrder[0]->tComments); } 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(); $this->ObTpl->set_var("TPL_VAR_BILLSTATE", $this->libFunc->m_displayContent($row_state[0]->vStateName)); } else { $this->ObTpl->set_var("TPL_VAR_BILLSTATE", $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(); $this->ObTpl->set_var("TPL_VAR_SHIPSTATE", $this->libFunc->m_displayContent($row_state[0]->vStateName)); } else { $this->ObTpl->set_var("TPL_VAR_SHIPSTATE", $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_FIRSTNAME", $this->libFunc->m_displayContent($rsOrder[0]->vFirstName)); $this->ObTpl->set_var("TPL_VAR_LASTNAME", $this->libFunc->m_displayContent($rsOrder[0]->vLastName)); $this->ObTpl->set_var("TPL_VAR_EMAIL", $this->libFunc->m_displayContent($rsOrder[0]->vEmail)); $this->ObTpl->set_var("TPL_VAR_ADDRESS1", $this->libFunc->m_displayContent($rsOrder[0]->vAddress1)); $this->ObTpl->set_var("TPL_VAR_ADDRESS2", $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_ZIP", $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_PHONE", $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", ""); # ADD EDIT AND MY ACCOUNT LINK $url_editOrder = SITE_URL . "ecom/index.php?action=checkout.editOrder&mode=" . $this->request['mode']; $this->ObTpl->set_var("TPL_VAR_MYACCOUNT_URL", SITE_URL . "user/index.php?action=user.home"); $this->ObTpl->set_var("TPL_VAR_EDITORDER_URL", $url_editOrder); if ($rsOrder[0]->iSameAsBilling == 1) { $this->ObTpl->set_var("TPL_VAR_SAMEASBILLING", MSG_SAMEASBILLING); } else { $this->ObTpl->parse("delivery_blk", "TPL_DELIVERY_BLK"); } if (isset($rsOrder[0]->vAltCompany) && !empty($rsOrder[0]->vAltCompany)) { $this->ObTpl->set_var("TPL_VAR_ALTCOMPANY", $this->libFunc->m_displayContent($rsOrder[0]->vAltCompany)); } else { $this->ObTpl->set_var("TPL_VAR_ALTCOMPANY", ""); } $this->ObTpl->set_var("TPL_VAR_ALTNAME", $this->libFunc->m_displayContent($rsOrder[0]->vAltName)); $this->ObTpl->set_var("TPL_VAR_ALTADDR1", $this->libFunc->m_displayContent($rsOrder[0]->vAltAddress1)); $this->ObTpl->set_var("TPL_VAR_ALTADDR2", $this->libFunc->m_displayContent($rsOrder[0]->vAltAddress2)); $this->ObTpl->set_var("TPL_VAR_ALTCITY", $this->libFunc->m_displayContent($rsOrder[0]->vAltCity)); $this->ObTpl->set_var("TPL_VAR_ALTZIP", $this->libFunc->m_displayContent($rsOrder[0]->vAltZip)); $this->ObTpl->set_var("TPL_VAR_ALTPHONE", $this->libFunc->m_displayContent($rsOrder[0]->vAltPhone)); $this->obDb->query = "SELECT iOrderProductid_PK,iProductid_FK,iQty,iGiftwrapFK,fPrice,"; $this->obDb->query .= "fDiscount,vTitle,vSku,iKit,tShortDescription,vSeoTitle,iTaxable,iFreeship,vPostageNotes,seo_title "; $this->obDb->query .= " FROM " . ORDERPRODUCTS . " WHERE iOrderid_FK='" . $this->request['mode'] . "'"; $rsOrderProduct = $this->obDb->fetchQuery(); $rsOrderProductCount = $this->obDb->record_count; if ($rsOrderProductCount > 0) { $id_rows = array(); for ($iSup = 0; $iSup < $rsOrderProductCount; $iSup++) { $id_rows[$iSup] = $rsOrderProduct[$iSup]->iProductid_FK; } $this->obDb->query = " SELECT distinct iVendorid_FK FROM " . PRODUCTS . " WHERE iVendorid_FK>0 AND iProdid_PK IN (" . implode(",", $id_rows) . ")"; $row = $this->obDb->fetchQuery(); $totalVendor = $this->obDb->record_count; if ($totalVendor > 0) { $this->ObTpl->set_var("TPL_VAR_TOTAL_SUPPLIER", $totalVendor); } else { $this->ObTpl->set_var("TPL_VAR_TOTAL_SUPPLIER", ""); } $comFunc->orderId = $this->request['mode']; for ($i = 0; $i < $rsOrderProductCount; $i++) { $this->ObTpl->set_var("TPL_VAR_OPTIONS", ""); $this->ObTpl->set_var("TPL_VAR_CHOICES", ""); $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; $this->ObTpl->set_var("TPL_VAR_GIFTWRAP", ""); ##GIFTWRAP URL if ($rsOrderProduct[$i]->iGiftwrapFK != 0) { $this->ObTpl->set_var("TPL_VAR_GIFTWRAP", $comFunc->m_dspGiftWrap($rsOrderProduct[$i]->iGiftwrapFK)); } if ($rsOrderProduct[$i]->iKit == 1) { $this->obDb->query = "SELECT iKitItem_title,iProductid_FK FROM " . ORDERKITS . " WHERE iKitId='" . $rsOrderProduct[$i]->iProductid_FK . "' AND iProductOrderid_FK='" . $rsOrderProduct[$i]->iOrderProductid_PK . "'"; $rsKit = $this->obDb->fetchQuery(); $rsKitCount = $this->obDb->record_count; for ($j = 0; $j < $rsKitCount; $j++) { $comFunc->kitProductId = $rsKit[$j]->iProductid_FK; #GET CART OPTIONS $kitOptions = $comFunc->m_orderKitProductOptions(); if ($kitOptions == ' ') { $this->ObTpl->set_var("TPL_VAR_KITOPTIONS", ""); } else { $this->ObTpl->set_var("TPL_VAR_KITOPTIONS", $kitOptions); } $this->ObTpl->set_var("TPL_VAR_KITTITLE", $this->libFunc->m_displayContent($rsKit[$j]->iKitItem_title)); $this->ObTpl->parse("kit_blk", "TPL_KIT_BLK", true); } } else { #GET ORDERED PRODUCT OPTIONS $this->ObTpl->set_var("TPL_VAR_OPTIONS", $comFunc->m_orderProductOptions()); #GET ORDERED PRODUCT CHOICES $this->ObTpl->set_var("TPL_VAR_CHOICES", $comFunc->m_orderProductChoices()); } # (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; } $productUrl = SITE_URL . "ecom/index.php?action=ecom.pdetails&mode=" . $rsOrderProduct[$i]->seo_title; $this->ObTpl->set_var("TPL_VAR_PRODUCTURL", $this->libFunc->m_safeUrl($productUrl)); $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; 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 />"); } $this->ObTpl->parse("cartproduct_blk", "TPL_VAR_CARTPRODUCTS", true); } #END PRODUCT DISPLAY #******************** SUB TOTAL **************** ************* $this->ObTpl->set_var("TPL_VAR_SUBTOTAL", number_format($this->subTotal, 2, '.', '')); $this->grandTotal = $this->subTotal; #******************** PROMOTION CODE ************************ if ($rsOrder[0]->fPromoValue > 0) { $this->ObTpl->set_var("TPL_VAR_PDISCOUNTS", number_format($rsOrder[0]->fPromoValue, 2, '.', '')); $this->grandTotal -= number_format($rsOrder[0]->fPromoValue, 2, '.', ''); $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->grandTotal -= $this->volDiscount; $this->ObTpl->parse("volDiscounts_blk", "TPL_VOLDISCOUNTS_BLK"); } #CART WEIGHT ******* if ($rsOrder[0]->fShipByWeightPrice > 0 && ISACTIVE_ITEMWEIGHT == 1) { $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"); } 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", number_format($rsCust[0]->fMemberPoints, 0)); $memberpoint_price = MPOINTVALUE * $rsCust[0]->fMemberPoints; $this->ObTpl->set_var("TPL_VAR_TMPOINTS_PRICE", number_format($memberpoint_price, 2, '.', '')); $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"); } #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"); } if ($rsOrder[0]->fTaxPrice > 0) { $this->ObTpl->set_var("TPL_VAR_TAXNAME", VAT_TAX_TEXT); $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->ObTpl->parse("vat_blk", "TPL_VAT_BLK"); } $this->grandTotal += number_format($rsOrder[0]->fDiscount, 2, '.', ''); $this->ObTpl->set_var("TPL_VAR_CURRENTTOTAL", number_format($rsOrder[0]->fTotalPrice, 2, '.', '')); $this->ObTpl->parse("cart_blk", "TPL_CART_BLK"); } } #END ORDERS IF CONDITION return $this->ObTpl->parse("return", "TPL_REVIEW_FILE"); }