function m_insertUser() { $_SESSION['referer'] = $this->libFunc->ifSet($_SESSION, 'referer', ""); $comFunc = new c_commonFunctions(); $comFunc->obDb = $this->obDb; $timestamp = time(); $status = $this->libFunc->ifSet($this->request, "status", ""); if (!isset($this->request['bill_state_id']) || empty($this->request['bill_state_id'])) { $this->request['bill_state_id'] = ""; } else { $this->request['bill_state'] = ""; } $this->obDb->query = "select iCustmerid_PK FROM " . CUSTOMERS . " WHERE vEmail = '" . $this->request['txtemail'] . "'"; $qryResult = $this->obDb->fetchQuery(); $rCount = $this->obDb->record_count; if ($rCount == 1) { if ($this->request['customertype'] == "trade") { $this->obDb->query = "UPDATE " . CUSTOMERS . " SET vFirstName='" . $this->libFunc->m_addToDB($this->request['first_name']) . "',vLastName='" . $this->libFunc->m_addToDB($this->request['last_name']) . "',vPassword=PASSWORD('" . $this->libFunc->m_addToDB($this->request['txtpassword']) . "') ,vAddress1='" . $this->libFunc->m_addToDB($this->request['address1']) . "',vAddress2='" . $this->libFunc->m_addToDB($this->request['address2']) . "',vCity='" . $this->libFunc->m_addToDB($this->request['city']) . "',vState='" . $this->libFunc->m_addToDB($this->request['bill_state_id']) . "',vStateName='" . $this->libFunc->m_addToDB($this->request['bill_state']) . "',vCountry='" . $this->libFunc->m_addToDB($this->request['bill_country_id']) . "',vZip='" . $this->libFunc->m_addToDB($this->request['zip']) . "',vCompany='" . $this->libFunc->m_addToDB($this->request['company']) . "',vRetail='" . $this->libFunc->m_addToDB($this->request['customertype']) . "',vPhone='" . $this->libFunc->m_addToDB($this->request['phone']) . "',vHomePage='" . $this->libFunc->m_addToDB($this->request['homepage']) . "',iMailList='" . $this->request['mail_list'] . "',tmSignupDate='{$timestamp}',iRegistered='1' WHERE vEmail='" . $this->request['txtemail'] . "'"; $this->obDb->updateQuery(); $subObjId = $this->obDb->last_insert_id; $comFunc->m_sendDetails_trade($this->request['txtemail'], $this->request['txtpassword']); } else { $this->obDb->query = "UPDATE " . CUSTOMERS . " SET vFirstName='" . $this->libFunc->m_addToDB($this->request['first_name']) . "',vLastName='" . $this->libFunc->m_addToDB($this->request['last_name']) . "',vPassword=PASSWORD('" . $this->libFunc->m_addToDB($this->request['txtpassword']) . "') ,vAddress1='" . $this->libFunc->m_addToDB($this->request['address1']) . "',vAddress2='" . $this->libFunc->m_addToDB($this->request['address2']) . "',vCity='" . $this->libFunc->m_addToDB($this->request['city']) . "',vState='" . $this->libFunc->m_addToDB($this->request['bill_state_id']) . "',vStateName='" . $this->libFunc->m_addToDB($this->request['bill_state']) . "',vCountry='" . $this->libFunc->m_addToDB($this->request['bill_country_id']) . "',vZip='" . $this->libFunc->m_addToDB($this->request['zip']) . "',vCompany='" . $this->libFunc->m_addToDB($this->request['company']) . "',vRetail='" . $this->libFunc->m_addToDB($this->request['customertype']) . "',vPhone='" . $this->libFunc->m_addToDB($this->request['phone']) . "',vHomePage='" . $this->libFunc->m_addToDB($this->request['homepage']) . "',iMailList='" . $this->request['mail_list'] . "',tmSignupDate='{$timestamp}',iRegistered='1' WHERE vEmail='" . $this->request['txtemail'] . "'"; $this->obDb->updateQuery(); $subObjId = $this->obDb->last_insert_id; $comFunc->m_sendDetails($this->request['txtemail'], $this->request['txtpassword']); $_SESSION['userid'] = $subObjId; $_SESSION['username'] = $this->request['first_name']; } } else { #INSERTING CUSTOMER if ($this->request['customertype'] == "trade") { $this->obDb->query = "INSERT INTO " . CUSTOMERS . "\n\t\t\t\t\t(iCustmerid_PK,vFirstName,vLastName,\n\t\t\t\t\t vEmail ,vPassword ,vAddress1,vAddress2,vCity,\n\t\t\t\t\tvState,vStateName,vCountry,vZip,vCompany,vRetail,vPhone ,\n\t\t\t\t\t vHomePage ,iMailList,tmSignupDate,iStatus,iRegistered) \n\t\t\t\t\tvalues('',\n\t\t\t\t\t'" . $this->libFunc->m_addToDB($this->request['first_name']) . "',\n\t\t\t\t\t'" . $this->libFunc->m_addToDB($this->request['last_name']) . "',\n\t\t\t\t\t'" . $this->libFunc->m_addToDB($this->request['txtemail']) . "',\n\t\t\t\t\tPASSWORD('" . $this->libFunc->m_addToDB($this->request['txtpassword']) . "'),\n\t\t\t\t\t'" . $this->libFunc->m_addToDB($this->request['address1']) . "',\n\t\t\t\t\t'" . $this->libFunc->m_addToDB($this->request['address2']) . "',\n\t\t\t\t\t'" . $this->libFunc->m_addToDB($this->request['city']) . "',\n\t\t\t\t\t'" . $this->libFunc->m_addToDB($this->request['bill_state_id']) . "',\n\t\t\t\t\t'" . $this->libFunc->m_addToDB($this->request['bill_state']) . "',\n\t\t\t\t\t'" . $this->libFunc->m_addToDB($this->request['bill_country_id']) . "',\n\t\t\t\t\t'" . $this->libFunc->m_addToDB($this->request['zip']) . "',\n\t\t\t\t\t'" . $this->libFunc->m_addToDB($this->request['company']) . "',\n\t\t\t\t\t'" . $this->libFunc->m_addToDB($this->request['customertype']) . "',\n\t\t\t\t\t'" . $this->libFunc->m_addToDB($this->request['phone']) . "',\n\t\t\t\t\t'" . $this->libFunc->m_addToDB($this->request['homepage']) . "',\n\t\t\t\t\t'" . $this->request['mail_list'] . "',\t\n\t\t\t\t\t'{$timestamp}','1','1')"; $this->obDb->updateQuery(); $subObjId = $this->obDb->last_insert_id; $comFunc->m_sendDetails_trade($this->request['txtemail'], $this->request['txtpassword']); } else { $this->obDb->query = "INSERT INTO " . CUSTOMERS . "\n\t\t\t\t\t(iCustmerid_PK,vFirstName,vLastName,\n\t\t\t\t\tvEmail ,vPassword ,vAddress1,vAddress2,vCity,\n\t\t\t\t\tvState,vStateName,vCountry,vZip,vCompany,vRetail,vPhone ,\n\t\t\t\t\t vHomePage ,iMailList,tmSignupDate,iRegistered) \n\t\t\t\t\tvalues('',\n\t\t\t\t\t'" . $this->libFunc->m_addToDB($this->request['first_name']) . "',\n\t\t\t\t\t'" . $this->libFunc->m_addToDB($this->request['last_name']) . "',\n\t\t\t\t\t'" . $this->libFunc->m_addToDB($this->request['txtemail']) . "',\n\t\t\t\t\tPASSWORD('" . $this->libFunc->m_addToDB($this->request['txtpassword']) . "'),\n\t\t\t\t\t'" . $this->libFunc->m_addToDB($this->request['address1']) . "',\n\t\t\t\t\t'" . $this->libFunc->m_addToDB($this->request['address2']) . "',\n\t\t\t\t\t'" . $this->libFunc->m_addToDB($this->request['city']) . "',\n\t\t\t\t\t'" . $this->libFunc->m_addToDB($this->request['bill_state_id']) . "',\n\t\t\t\t\t'" . $this->libFunc->m_addToDB($this->request['bill_state']) . "',\n\t\t\t\t\t'" . $this->libFunc->m_addToDB($this->request['bill_country_id']) . "',\n\t\t\t\t\t'" . $this->libFunc->m_addToDB($this->request['zip']) . "',\n\t\t\t\t\t'" . $this->libFunc->m_addToDB($this->request['company']) . "',\n\t\t\t\t\t'" . $this->libFunc->m_addToDB($this->request['customertype']) . "',\n\t\t\t\t\t'" . $this->libFunc->m_addToDB($this->request['phone']) . "',\n\t\t\t\t\t'" . $this->libFunc->m_addToDB($this->request['homepage']) . "',\n\t\t\t\t\t'" . $this->request['mail_list'] . "',\t\n\t\t\t\t\t'{$timestamp}','1')"; $this->obDb->updateQuery(); $subObjId = $this->obDb->last_insert_id; $comFunc->m_sendDetails($this->request['txtemail'], $this->request['txtpassword']); $_SESSION['userid'] = $subObjId; $_SESSION['username'] = $this->request['first_name']; } } if (!empty($_SESSION['referer'])) { if ($this->request['customertype'] == "trade") { $retUrl = $this->libFunc->m_safeUrl(SITE_URL . "user/index.php?action=user.loginForm&tc=s"); $this->libFunc->m_mosRedirect($retUrl); } else { $this->libFunc->m_mosRedirect($_SESSION['referer']); } } else { $retUrl = $this->libFunc->m_safeUrl(SITE_URL . "user/index.php?action=user.home"); $this->libFunc->m_mosRedirect($retUrl); } exit; }
function m_insertUser() { $comFunc = new c_commonFunctions(); $comFunc->obDb = $this->obDb; $timestamp = time(); $this->request['status'] = $this->libFunc->ifSet($this->request, "status", ""); $this->request['bill_state_id'] = $this->libFunc->ifSet($this->request, "bill_state_id", ""); $this->request['bill_state'] = $this->libFunc->ifSet($this->request, "bill_state", ""); $this->request['customertype'] = $this->libFunc->ifSet($this->request, "vRetail", ""); #INSERTING CUSTOMER $this->obDb->query = "INSERT INTO " . CUSTOMERS . "\n\t\t(iCustmerid_PK,vFirstName,vLastName,\n\t\t vEmail ,vPassword ,vAddress1,vAddress2,vCity,\n\t\t vState,vStateName,vCountry,vRetail,vZip,vCompany ,vPhone ,\n\t\t\t vHomePage ,iMailList,fMemberPoints,iStatus,tmSignupDate,iRegistered) \n\t\t\tvalues('',\n\t\t\t'" . $this->libFunc->m_addToDB($this->request['first_name']) . "',\n\t\t\t'" . $this->libFunc->m_addToDB($this->request['last_name']) . "',\n\t\t\t'" . $this->libFunc->m_addToDB($this->request['txtemail']) . "',\n\t\t\tPASSWORD('" . $this->libFunc->m_addToDB($this->request['password']) . "'),\n\t\t\t'" . $this->libFunc->m_addToDB($this->request['address1']) . "',\n\t\t\t'" . $this->libFunc->m_addToDB($this->request['address2']) . "',\n\t\t\t'" . $this->libFunc->m_addToDB($this->request['city']) . "',\n\t\t\t'" . $this->libFunc->m_addToDB($this->request['bill_state_id']) . "',\n\t\t\t'" . $this->libFunc->m_addToDB($this->request['bill_state']) . "',\n\t\t\t'" . $this->libFunc->m_addToDB($this->request['bill_country_id']) . "',\n\t\t\t'" . $this->libFunc->m_addToDB($this->request['customertype']) . "',\n\t\t\t'" . $this->libFunc->m_addToDB($this->request['zip']) . "',\n\t\t\t'" . $this->libFunc->m_addToDB($this->request['company']) . "',\n\t\t\t'" . $this->libFunc->m_addToDB($this->request['phone']) . "',\n\t\t\t'" . $this->libFunc->m_addToDB($this->request['homepage']) . "',\n\t\t\t'" . $this->request['mail_list'] . "',\t\n\t\t\t'" . $this->libFunc->m_addToDB($this->request['member_points']) . "',\n\t\t\t'" . $this->request['status'] . "',\n\t\t\t'{$timestamp}','1')"; $this->obDb->updateQuery(); $subObjId = $this->obDb->last_insert_id; $comFunc->m_sendDetails($this->request['txtemail']); $this->libFunc->m_mosRedirect(SITE_URL . "user/adminindex.php?action=user.details&id={$subObjId}"); }
function m_saveBillShipInfo() { //CARDSAVE if ($this->request['paymethod'] == 'cs_redirect') { $_SESSION['MerchantID'] = $this->request['MerchantID']; $_SESSION['CSRPreshared'] = $this->request['CSRPreshared']; $_SESSION['CSRMerchantPass'] = $this->request['CSRMerchantPass']; $_SESSION['CallbackURL'] = $this->request['CallbackURL']; $_SESSION['CV2Mandatory'] = $this->request['CV2Mandatory']; $_SESSION['Address1Mandatory'] = $this->request['Address1Mandatory']; $_SESSION['CityMandatory'] = $this->request['CityMandatory']; $_SESSION['PostCodeMandatory'] = $this->request['PostCodeMandatory']; $_SESSION['StateMandatory'] = $this->request['StateMandatory']; $_SESSION['CountryMandatory'] = $this->request['CountryMandatory']; /////// $_SESSION['CSMerchantID'] = $this->request['CSMerchantID']; $_SESSION['CSPass'] = $this->request['CSPass']; $_SESSION['CSBaseURL'] = $this->request['CSBaseURL']; $_SESSION['CSPort'] = $this->request['CSPort']; } $libFunc = new c_libFunctions(); $comFunc = new c_commonFunctions(); $comFunc->obDb = $this->obDb; if (!isset($this->request['postagemethod'])) { $chosenid = 0; } else { $chosenid = $this->request['postagemethod']; } if (isset($this->request['ship_country_id']) && isset($this->request['ship_state_id']) && isset($this->request['alt_zip'])) { $country = $this->request['ship_country_id']; $state = $this->request['ship_state_id']; $zip = $this->request['alt_zip']; } else { $country = $this->request['bill_country_id']; $state = $this->request['bill_state_id']; $zip = $this->request['zip']; } $_SESSION['postagePrice2'] = $comFunc->caclulatePostage($country, $state, $zip, $_SESSION['subtotal'], $_SESSION['totalQty'], $_SESSION['cartweight'], $chosenid, $_SESSION['product_codes']); $_SESSION['postagePrice'] = $_SESSION['postagePrice2']; $_SESSION['payMethod'] = $this->request['paymethod']; if ($_SESSION['payMethod'] == "cod") { $_SESSION['codPrice'] = $this->request['codprice']; } else { $_SESSION['codPrice'] = ""; } if (isset($this->request['mail_list'])) { $_SESSION['mail_list'] = $this->request['mail_list']; } else { $_SESSION['mail_list'] = ""; } //Handling Discounts $_SESSION['discountCode'] = $this->request['discount']; $this->discountPrice = $comFunc->m_calculateDiscount($this->request['discount']); //Handling Gift certficates $_SESSION['giftCertCode'] = $this->request['giftcert']; $this->giftCertPrice = $comFunc->m_calculateGiftCertPrice($this->request['giftcert']); // Begin Card Holder Protx Modification if ($this->libFunc->ifSet($this->request, 'cardholder_name', '')) { $_SESSION['cardholder_name'] = $this->request['cardholder_name']; } else { $_SESSION['cardholder_name'] = $this->libFunc->ifSet($_SESSION, 'cardholder_name', ''); } // End Card Holder Protx Modification if ($this->libFunc->ifSet($this->request, 'cc_number', '')) { $_SESSION['cc_number'] = $this->request['cc_number']; } else { $_SESSION['cc_number'] = $this->libFunc->ifSet($_SESSION, 'cc_number', ''); } if ($this->libFunc->ifSet($this->request, 'cc_type', '')) { $_SESSION['cc_type'] = $this->request['cc_type']; } else { $_SESSION['cc_type'] = $this->libFunc->ifSet($_SESSION, 'cc_type', ''); } if ($this->libFunc->ifSet($this->request, 'cv2', '')) { $_SESSION['cv2'] = $this->request['cv2']; } else { $_SESSION['cv2'] = $this->libFunc->ifSet($_SESSION, 'cv2', ''); } if ($this->libFunc->ifSet($this->request, 'cc_year', '')) { $_SESSION['cc_year'] = $this->request['cc_year']; } else { $_SESSION['cc_year'] = $this->libFunc->ifSet($_SESSION, 'cc_year', ''); } if ($this->libFunc->ifSet($this->request, 'cc_month', '0')) { $_SESSION['cc_month'] = $this->request['cc_month']; } else { $_SESSION['cc_month'] = $this->libFunc->ifSet($_SESSION, 'cc_month', ''); } if ($this->libFunc->ifSet($this->request, 'cc_start_year', '0')) { $_SESSION['cc_start_year'] = $this->request['cc_start_year']; } else { $_SESSION['cc_start_year'] = $this->libFunc->ifSet($_SESSION, 'cc_start_year', ''); } if ($this->libFunc->ifSet($this->request, 'cc_start_month', '0')) { $_SESSION['cc_start_month'] = $this->request['cc_start_month']; } else { $_SESSION['cc_start_month'] = $this->libFunc->ifSet($_SESSION, 'cc_start_month', ''); } if ($this->libFunc->ifSet($this->request, 'issuenumber', '0')) { $_SESSION['issuenumber'] = $this->request['issuenumber']; } else { $_SESSION['issuenumber'] = $this->libFunc->ifSet($_SESSION, 'issuenumber', ''); } if ($this->libFunc->ifSet($this->request, 'acct', '0')) { $_SESSION['acct'] = $this->request['acct']; } else { $_SESSION['acct'] = $this->libFunc->ifSet($_SESSION, 'acct', '0'); } if ($this->libFunc->ifSet($this->request, 'aba', '0')) { $_SESSION['aba'] = $this->request['aba']; } else { $_SESSION['aba'] = $this->libFunc->ifSet($_SESSION, 'aba', '0'); } //---- if (!isset($this->request['bill_state_id']) || empty($this->request['bill_state_id'])) { $this->request['bill_state_id'] = ""; } else { $this->request['bill_state'] = ""; } if (!isset($this->request['ship_state_id']) || empty($this->request['ship_state_id'])) { $this->request['ship_state_id'] = ""; } else { $this->request['ship_state'] = ""; } if (isset($_SESSION['userid']) && !empty($_SESSION['userid'])) { #INSERTING CUSTOMER $this->obDb->query = "UPDATE " . CUSTOMERS . " SET \n\t\t\tvFirstName='" . $this->libFunc->m_addToDB($this->request['first_name']) . "',\n\t\t\tvLastName='" . $this->libFunc->m_addToDB($this->request['last_name']) . "',\n\t\t\tvAddress1='" . $this->libFunc->m_addToDB($this->request['address1']) . "',\n\t\t\tvAddress2='" . $this->libFunc->m_addToDB($this->request['address2']) . "',\n\t\t\tvCity='" . $this->libFunc->m_addToDB($this->request['city']) . "',\n\t\t\tvState='" . $this->libFunc->m_addToDB($this->request['bill_state_id']) . "',\n\t\t\tvStateName='" . $this->libFunc->m_addToDB($this->request['bill_state']) . "',\n\t\t\tvCountry='" . $this->libFunc->m_addToDB($this->request['bill_country_id']) . "',\n\t\t\tvZip='" . $this->libFunc->m_addToDB($this->request['zip']) . "',\n\t\t\tvCompany ='" . $this->libFunc->m_addToDB($this->request['company']) . "',\n\t\t\tvPhone ='" . $this->libFunc->m_addToDB($this->request['phone']) . "',\n\t\t\tvHomePage ='" . $this->libFunc->m_addToDB($this->request['homepage']) . "'\n\t\t\tWHERE (iCustmerid_PK ='" . $_SESSION['userid'] . "')"; $this->obDb->updateQuery(); $_SESSION['first_name'] = $this->request['first_name']; $_SESSION['last_name'] = $this->request['last_name']; $_SESSION['email'] = $this->request['email']; $_SESSION['address1'] = $this->request['address1']; $_SESSION['address2'] = $this->request['address2']; $_SESSION['city'] = $this->request['city']; $_SESSION['bill_state_id'] = $this->request['bill_state_id']; $_SESSION['bill_state'] = $this->request['bill_state']; $_SESSION['bill_country_id'] = $this->request['bill_country_id']; $_SESSION['zip'] = $this->request['zip']; $_SESSION['company'] = $this->request['company']; $_SESSION['comments'] = $this->libFunc->m_displayContent($this->request['comments']); $_SESSION['phone'] = $this->request['phone']; $_SESSION['homepage'] = $this->request['homepage']; } else { $_SESSION['customer'] = 'set'; #CUSTOMER DATA IN SESSION $this->request['txtpassword'] = $this->libFunc->ifSet($this->request, "txtpassword", ""); #MODIFIED BY HSG 16-03-07 if (empty($this->request['txtpassword'])) { $_SESSION['withoutlogin'] = 1; } else { $_SESSION['withoutlogin'] = ""; } $_SESSION['txtpassword'] = $this->request['txtpassword']; $_SESSION['first_name'] = $this->request['first_name']; $_SESSION['last_name'] = $this->request['last_name']; $_SESSION['email'] = $this->request['email']; $_SESSION['address1'] = $this->request['address1']; $_SESSION['address2'] = $this->request['address2']; $_SESSION['city'] = $this->request['city']; $_SESSION['bill_state_id'] = $this->request['bill_state_id']; $_SESSION['bill_state'] = $this->request['bill_state']; $_SESSION['bill_country_id'] = $this->request['bill_country_id']; $_SESSION['zip'] = $this->request['zip']; $_SESSION['comments'] = $this->libFunc->m_displayContent($this->request['comments']); $_SESSION['company'] = $this->request['company']; $_SESSION['phone'] = $this->request['phone']; $_SESSION['homepage'] = $this->request['homepage']; } $_SESSION['alt_ship'] = $this->libFunc->ifSet($this->request, "alt_ship", 0); if (DELIVERY_ADDRESS == 1) { $_SESSION['alt_name'] = $this->request['alt_fName'] . " " . $this->request['alt_lName']; $_SESSION['alt_fName'] = $this->request['alt_fName']; $_SESSION['alt_lName'] = $this->request['alt_lName']; $_SESSION['alt_address1'] = $this->request['alt_address1']; $_SESSION['alt_address2'] = $this->request['alt_address2']; $_SESSION['alt_city'] = $this->request['alt_city']; $_SESSION['ship_country_id'] = $this->request['ship_country_id']; $_SESSION['alt_company'] = $this->request['alt_company']; if (isset($this->request['ship_state_id']) && $this->request['ship_state_id'] > 0) { $_SESSION['ship_state_id'] = $this->request['ship_state_id']; } else { $_SESSION['ship_state'] = $this->request['ship_state']; $_SESSION['ship_state_id'] = ""; } $_SESSION['alt_zip'] = $this->request['alt_zip']; $_SESSION['alt_phone'] = $this->request['alt_phone']; if ($_SESSION['alt_ship'] == 1) { $_SESSION['ship_country_id'] = $this->request['bill_country_id']; $_SESSION['ship_state_id'] = $this->request['bill_state_id']; } } else { $_SESSION['alt_ship'] = 1; $_SESSION['alt_name'] = $_SESSION['first_name'] . " " . $_SESSION['last_name']; $_SESSION['alt_fName'] = $_SESSION['first_name']; $_SESSION['alt_lName'] = $_SESSION['last_name']; $_SESSION['alt_address1'] = $_SESSION['address1']; $_SESSION['alt_address2'] = $_SESSION['address2']; $_SESSION['alt_city'] = $_SESSION['city']; $_SESSION['ship_state_id'] = $_SESSION['bill_state_id']; $_SESSION['ship_country_id'] = $_SESSION['bill_country_id']; $_SESSION['ship_state'] = $_SESSION['bill_state']; $_SESSION['alt_zip'] = $_SESSION['zip']; $_SESSION['alt_phone'] = $_SESSION['phone']; } #CHECKING FOR VAT TAX if (!empty($_SESSION['ship_state_id'])) { $this->obDb->query = "SELECT fTax FROM " . STATES . " where iStateId_PK = '" . $_SESSION['ship_state_id'] . "'"; $row_state = $this->obDb->fetchQuery(); $_SESSION['VAT'] = $row_state[0]->fTax; } if (!isset($row_state[0]->fTax) || empty($row_state[0]->fTax)) { $this->obDb->query = "SELECT fTax FROM " . COUNTRY . " where iCountryId_PK = '" . $_SESSION['ship_country_id'] . "'"; $row_country = $this->obDb->fetchQuery(); if ($row_country[0]->fTax == "") { $_SESSION['VAT'] = DEFAULTVATTAX; } else { $_SESSION['VAT'] = $row_country[0]->fTax; } } $_SESSION['mail_list'] = $this->request['mail_list']; #CHECKING FOR MEMBER POINTS /*if(isset($this->request['member_points']) && $this->request['member_points']=='yes') { $_SESSION['useMemberPoints']='yes'; }*/ $retUrl = $this->libFunc->m_safeUrl(SITE_SAFEURL . "ecom/index.php?action=checkout.reviewit"); header("Location: " . $retUrl); exit; }
function m_showHomePage() { $this->ObTpl = new template(); $this->ObTpl->set_file("TPL_VAR_CMS", $this->cmsTemplate); $this->ObTpl->set_block("TPL_VAR_CMS", "TPL_MAINPRODUCT_BLK", "mainproduct_blk"); $this->ObTpl->set_block("TPL_MAINPRODUCT_BLK", "TPL_PRODUCT_BLK", "product_blk"); $this->ObTpl->set_block("TPL_VAR_CMS", "TPL_MAINCONTENT_BLK", "maincontent_blk"); $this->ObTpl->set_block("TPL_MAINCONTENT_BLK", "TPL_CONTENT_BLK", "content_blk"); $this->ObTpl->set_block("TPL_PRODUCT_BLK", "TPL_WISHLIST_BLK", "wishlist_blk"); $this->ObTpl->set_block("TPL_PRODUCT_BLK", "TPL_COMPARE_BLK", "compare_blk"); $this->ObTpl->set_block("TPL_PRODUCT_BLK", "TPL_CONTAINTDEPARTMENT_BLK", "containdepartment_blk"); $this->ObTpl->set_block("TPL_PRODUCT_BLK", "TPL_REVIEW_BLK", "review_blk"); $this->ObTpl->set_var("TPL_VAR_SITEURL", SITE_URL); $this->ObTpl->set_var("TPL_VAR_THEME_PATH", THEMEURLPATH); $this->ObTpl->set_var("GRAPHICSMAINPATH", GRAPHICS_PATH); $this->ObTpl->set_var("TPL_VAR_CURRENCY", CONST_CURRENCY); $this->ObTpl->set_var("theme_blk", ""); $this->ObTpl->set_var("mainproduct_blk", ""); $this->ObTpl->set_var("product_blk", ""); $this->ObTpl->set_var("maincontent_blk", ""); $this->ObTpl->set_var("content_blk", ""); $this->ObTpl->set_var("wishlist_blk", ""); $this->ObTpl->set_var("compare_blk", ""); $this->ObTpl->set_var("containdepartment_blk", ""); $this->ObTpl->set_var("review_blk", ""); #QUERY TO GET CMS ##Defining language pack variables for headings on homepage $this->ObTpl->set_var("LANG_VAR_LATESTPRODUCTS", ""); $this->ObTpl->set_var("LANG_VAR_LATESTNEWS", ""); $this->ObTpl->set_var("LANG_VAR_LATESTNEWS", LATEST_NEWS); $this->obDb->query = "SELECT vSmalltext,tLargetext FROM " . SITESETTINGS . " WHERE vDatatype='index_body'"; $row_setting = $this->obDb->fetchQuery(); $this->ObTpl->set_var("TPL_VAR_HEADING", LANG_WELCOME_TO . SITE_NAME); $this->ObTpl->set_var("TPL_VAR_TEXT", $this->libFunc->m_displayContent1($row_setting[0]->tLargetext)); //Top Sellers if (TOPSELLERS == 1) { $this->ObTpl->set_var("LANG_VAR_HOMEPAGEPRODUCTTEXT", "Top Sellers"); #Getting current product ID's $this->obDb->query = "SELECT * FROM " . PRODUCTS; $rowProductId = $this->obDb->fetchQuery(); $rowIdCount = $this->obDb->record_count; $id_rows = array(); for ($i = 0; $i < $rowIdCount; $i++) { $id_rows[$i] = $rowProductId[$i]->iProdid_PK; } #QUERY TO GET TOP TEN PRODUCTS if ($rowIdCount > 0) { $this->obDb->query = "SELECT iProductid_FK, SUM(iQty) as top_10 FROM " . ORDERPRODUCTS . " WHERE iProductid_FK IN (" . implode(",", $id_rows) . ")\n\t \t\t\t\t\t\t\tGROUP BY iProductid_FK ORDER BY top_10 DESC"; $rowTop10 = $this->obDb->fetchQuery(); $rowCount = $this->obDb->record_count; } else { $rowCount = 0; } if ($rowCount > 0) { for ($i = 0; $i < $rowCount; $i++) { $this->obDb->query = "SELECT * FROM " . PRODUCTS . " WHERE iProdid_PK =" . $rowTop10[$i]->iProductid_FK; $BestSellers = $this->obDb->fetchQuery(); $BestCount = $this->obDb->record_count; #MARGIN CALCULATOR switch (MARGINSTATUS) { case "increase": $BestSellers[$i]->fPrice = $BestSellers[$i]->fPrice * MARGINPERCENT / 100 + $BestSellers[$i]->fPrice; break; case "decrease": $BestSellers[$i]->fPrice = $BestSellers[$i]->fPrice - $BestSellers[$i]->fPrice * MARGINPERCENT / 100; break; default: $BestSellers[$i]->fPrice = $BestSellers[$i]->fPrice; break; } #END MARGIN CALCULATOR $this->ObTpl->set_var("TPL_VAR_ONSALE", ""); if ($BestSellers[0]->iSale == 1) { $this->ObTpl->set_var("TPL_VAR_ONSALE", "<p class=\"onSale\">On Sale</p>"); } $productUrl = SITE_URL . "ecom/index.php?action=ecom.pdetails&mode=" . $BestSellers[0]->vSeoTitle; $this->ObTpl->set_var("TPL_VAR_PRODUCTURL", $this->libFunc->m_safeUrl($productUrl)); $this->ObTpl->set_var("TPL_VAR_ID", $this->libFunc->m_displayContent($BestSellers[0]->iProdid_PK)); $this->ObTpl->set_var("TPL_VAR_TITLE", $this->libFunc->m_displayContent($BestSellers[0]->vTitle)); $this->ObTpl->set_var("TPL_VAR_DESC", $this->libFunc->m_displayContent($BestSellers[0]->tShortDescription)); #TO CHECK WHEATHER TO DISPLAY WISHLIST OR NOT MANAGED BY ADMIN if (USEWISHLIST == 1) { ##WISHLIST URL $wishListUrl = SITE_URL . "ecom/index.php?action=wishlist.add&mode=" . $BestSellers[0]->iProdid_PK; $this->ObTpl->set_var("TPL_VAR_WISHLISTLINK", $this->libFunc->m_safeUrl($wishListUrl)); $this->ObTpl->parse("wishlist_blk", "TPL_WISHLIST_BLK"); } #TO CHECK WHEATHER TO DISPLAY COMPARELIST OR NOT MANAGED BY ADMIN if (USECOMPARE == 1) { $compareListUrl = SITE_URL . "ecom/index.php?action=compare.add&mode=" . $BestSellers[0]->iProdid_PK; $this->ObTpl->set_var("TPL_VAR_COMPARELINK", $this->libFunc->m_safeUrl($compareListUrl)); $this->ObTpl->parse("compare_blk", "TPL_COMPARE_BLK"); } if (CUSTOMER_REVIEWS == 1) { ##OVERALL PRODUCT STAR RANKING $this->obDb->query = "SELECT SUM(vRank) as total, COUNT(iItemid_FK) as reviewcount FROM " . REVIEWS . " WHERE iItemid_FK ='" . $rowTop10[$i]->iProductid_FK . "'"; $OverallReviewRating = $this->obDb->fetchQuery(); $ReviewRating = $OverallReviewRating[0]->total / $OverallReviewRating[0]->reviewcount; $ReviewRating = number_format($ReviewRating, 0, '.', ''); $this->ObTpl->set_var("TPL_VAR_REVIEWCOUNT", "<p class=\"reviewCount\">" . $OverallReviewRating[0]->reviewcount . " reviews</p>"); switch ($ReviewRating) { case "0": $this->ObTpl->set_var("TPL_VAR_OVERALLRANK", "<p class=\"review rating0\">" . $OverallReviewRating[0]->reviewcount . " reviews</p>"); break; case "1": $this->ObTpl->set_var("TPL_VAR_OVERALLRANK", "<p class=\"review rating1\">" . $OverallReviewRating[0]->reviewcount . " reviews</p>"); break; case "2": $this->ObTpl->set_var("TPL_VAR_OVERALLRANK", "<p class=\"review rating2\">" . $OverallReviewRating[0]->reviewcount . " reviews</p>"); break; case "3": $this->ObTpl->set_var("TPL_VAR_OVERALLRANK", "<p class=\"review rating3\">" . $OverallReviewRating[0]->reviewcount . " reviews</p>"); break; case "4": $this->ObTpl->set_var("TPL_VAR_OVERALLRANK", "<p class=\"review rating4\">" . $OverallReviewRating[0]->reviewcount . " reviews</p>"); break; case "5": $this->ObTpl->set_var("TPL_VAR_OVERALLRANK", "<p class=\"review rating5\">" . $OverallReviewRating[0]->reviewcount . " reviews</p>"); break; case "6": $this->ObTpl->set_var("TPL_VAR_OVERALLRANK", "<p class=\"review rating6\">" . $OverallReviewRating[0]->reviewcount . " reviews</p>"); break; case "7": $this->ObTpl->set_var("TPL_VAR_OVERALLRANK", "<p class=\"review rating7\">" . $OverallReviewRating[0]->reviewcount . " reviews</p>"); break; case "8": $this->ObTpl->set_var("TPL_VAR_OVERALLRANK", "<p class=\"review rating8\">" . $OverallReviewRating[0]->reviewcount . " reviews</p>"); break; case "9": $this->ObTpl->set_var("TPL_VAR_OVERALLRANK", "<p class=\"review rating9\">" . $OverallReviewRating[0]->reviewcount . " reviews</p>"); break; case "10": $this->ObTpl->set_var("TPL_VAR_OVERALLRANK", "<p class=\"review rating10\">" . $OverallReviewRating[0]->reviewcount . " reviews</p>"); break; } $this->ObTpl->parse("review_blk", "TPL_REVIEW_BLK"); } if ($BestSellers[0]->iTaxable == 1) { #GETTING VAT PRICE $vatPercent = $this->libFunc->m_vatCalculate(); $vatPrice = number_format($vatPercent * $BestSellers[0]->fPrice / 100 + $BestSellers[0]->fPrice, 2); if (INC_VAT_FLAG == 1 & INC_VAT == 1) { $this->ObTpl->set_var("TPL_VAR_PRICEMAIN", number_format($BestSellers[0]->fPrice, 2) . " (" . CONST_CURRENCY . $vatPrice . " inc. " . VAT_TAX_TEXT . ")"); $this->ObTpl->set_var("TPL_VAR_PRICE", $this->libFunc->m_displayContent($BestSellers[0]->fPrice) . " (" . CONST_CURRENCY . $vatPrice . " inc. " . VAT_TAX_TEXT . ")"); } else { if (INC_VAT_FLAG == 0 & INC_VAT == 1) { $this->ObTpl->set_var("TPL_VAR_PRICEMAIN", number_format($BestSellers[0]->fPrice, 2) . " (" . CONST_CURRENCY . $vatPrice . ")"); $this->ObTpl->set_var("TPL_VAR_PRICE", $this->libFunc->m_displayContent($BestSellers[0]->fPrice) . " (" . CONST_CURRENCY . $vatPrice . ")"); } else { $this->ObTpl->set_var("TPL_VAR_PRICEMAIN", $vatPrice . " inc. " . VAT_TAX_TEXT); $this->ObTpl->set_var("TPL_VAR_PRICE", $vatPrice . " inc. " . VAT_TAX_TEXT); } } } else { $this->ObTpl->set_var("TPL_VAR_PRICE", $this->libFunc->m_displayContent(number_format($BestSellers[0]->fPrice, 2))); } if (!empty($BestSellers[0]->vImage1)) { $img = $this->libFunc->m_checkFile($BestSellers[0]->vImage1, "product", $this->libFunc->m_displayContent($BestSellers[0]->vTitle)); if ($img) { $this->ObTpl->set_var("TPL_VAR_IMG", $img); } else { $this->ObTpl->set_var("TPL_VAR_IMG", MSG_NOIMG); } } else { $this->ObTpl->set_var("TPL_VAR_IMG", MSG_NOIMG); } $this->ObTpl->parse("product_blk", "TPL_PRODUCT_BLK", true); } $this->ObTpl->parse("mainproduct_blk", "TPL_MAINPRODUCT_BLK", true); } } else { //Start Latest Products $this->ObTpl->set_var("LANG_VAR_HOMEPAGEPRODUCTTEXT", "Latest Products"); #QUERY TO GET PRODUCTS $this->obDb->query = "SELECT iProdid_PK,vSeoTitle,vTitle,tShortDescription,vImage1,fPrice,fRetailPrice,iTaxable,iSale,iSubId_FK,fListPrice,iOwner_FK FROM " . PRODUCTS . "," . FUSIONS . " WHERE ( iProdid_PK=iSubId_FK AND iOwner_FK=0 AND vType='product' AND iState =1) ORDER BY iSort"; $row_product = $this->obDb->fetchQuery(); $row_product_count = $this->obDb->record_count; if ($row_product_count > 0) { for ($i = 0; $i < $row_product_count; $i++) { #MARGIN CALCULATOR switch (MARGINSTATUS) { case "increase": $row_product[$i]->fPrice = $row_product[$i]->fPrice * MARGINPERCENT / 100 + $row_product[$i]->fPrice; break; case "decrease": $row_product[$i]->fPrice = $row_product[$i]->fPrice - $row_product[$i]->fPrice * MARGINPERCENT / 100; break; default: $row_product[$i]->fPrice = $row_product[$i]->fPrice; break; } #END MARGIN CALCULATOR $this->ObTpl->set_var("TPL_VAR_ONSALE", ""); if ($row_product[$i]->iSale == 1) { $this->ObTpl->set_var("TPL_VAR_ONSALE", "<p class=\"onSale\">On Sale</p>"); } //--- Switch to retail price if Retail customer $comFunc = new c_commonFunctions(); if ($comFunc->m_checkCustomerType() == 1 && ENABLE_WHOLESALE == 1 && $row_product[$i]->fRetailPrice > 0) { $row_product[$i]->fPrice = $row_product[$i]->fRetailPrice; } //----End switch price //--------- Select all product in that department. $this->obDb->query = "SELECT iOwner_FK,vTitle,vSeoTitle FROM " . DEPARTMENTS . ", " . FUSIONS . " WHERE iSubId_FK=" . $row_product[$i]->iProdid_PK . " AND vType='product' AND iOwner_FK = iDeptid_PK AND iState =1"; $dept_row = $this->obDb->fetchQuery(); $deptcount = $this->obDb->record_count; if ($deptcount > 0) { $this->ObTpl->set_var("TPL_VAR_DEPTNAME", $dept_row[0]->vTitle); $depturl = SITE_URL . "ecom/index.php?action=ecom.details&mode=" . $dept_row[0]->vSeoTitle; $this->ObTpl->set_var("TPL_VAR_DEPTURL", $this->libFunc->m_safeUrl($depturl)); $this->ObTpl->parse("containdepartment_blk", "TPL_CONTAINTDEPARTMENT_BLK"); } //----------------- $productUrl = SITE_URL . "ecom/index.php?action=ecom.pdetails&mode=" . $row_product[$i]->vSeoTitle; $this->ObTpl->set_var("TPL_VAR_PRODUCTURL", $this->libFunc->m_safeUrl($productUrl)); $this->ObTpl->set_var("TPL_VAR_ID", $this->libFunc->m_displayContent($row_product[$i]->iProdid_PK)); $this->ObTpl->set_var("TPL_VAR_TITLE", $this->libFunc->m_displayContent($row_product[$i]->vTitle)); $this->ObTpl->set_var("TPL_VAR_DESC", $this->libFunc->m_displayContent($row_product[$i]->tShortDescription)); #TO CHECK WHEATHER TO DISPLAY WISHLIST OR NOT MANAGED BY ADMIN if (USEWISHLIST == 1) { ##WISHLIST URL $wishListUrl = SITE_URL . "ecom/index.php?action=wishlist.add&mode=" . $row_product[$i]->iProdid_PK; $this->ObTpl->set_var("TPL_VAR_WISHLISTLINK", $this->libFunc->m_safeUrl($wishListUrl)); $this->ObTpl->parse("wishlist_blk", "TPL_WISHLIST_BLK"); } #TO CHECK WHEATHER TO DISPLAY COMPARELIST OR NOT MANAGED BY ADMIN if (USECOMPARE == 1) { $compareListUrl = SITE_URL . "ecom/index.php?action=compare.add&mode=" . $row_product[$i]->iProdid_PK; $this->ObTpl->set_var("TPL_VAR_COMPARELINK", $this->libFunc->m_safeUrl($compareListUrl)); $this->ObTpl->parse("compare_blk", "TPL_COMPARE_BLK"); } if (CUSTOMER_REVIEWS == 1) { ##OVERALL PRODUCT STAR RANKING $this->obDb->query = "SELECT SUM(vRank) as total, COUNT(iItemid_FK) as reviewcount FROM " . REVIEWS . " WHERE iItemid_FK ='" . $row_product[$i]->iProdid_PK . "'"; $OverallReviewRating = $this->obDb->fetchQuery(); $ReviewRating = $OverallReviewRating[0]->total / $OverallReviewRating[0]->reviewcount; $ReviewRating = number_format($ReviewRating, 0, '.', ''); $this->ObTpl->set_var("TPL_VAR_REVIEWCOUNT", $OverallReviewRating[0]->reviewcount . " reviews"); switch ($ReviewRating) { case "0": $this->ObTpl->set_var("TPL_VAR_OVERALLRANK", "<p class=\"review rating0\">" . $OverallReviewRating[0]->reviewcount . " reviews</p>"); break; case "1": $this->ObTpl->set_var("TPL_VAR_OVERALLRANK", "<p class=\"review rating1\">" . $OverallReviewRating[0]->reviewcount . " reviews</p>"); break; case "2": $this->ObTpl->set_var("TPL_VAR_OVERALLRANK", "<p class=\"review rating2\">" . $OverallReviewRating[0]->reviewcount . " reviews</p>"); break; case "3": $this->ObTpl->set_var("TPL_VAR_OVERALLRANK", "<p class=\"review rating3\">" . $OverallReviewRating[0]->reviewcount . " reviews</p>"); break; case "4": $this->ObTpl->set_var("TPL_VAR_OVERALLRANK", "<p class=\"review rating4\">" . $OverallReviewRating[0]->reviewcount . " reviews</p>"); break; case "5": $this->ObTpl->set_var("TPL_VAR_OVERALLRANK", "<p class=\"review rating5\">" . $OverallReviewRating[0]->reviewcount . " reviews</p>"); break; case "6": $this->ObTpl->set_var("TPL_VAR_OVERALLRANK", "<p class=\"review rating6\">" . $OverallReviewRating[0]->reviewcount . " reviews</p>"); break; case "7": $this->ObTpl->set_var("TPL_VAR_OVERALLRANK", "<p class=\"review rating7\">" . $OverallReviewRating[0]->reviewcount . " reviews</p>"); break; case "8": $this->ObTpl->set_var("TPL_VAR_OVERALLRANK", "<p class=\"review rating8\">" . $OverallReviewRating[0]->reviewcount . " reviews</p>"); break; case "9": $this->ObTpl->set_var("TPL_VAR_OVERALLRANK", "<p class=\"review rating9\">" . $OverallReviewRating[0]->reviewcount . " reviews</p>"); break; case "10": $this->ObTpl->set_var("TPL_VAR_OVERALLRANK", "<p class=\"review rating10\">" . $OverallReviewRating[0]->reviewcount . " reviews</p>"); break; } $this->ObTpl->parse("review_blk", "TPL_REVIEW_BLK"); } if ($row_product[$i]->iTaxable == 1) { $this->ObTpl->set_var("TPL_VAR_PRICE", $comFunc->m_Format_Price($row_product[$i]->fPrice)); } else { $this->ObTpl->set_var("TPL_VAR_PRICE", $this->libFunc->m_displayContent(number_format($row_product[$i]->fPrice, 2))); } if (!$this->libFunc->m_isNull($row_product[$i]->fListPrice) && $row_product[$i]->fListPrice > 0) { $this->ObTpl->set_var("TPL_VAR_RRP_AMOUNT", "<span class=\"rrp\">" . RRP_TEXT . ": <strike>" . CONST_CURRENCY . number_format($row_product[$i]->fListPrice, 2, '.', '') . "</strike></span>"); } else { $this->ObTpl->set_var("TPL_VAR_RRP_AMOUNT", ""); } if (!empty($row_product[$i]->vImage1)) { $img = $this->libFunc->m_checkFile($row_product[$i]->vImage1, "product", $this->libFunc->m_displayContent($row_product[$i]->vTitle)); if ($img) { $this->ObTpl->set_var("TPL_VAR_IMG", $img); } else { $this->ObTpl->set_var("TPL_VAR_IMG", MSG_NOIMG); } } else { $this->ObTpl->set_var("TPL_VAR_IMG", MSG_NOIMG); } $this->ObTpl->parse("product_blk", "TPL_PRODUCT_BLK", true); } $this->ObTpl->parse("mainproduct_blk", "TPL_MAINPRODUCT_BLK", true); } } #QUERY TO GET content $this->obDb->query = "SELECT iContentid_PK,vSeoTitle,vTitle,vImage1 FROM " . CONTENTS . "," . FUSIONS . " WHERE (iContentid_PK=iSubId_FK AND iOwner_FK='0' AND vType='content' AND iState =1) ORDER BY iSort"; $rowContent = $this->obDb->fetchQuery(); $contentCount = $this->obDb->record_count; if ($contentCount > 0) { for ($i = 0; $i < $contentCount; $i++) { $contentUrl = SITE_URL . "ecom/index.php?action=ecom.cdetails&mode=" . $rowContent[$i]->vSeoTitle; $this->ObTpl->set_var("TPL_VAR_CONTENTURL", $this->libFunc->m_safeUrl($contentUrl)); $this->ObTpl->set_var("TPL_VAR_ID", $this->libFunc->m_displayContent($rowContent[$i]->iContentid_PK)); if (!empty($rowContent[$i]->vImage1)) { $img = $this->libFunc->m_checkFile($rowContent[$i]->vImage1, "content", $this->libFunc->m_displayContent($rowContent[$i]->vTitle)); if ($img) { $this->ObTpl->set_var("TPL_VAR_TITLE", $img); } else { $this->ObTpl->set_var("TPL_VAR_TITLE", $this->libFunc->m_displayContent($rowContent[$i]->vTitle)); } } else { $this->ObTpl->set_var("TPL_VAR_TITLE", $this->libFunc->m_displayContent($rowContent[$i]->vTitle)); } $this->ObTpl->parse("content_blk", "TPL_CONTENT_BLK", true); } $this->ObTpl->parse("maincontent_blk", "TPL_MAINCONTENT_BLK", true); } $this->obDb->query = "SELECT * FROM " . COMPANYSETTINGS; $compset = $this->obDb->fetchQuery(); $this->ObTpl->set_var("TPL_VAR_SITENAME", $this->libFunc->m_displayContent($compset[0]->vCname)); $this->ObTpl->set_var("TPL_VAR_SLOGAN", $this->libFunc->m_displayContent($compset[0]->vSlogan)); return $this->ObTpl->parse("return", "TPL_VAR_CMS"); }
function valiadateSystemInfo() { $this->errMsg = ""; $libFunc = new c_libFunctions(); if (empty($this->request['dbServer'])) { $this->err = 1; $this->errMsg .= MSG_DBSERVER_EMPTY . "<br>"; } if (empty($this->request['dbUserName'])) { $this->err = 1; $this->errMsg .= MSG_USERNAME_EMPTY . "<br>"; } if (empty($this->request['dbPassword'])) { $this->err = 1; $this->errMsg .= MSG_PASSWORD_EMPTY . "<br>"; } if (empty($this->request['dsn'])) { $this->err = 1; $this->errMsg .= MSG_DBNAME_EMPTY . "<br>"; } #INTIALIZING VALUES define("DATABASE_HOSTTEST", $this->request['dbServer']); define("DATABASE_USERNAMETEST", $this->request['dbUserName']); define("DATABASE_PASSWORDTEST", $this->request['dbPassword']); define("DATABASE_NAMETEST", $this->request['dsn']); define("DATABASE_PORTTEST", "3306"); $comFunc = new c_commonFunctions(); $comFunc->db_host = DATABASE_HOSTTEST; $comFunc->db_user = DATABASE_USERNAMETEST; $comFunc->db_password = DATABASE_PASSWORDTEST; $comFunc->db_port = DATABASE_PORTTEST; $comFunc->db_name = DATABASE_NAMETEST; $returnValue = $comFunc->checkDatabase(); if ($returnValue != 1) { $this->err = 1; $this->errMsg .= $returnValue . "<br>"; } if (empty($this->request['SITEURL'])) { $this->err = 1; $this->errMsg .= MSG_SITEURL_EMPTY . "<br>"; } if (empty($this->request['SITEPATH'])) { $this->err = 1; $this->errMsg .= MSG_SITETITLE_EMPTY . "<br>"; } if (empty($this->request['ADMINEMAIL'])) { $this->err = 1; $this->errMsg .= MSG_ADMINEMAIL_EMPTY . "<br>"; } if (empty($this->request['CURRENCY'])) { $this->err = 1; $this->errMsg .= MSG_CURRENCY_EMPTY . "<br>"; } if (!is_dir($this->libFunc->path_converter($this->request['SITEPATH']))) { $this->err = 1; $this->errMsg .= MSG_NOTDIR . "<br>"; } if (isset($this->request['SMTP_AUTH']) && $this->request['SMTP_AUTH'] == '1' && (empty($this->request['SMTP_USERNAME']) || empty($this->request['SMTP_PASSWORD']) || empty($this->request['SMTP_HOST']))) { $this->err = 1; $_errMsg = ""; if (empty($this->request['SMTP_HOST'])) { $_errMsg = MSG_SMTP_HOST_EMPTY; } if (empty($this->request['SMTP_PASSWORD'])) { $_errMsg = MSG_SMTP_PASSWORD_EMPTY; } if (empty($this->request['SMTP_USERNAME'])) { $_errMsg = MSG_SMTP_USERNAME_EMPTY; } $this->errMsg .= $_errMsg . "<br>"; } $this->request['newlicense'] = $this->libFunc->ifSet($this->request, 'newlicense'); $this->license = new licenseCheck($this->obDb, $this->libFunc); $licenseinfo = $this->license->DolicenseCheck($this->request['newlicense']); if (empty($licenseinfo)) { die("LICENSE ERROR. LICENSE FUNCTION HAS BEEN REMOVED!"); } else { if ($licenseinfo['status'] == "Active") { } elseif ($licenseinfo['status'] == "Invalid") { $this->errMsg = $this->errMsg . " Your license key is invalid. <br />"; $this->err = 1; } elseif ($licenseinfo['status'] == "Expired") { $this->errMsg = $this->errMsg . " Your license key has expired. <br />"; $this->err = 1; } elseif ($licenseinfo['status'] == "Suspended") { $this->errMsg = $this->errMsg . " Your license key has been suspended. <br />"; $this->err = 1; } else { $this->errMsg = $this->errMsg . " Your license key is invalid. <br />"; $this->err = 1; } if ($this->err != 1) { $this->request['LicenseKey'] = $this->request['newlicense']; } } return $this->err; }
function printMainBlock() { if (!isset($this->request['action'])) { $this->request['action'] = ""; } $action = explode(".", $this->request['action']); $obCms = new c_cmsContent(); $obCms->obDb = $this->obDb; $obCms->request = $this->request; $obCmsDb = new c_cmsContentDb(); $obCmsDb->obDb = $this->obDb; $obCmsDb->request = $this->request; $obSiteMap = new c_siteMap(); $obSiteMap->obDb = $this->obDb; $obSiteMap->request = $this->request; $rssInterface = new feed_interface(); $rssInterface->obDb = $this->obDb; $rssInterface->obDb = $this->obDb; $this->libFunc = new c_libFunctions(); $comFunc = new c_commonFunctions(); $comFunc->request = $this->request; switch ($action[0]) { case "error": $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", " » Error"); $comFunc->cmsTemplate = $this->templatePath . "error.tpl.htm"; $this->obTpl->set_var("TPL_VAR_BODY", $comFunc->m_dspError()); break; case "cms": $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", " » " . $this->request['mode']); $obCms->cmsTemplate = $this->templatePath . "cmsContent.tpl.htm"; $this->obTpl->set_var("TPL_VAR_BODY", $obCms->m_showCmsContent()); break; case "sitemap": $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", " » Sitemap"); $obSiteMap->siteMapTemplate = $this->templatePath . "siteMap.tpl.htm"; $this->obTpl->set_var("TPL_VAR_BODY", $obSiteMap->m_showSitemap()); break; case "download": $retUrl = $this->libFunc->m_safeUrl(SITE_URL . "index.php?action=download&mode=" . $this->request['mode']); $_SESSION['referer'] = $retUrl; $this->libFunc->authenticate(); unset($_SESSION['referer']); $this->obDb->query = "SELECT `iOrderid_PK` FROM " . ORDERS . " WHERE `iCustomerid_FK` = '" . $_SESSION['userid'] . "' AND `iOrderStatus` = '1'"; foreach ($this->obDb->fetchQuery() as $result) { $this->obDb->query = "SELECT COUNT(`iOrderid_FK`) FROM " . ORDERPRODUCTS . " WHERE `iOrderid_FK` = '" . $result->iOrderid_PK . "' AND `iProductid_FK` = '" . $this->request['mode'] . "'"; $record = $this->obDb->fetchQuery(); if ($record[0]->{'COUNT(`iOrderid_FK`)'} > 0) { $this->obDb->query = "SELECT `vDownloadablefile` FROM " . PRODUCTS . " WHERE `iProdid_PK` = '" . $this->request['mode'] . "'"; $fileresult = $this->obDb->fetchQuery(); $obCmsDb->libFunc = $this->libFunc; $obCmsDb->file = $fileresult[0]->vDownloadablefile; $obCmsDb->m_downloadFile(); $this->libFunc->m_mosRedirect(SITE_URL); } else { $this->libFunc->m_mosRedirect(SITE_URL); } } break; case "productRss": $this->libFunc->m_mosRedirect(SITE_URL . "RSS/productRss.xml"); exit; break; case "articleRss": $this->libFunc->m_mosRedirect(SITE_URL . "RSS/articleRss.xml"); exit; break; case "contactus": if (!isset($action[1])) { $action[1] = ""; } switch ($action[1]) { case "thanks": $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", " » Thanks"); $obCms->cmsTemplate = $this->templatePath . "contactsubmit.tpl.htm"; $this->obTpl->set_var("TPL_VAR_BODY", $obCms->m_showThanks()); break; case "add": if ($obCms->m_validateContact()) { $obCms->cmsTemplate = $this->templatePath . "contact.tpl.htm"; $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", " » Contact us"); $this->obTpl->set_var("TPL_VAR_BODY", $obCms->m_showContactForm()); } else { $obCmsDb->m_addContact(); } break; default: $obCms->cmsTemplate = $this->templatePath . "contact.tpl.htm"; $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", " » Contact us"); $this->obTpl->set_var("TPL_VAR_BODY", $obCms->m_showContactForm()); break; } break; default: if (isset($this->request['sid']) && !empty($this->request['sid'])) { $value = $this->request['sid']; setcookie("sourceid", $value, time() + 3600, "/"); } $obCms->cmsTemplate = $this->templatePath . "home.tpl.htm"; $this->obTpl->set_var("TPL_VAR_BREDCRUMBS", ""); $this->obTpl->set_var("SiteUrl", SITE_URL); $this->obTpl->set_var('TPL_VAR_BODY', $obCms->m_showHomePage()); break; } }
function m_saveOrderData() { $comFunc = new c_commonFunctions(); $comFunc->obDb = $this->obDb; $timestamp = time(); $obPayGateway = new c_paymentGateways(); # This condition due order not complete by protx if (count($_SESSION) == 0) { $retUrl = $this->libFunc->m_safeUrl(SITE_URL . "ecom/index.php?action=ecom.viewcart"); $this->libFunc->m_mosRedirect($retUrl); } // $this->invoice= #INTAILIZING $this->payMethod = $this->libFunc->ifSet($_SESSION, 'payMethod', ' '); $this->grandTotal = $this->libFunc->ifSet($_SESSION, 'grandTotal', ' '); $_SESSION['ship_state_id'] = $this->libFunc->ifSet($_SESSION, 'ship_state_id', ' '); $_SESSION['bill_state_id'] = $this->libFunc->ifSet($_SESSION, 'bill_state_id', ' '); $_SESSION['bill_state'] = $this->libFunc->ifSet($_SESSION, 'bill_state', ' '); $_SESSION['ship_state'] = $this->libFunc->ifSet($_SESSION, 'ship_state', ' '); $_SESSION['VAT'] = $this->libFunc->ifSet($_SESSION, 'VAT', ' '); $_SESSION['comments'] = $this->libFunc->ifSet($_SESSION, 'comments', ' '); $_SESSION['giftCertPrice'] = $this->libFunc->ifSet($_SESSION, 'giftCertPrice', '0'); $_SESSION['giftCertCode'] = $this->libFunc->ifSet($_SESSION, 'giftCertCode', ' '); $_SESSION['discountPrice'] = $this->libFunc->ifSet($_SESSION, 'discountPrice', '0'); $_SESSION['discountCode'] = $this->libFunc->ifSet($_SESSION, 'discountCode', ' '); $_SESSION['memberPointsEarned'] = $this->libFunc->ifSet($_SESSION, 'memberPointsEarned', '0'); $_SESSION['promotionDiscountPrice'] = $this->libFunc->ifSet($_SESSION, 'promotionDiscountPrice', '0'); if ($_SESSION['useMemberPoints'] == 'yes') { $_SESSION['usedMemberPoints'] = $this->libFunc->ifSet($_SESSION, 'usedMemberPoints', '0'); $_SESSION['memberPointsUsedAmount'] = $this->libFunc->ifSet($_SESSION, 'memberPointsUsedAmount', '0'); } else { $_SESSION['usedMemberPoints'] = 0; $_SESSION['memberPointsUsedAmount'] = 0; } $_SESSION['cartWeight'] = $this->libFunc->ifSet($_SESSION, 'cartWeight', '0'); $_SESSION['cartWeightPrice'] = $this->libFunc->ifSet($_SESSION, 'cartWeightPrice', '0'); $_SESSION['alt_ship'] = $this->libFunc->ifSet($_SESSION, "alt_ship", 0); $_COOKIE['sourceid'] = $this->libFunc->ifSet($_COOKIE, "sourceid", ""); if (isset($_SESSION['userid']) && empty($_SESSION['userid'])) { unset($_SESSION['userid']); } if (!isset($_SESSION['userid'])) { if (isset($_SESSION['txtpassword'])) { $uniqID = $_SESSION['txtpassword']; } else { $uniqID = uniqid(3); } #ADDING NOT REGISTERED CUSTOMER $this->obDb->query = "select iCustmerid_PK,iRegistered FROM " . CUSTOMERS . " WHERE vEmail = '" . $_SESSION['email'] . "'"; $qryResult = $this->obDb->fetchQuery(); $rCount = $this->obDb->record_count; if ($rCount > 0 and $qryResult[0]->iRegistered == '0') { $this->obDb->query = "UPDATE " . CUSTOMERS . " SET \n\t\t\t\tvFirstName\t\t='" . $this->libFunc->m_addToDB($_SESSION['first_name']) . "',\n\t\t\t\tvLastName\t\t='" . $this->libFunc->m_addToDB($_SESSION['last_name']) . "',\n\t\t\t\tvPassword\t\t= PASSWORD('" . $uniqID . "'),\n\t\t\t\tvAddress1\t\t='" . $this->libFunc->m_addToDB($_SESSION['address1']) . "',\n\t\t\t\tvAddress2\t\t='" . $this->libFunc->m_addToDB($_SESSION['address2']) . "',\n\t\t\t\tvCity\t\t\t\t='" . $this->libFunc->m_addToDB($_SESSION['city']) . "',\n\t\t\t\tvState\t\t\t='" . $this->libFunc->m_addToDB($_SESSION['bill_state_id']) . "',\n\t\t\t\tvStateName\t='" . $this->libFunc->m_addToDB($_SESSION['bill_state']) . "',\n\t\t\t\tvCountry\t\t='" . $this->libFunc->m_addToDB($_SESSION['bill_country_id']) . "',\n\t\t\t\tvZip\t\t\t\t='" . $this->libFunc->m_addToDB($_SESSION['zip']) . "',\n\t\t\t\tvCompany\t\t='" . $this->libFunc->m_addToDB($_SESSION['company']) . "',\n\t\t\t\tvPhone\t\t\t='" . $this->libFunc->m_addToDB($_SESSION['phone']) . "',\n\t\t\t\tiMailList\t\t\t='" . $_SESSION['mail_list'] . "',\n\t\t\t\ttmSignupDate\t='" . $timestamp . "',\n\t\t\t\tfMemberPoints ='0',"; if (isset($_SESSION['txtpassword']) && !empty($_SESSION['txtpassword'])) { $this->obDb->query = $this->obDb->query . "iRegistered ='1',"; } else { $this->obDb->query = $this->obDb->query . " iRegistered ='0',"; } $this->obDb->query = $this->obDb->query . "vHomePage='" . $this->libFunc->m_addToDB($_SESSION['homepage']) . "' WHERE vEmail='" . $this->libFunc->m_addToDB($_SESSION['email']) . "' AND iRegistered ='0'"; //die($this->obDb->query); } elseif (isset($qryResult[0]->iRegistered) && $qryResult[0]->iRegistered == '1') { $_SESSION['cardsave_error'] = 'Email address already in use. Please login to continue with this email address.<br>'; $retUrl = $this->libFunc->m_safeUrl(SITE_SAFEURL . "ecom/index.php?action=checkout.billing"); header("Location: " . $retUrl); $this->libFunc->m_mosRedirect($retUrl); die('Please login to continue'); } else { $this->obDb->query = "INSERT INTO " . CUSTOMERS . " SET \n\t\t\t\tvFirstName\t\t='" . $this->libFunc->m_addToDB($_SESSION['first_name']) . "',\n\t\t\t\tvLastName\t\t='" . $this->libFunc->m_addToDB($_SESSION['last_name']) . "',\n\t\t\t\tvEmail\t\t\t='" . $this->libFunc->m_addToDB($_SESSION['email']) . "',\n\t\t\t\tvPassword\t\t= PASSWORD('" . $uniqID . "'),\n\t\t\t\tvAddress1\t\t='" . $this->libFunc->m_addToDB($_SESSION['address1']) . "',\n\t\t\t\tvAddress2\t\t='" . $this->libFunc->m_addToDB($_SESSION['address2']) . "',\n\t\t\t\tvCity\t\t\t\t='" . $this->libFunc->m_addToDB($_SESSION['city']) . "',\n\t\t\t\tvState\t\t\t='" . $this->libFunc->m_addToDB($_SESSION['bill_state_id']) . "',\n\t\t\t\tvStateName\t='" . $this->libFunc->m_addToDB($_SESSION['bill_state']) . "',\n\t\t\t\tvCountry\t\t='" . $this->libFunc->m_addToDB($_SESSION['bill_country_id']) . "',\n\t\t\t\tvZip\t\t\t\t='" . $this->libFunc->m_addToDB($_SESSION['zip']) . "',\n\t\t\t\tvCompany\t\t='" . $this->libFunc->m_addToDB($_SESSION['company']) . "',\n\t\t\t\tvPhone\t\t\t='" . $this->libFunc->m_addToDB($_SESSION['phone']) . "',\n\t\t\t\tiMailList\t\t\t='" . $_SESSION['mail_list'] . "',\n\t\t\t\ttmSignupDate\t='" . $timestamp . "',\n\t\t\t\tfMemberPoints ='0',\n\t\t\t\tiStatus ='1',\n\t\t\t\tvHomePage\t\t='" . $this->libFunc->m_addToDB($_SESSION['homepage']) . "'"; if (isset($_SESSION['txtpassword']) && !empty($_SESSION['txtpassword'])) { $this->obDb->query = $this->obDb->query . ",iRegistered ='1'"; } else { $this->obDb->query = $this->obDb->query . ",iRegistered ='0'"; } } $this->obDb->updateQuery(); $_SESSION['userid'] = $this->obDb->last_insert_id; //Guest checkout broke this stuff. Removed below line as the new solution is to create a inaccessible account rather than not add anything at all. Obviously the customer isnt creating a account and should be able to still do so. //$comFunc->m_sendDetails($_SESSION['email']); #SETTING SESSION ID } //die("fail"); if ($_SESSION['username'] != "" && $_SESSION['mail_list'] != "") { $this->obDb->query = "UPDATE " . CUSTOMERS . " SET iMailList=" . $_SESSION['mail_list'] . " WHERE vEmail='" . $_SESSION['email'] . "'"; $this->obDb->updateQuery(); } if (isset($_SESSION['withoutlogin']) && $_SESSION['withoutlogin'] == 1) { $_SESSION['userid'] = 0; } #UPDATING GIFTCERTIFICATES IF THEY ARE USED if ($_SESSION['giftCertPrice'] > 0) { $this->obDb->query = "UPDATE " . GIFTCERTIFICATES . " SET fRemaining=fRemaining-" . $_SESSION['giftCertPrice'] . " WHERE vGiftcode='" . $_SESSION['giftCertCode'] . "'"; $this->obDb->updateQuery(); } #DB QUERY $this->obDb->query = "SELECT MAX(iInvoice) as maxInvoice FROM " . ORDERS; $rsInvoice = $this->obDb->fetchQuery(); $this->invoice = $rsInvoice[0]->maxInvoice; if (empty($this->invoice)) { $this->invoice = CONST_INVOICE; } else { $this->invoice++; } if (isset($_SESSION['freeShip']) && $_SESSION['freeShip'] == 1) { $_SESSION['postagePrice'] = 0; $_SESSION['postageMethod'] = LBL_FREEPP; } $time = time(); if (SELECTED_PAYMENTGATEWAY === 'protx') { $protx_apply_avs_cv2 = PROTX_APPLY_AVS_CV2; $protx_3d_secure_status = PROTX_3D_SECURE_STATUS; } else { $protx_apply_avs_cv2 = 0; $protx_3d_secure_status = 0; } $this->VendorTxCode = uniqid(rand(), true); #QUERY TO INSERT ORDER DETAILS TO MAIN TABLE $this->obDb->query = "INSERT INTO " . ORDERS . " SET \n\t\tiInvoice\t\t\t\t='" . $this->invoice . "',\n\t\tiCustomerid_FK\t='" . $_SESSION['userid'] . "',\n\t\ttmOrderDate\t\t='{$time}',\n\t\tvPayMethod\t\t='" . $this->libFunc->m_addToDB($_SESSION['payMethod']) . "',\n\t\tvShipDescription\t='" . $this->libFunc->m_addToDB($_SESSION['postageMethod']) . "',\n\t\tvShipMethod_Id\t='" . $this->libFunc->m_addToDB($_SESSION['postageId']) . "',\n\t\tfShipTotal\t\t\t='" . $this->libFunc->m_addToDB($_SESSION['postagePrice']) . "',\n\t\tvFirstName\t\t\t='" . $this->libFunc->m_addToDB($_SESSION['first_name']) . "',\n\t\tvLastName\t\t\t='" . $this->libFunc->m_addToDB($_SESSION['last_name']) . "',\n\t\tvEmail\t\t\t\t='" . $this->libFunc->m_addToDB($_SESSION['email']) . "',\n\t\tvAddress1\t\t\t='" . $this->libFunc->m_addToDB($_SESSION['address1']) . "',\n\t\tvAddress2\t\t\t='" . $this->libFunc->m_addToDB($_SESSION['address2']) . "',\n\t\tvCity\t\t\t\t\t='" . $this->libFunc->m_addToDB($_SESSION['city']) . "',\n\t\tvState\t\t\t\t='" . $this->libFunc->m_addToDB($_SESSION['bill_state_id']) . "',\n\t\tvStateName\t\t='" . $this->libFunc->m_addToDB($_SESSION['bill_state']) . "',\n\t\tvCountry\t\t\t='" . $this->libFunc->m_addToDB($_SESSION['bill_country_id']) . "',\n\t\tvZip\t\t\t\t\t='" . $this->libFunc->m_addToDB($_SESSION['zip']) . "',\n\t\tvCompany\t\t\t='" . $this->libFunc->m_addToDB($_SESSION['company']) . "',\n\t\tvPhone\t\t\t\t='" . $this->libFunc->m_addToDB($_SESSION['phone']) . "',\n\t\tiSameAsBilling \t\t='" . $this->libFunc->m_addToDB($_SESSION['alt_ship']) . "',\n\t\tvAltCompany\t\t\t='" . $this->libFunc->m_addToDB($_SESSION['alt_company']) . "',\n\t\tvAltName\t\t\t='" . $this->libFunc->m_addToDB($_SESSION['alt_name']) . "',\n\t\tvAltAddress1\t\t='" . $this->libFunc->m_addToDB($_SESSION['alt_address1']) . "',\n\t\tvAltAddress2\t\t='" . $this->libFunc->m_addToDB($_SESSION['alt_address2']) . "',\n\t\tvAltCity\t\t\t\t='" . $this->libFunc->m_addToDB($_SESSION['alt_city']) . "',\n\t\tvAltState\t\t\t='" . $this->libFunc->m_addToDB($_SESSION['ship_state_id']) . "',\n\t\tvAltStateName\t \t='" . $this->libFunc->m_addToDB($_SESSION['ship_state']) . "',\n\t\tvAltZip\t\t\t\t='" . $this->libFunc->m_addToDB($_SESSION['alt_zip']) . "',\n\t\tvAltPhone\t \t\t='" . $this->libFunc->m_addToDB($_SESSION['alt_phone']) . "',\n\t\tvAltCountry\t\t\t='" . $this->libFunc->m_addToDB($_SESSION['ship_country_id']) . "',\n\t\tvHomePage\t\t\t='" . $this->libFunc->m_addToDB($_SESSION['homepage']) . "',\n\t\tvDiscountCode\t \t='" . $this->libFunc->m_addToDB($_SESSION['discountCode']) . "',\t\n\t\tfDiscount \t\t\t='" . $this->libFunc->m_addToDB($_SESSION['discountPrice']) . "',\t\n\t\tiGiftcert_FK \t\t='" . $this->libFunc->m_addToDB($_SESSION['giftCertCode']) . "',\t\n\t\tfGiftcertTotal\t\t='" . $this->libFunc->m_addToDB($_SESSION['giftCertPrice']) . "',\t\n\t\tfPromoValue \t\t='" . $this->libFunc->m_addToDB($_SESSION['promotionDiscountPrice']) . "',\n\t\tfTaxRate\t\t\t\t='" . $this->libFunc->m_addToDB($_SESSION['VAT']) . "',\t\n\t\tfTaxPrice\t\t\t='" . $this->libFunc->m_addToDB($_SESSION['vatTotal']) . "',\t\n\t\ttComments\t\t\t='" . $this->libFunc->m_addToDB($_SESSION['comments']) . "',\t\n\t\tvCustomerIP\t\t\t='" . $_SERVER['REMOTE_ADDR'] . "',\n\t\tfShipByWeightPrice='" . $_SESSION['cartWeightPrice'] . "',\t\n\t\tfShipByWeightKg\t='" . $_SESSION['cartWeight'] . "',\t\n\t\tfCodCharge \t\t='" . $_SESSION['codPrice'] . "',\t\n\t\tfMemberPoints\t\t='" . $_SESSION['memberPointsUsedAmount'] . "',\t\n\t\tvSid \t\t\t\t\t='" . $_COOKIE['sourceid'] . "',\n\t\tiPayStatus \t\t='0',\t\n\t\tfTotalPrice \t\t='" . $this->libFunc->m_addToDB($_SESSION['grandTotal']) . "',\n\t\tiTransactionId\t\t='" . $this->VendorTxCode . "',\n\t\tvRemote_address \t='',\n\t\tvProtx_apply_avs_cv2 \t='" . $protx_apply_avs_cv2 . "',\n\t\tvProtx_3d_secure_status \t='" . $protx_3d_secure_status . "',\n\t\tiEarnedPoints ='" . $this->libFunc->m_addToDB(ceil($_SESSION['memberPointsEarned'])) . "'"; $this->obDb->updateQuery(); #ORDER ID $this->orderId = $this->obDb->last_insert_id; $_SESSION['order_id'] = $this->orderId; $_SESSION['invoicenumber'] = $this->invoice; if ($this->request['IssueNumber'] == '0') { $this->request['IssueNumber'] = ""; } if ($this->request['cc_type'] === 'SOLO' && $this->request['cc_type'] === 'SWITCH') { $this->request['cc_type'] = 'MAESTRO'; } if (($_SESSION['payMethod'] == 'cc' || $_SESSION['payMethod'] == 'eft') && SELECTED_PAYMENTGATEWAY != 'protx') { #INSERTING CREDIT CARD DETAILS $this->obDb->query = "INSERT INTO " . CREDITCARDS . " SET \n\t\t\tiOrderid_FK\t\t\t='" . $this->orderId . "',\n\t\t\tvCCnumber\t \t\t='" . $this->libFunc->m_addToDB($_SESSION['cc_number']) . "',\n\t\t\tvCCtype \t\t\t='" . $this->libFunc->m_addToDB($_SESSION['cc_type']) . "',\n\t\t\tvCCyear \t\t\t='" . $this->libFunc->m_addToDB($_SESSION['cc_year']) . "',\n\t\t\tvCCmonth \t\t\t='" . $this->libFunc->m_addToDB($_SESSION['cc_month']) . "',\n\t\t\tvCCstart_year \t='" . $this->libFunc->m_addToDB($_SESSION['cc_start_year']) . "',\n\t\t\tvCCstart_month \t='" . $this->libFunc->m_addToDB($_SESSION['cc_start_month']) . "',\n\t\t\tvAba \t\t\t\t\t='" . $this->libFunc->m_addToDB($_SESSION['aba']) . "',\n\t\t\tvAcct \t\t\t\t='" . $this->libFunc->m_addToDB($_SESSION['acct']) . "',\n\t\t\tvCCissuenumber \t='" . $this->libFunc->m_addToDB($_SESSION['issuenumber']) . "'"; $this->obDb->updateQuery(); } #QUERY TO INSERT PRODUCT DETAILS #GETTING DATA FROM SESSION (TEMPORARY DATA) $this->obDb->query = "SELECT vTitle,vSeoTitle,fPrice,fRetailPrice,iVendorid_FK,vSku,iQty,iTmpCartId_PK,iProdId_FK,vShipCode,iKit,iGiftWrap,tShortDescription,iTaxable,fVolDiscount,vDownloadablefile,iFreeShip,vShipNotes FROM " . TEMPCART . " T," . PRODUCTS . " P WHERE iProdId_FK=iProdId_PK AND vSessionId='" . SESSIONID . "'"; #FLAG TO INDICATE SEPERATE BACKORDER AND NORMAL ORDER $_SESSION['backOrderSeperate'] = $this->libFunc->ifSet($_SESSION, 'backOrderSeperate', '0'); #FLAG TO INDICATE WHETHER PROCESSING BACKORDER OR NOT $_SESSION['backOrderProcess'] = $this->libFunc->ifSet($_SESSION, 'backOrderProcess', '0'); if ($_SESSION['backOrderSeperate'] == 1 && $_SESSION['backOrderProcess'] == 1) { $this->obDb->query .= " AND T.iBackOrder='1'"; } elseif ($_SESSION['backOrderSeperate'] == 1) { $this->obDb->query .= " AND T.iBackOrder<>'1'"; } $rowCart = $this->obDb->fetchQuery(); $rsCount = $this->obDb->record_count; if ($rsCount > 0) { for ($i = 0; $i < $rsCount; $i++) { #FOR LOOP PRODUCT BEGIN #MARGIN CALCULATOR switch (MARGINSTATUS) { case "increase": $rowCart[$i]->fPrice = $rowCart[$i]->fPrice * MARGINPERCENT / 100 + $rowCart[$i]->fPrice; break; case "decrease": $rowCart[$i]->fPrice = $rowCart[$i]->fPrice - $rowCart[$i]->fPrice * MARGINPERCENT / 100; break; default: $rowCart[$i]->fPrice = $rowCart[$i]->fPrice; break; } #END MARGIN CALCULATOR //--- Switch to retail price if Retail customer if ($comFunc->m_checkCustomerType() == 1 && ENABLE_WHOLESALE == 1 && $rowCart[$i]->fRetailPrice > 0) { $rowCart[$i]->fPrice = $rowCart[$i]->fRetailPrice; } //----End switch price //$this->obDb->query ="SELECT vSeoTitle FROM ".PRODUCTS." WHERE iProdId_FK=iProdid_PK ='".$rowCart[$i]->iProdId_FK."'"; //$SeoReturn=$this->obDb->fetchQuery(); $qty = $rowCart[$i]->iQty; #INSERTING PRODUCTS TO ORDERED PRODUCT TABLE $this->obDb->query = "INSERT INTO " . ORDERPRODUCTS . " SET "; $this->obDb->query .= "iOrderid_FK\t\t='" . $this->orderId . "',"; $this->obDb->query .= "iProductid_FK\t='" . $rowCart[$i]->iProdId_FK . "',"; $this->obDb->query .= "iVendorid_FK\t='" . $rowCart[$i]->iVendorid_FK . "',"; $this->obDb->query .= "iQty\t\t\t\t='" . $rowCart[$i]->iQty . "',"; $this->obDb->query .= "iGiftwrapFK\t\t='" . $rowCart[$i]->iGiftWrap . "',"; $this->obDb->query .= "fPrice\t\t\t\t='" . $rowCart[$i]->fPrice . "',"; $this->obDb->query .= "vTitle\t\t\t\t='" . $this->libFunc->m_addToDB($rowCart[$i]->vTitle) . "',"; $this->obDb->query .= "seo_title\t\t\t='" . $this->libFunc->m_addToDB($rowCart[$i]->vSeoTitle) . "',"; $this->obDb->query .= "vSku\t\t\t\t='" . $this->libFunc->m_addToDB($rowCart[$i]->vSku) . "',"; $this->obDb->query .= "iKit\t\t\t\t\t='" . $rowCart[$i]->iKit . "',"; $this->obDb->query .= "fDiscount\t\t\t='" . $rowCart[$i]->fVolDiscount . "',"; $this->obDb->query .= "tShortDescription='" . $this->libFunc->m_addToDB($rowCart[$i]->tShortDescription) . "',"; $this->obDb->query .= "iTaxable\t\t\t='" . $rowCart[$i]->iTaxable . "',"; $this->obDb->query .= "iFreeship\t\t\t='" . $rowCart[$i]->iFreeShip . "',"; $this->obDb->query .= "vPostageNotes\t='" . $this->libFunc->m_addToDB($rowCart[$i]->vShipNotes) . "'"; $this->obDb->updateQuery(); $prodOrderId = $this->obDb->last_insert_id; if ($rowCart[$i]->iKit == 1) { $this->obDb->query = "SELECT PK.*,P.vTitle,P.vSku FROM " . PRODUCTKITS . " PK," . PRODUCTS . " P WHERE iProdId_FK=iProdId_PK AND iKitId='" . $rowCart[$i]->iProdId_FK . "'"; $rsKits = $this->obDb->fetchQuery(); $kitCount = $this->obDb->record_count; #INSERTING KITS********************************************* if ($kitCount > 0) { for ($k = 0; $k < $kitCount; $k++) { $this->obDb->query = "INSERT INTO " . ORDERKITS . " SET \n\t\t\t\t\t\t\tiOrderid_FK \t\t\t\t='" . $this->orderId . "',\n\t\t\t\t\t\t\tiProductid_FK\t\t\t='" . $rsKits[$k]->iProdId_FK . "',\n\t\t\t\t\t\t\tiProductOrderid_FK\t='" . $prodOrderId . "',\n\t\t\t\t\t\t\tiKitid\t \t\t\t\t\t='" . $rsKits[$k]->iKitId . "',\n\t\t\t\t\t\t\tiKitItem_id\t\t\t\t='" . $rsKits[$k]->iKitId_PK . "',\n\t\t\t\t\t\t\tiKitgroup \t\t\t\t='" . $rsKits[$k]->iKitId . "',\n\t\t\t\t\t\t\tiKitItem_title\t\t\t='" . $this->libFunc->m_addToDB($rsKits[$k]->vTitle . " (" . $rsKits[$k]->vSku . ")") . "'"; $this->obDb->updateQuery(); $this->m_updateOptions($rowCart[$i]->iTmpCartId_PK, $rsKits[$k]->iProdId_FK, $prodOrderId); } } } else { $this->m_updateOptions($rowCart[$i]->iTmpCartId_PK, $rowCart[$i]->iProdId_FK, $prodOrderId); } #INSERTING CHOICES********************************************* $this->obDb->query = "SELECT vDescription,vChoiceVal,fPrice,iChoiceid_PK,vType,iQty FROM " . CHOICES . ", " . TEMPCHOICES . " WHERE iTmpChoiceId_FK=iChoiceid_PK AND iTmpCartId_FK='" . $rowCart[$i]->iTmpCartId_PK . "'"; $rsChoices = $this->obDb->fetchQuery(); $rsChoiceCount = $this->obDb->record_count; if ($rsChoiceCount > 0) { for ($j = 0; $j < $rsChoiceCount; $j++) { #IF QUANTITY IS SELECTED if ($rsChoices[$j]->iQty == 1) { $rsChoices[$j]->fPrice = $rsChoices[$j]->fPrice * intval($rsChoices[$j]->vChoiceVal); } $this->obDb->query = "INSERT INTO " . ORDERCHOICES . " SET \n\t\t\t\t\t\tiOrderid_FK \t\t\t\t='" . $this->orderId . "',\n\t\t\t\t\t\tiProductid_FK\t\t\t='" . $rowCart[$i]->iProdId_FK . "',\n\t\t\t\t\t\tiProductOrderid_FK\t='" . $prodOrderId . "',\n\t\t\t\t\t\tiChoiceid_FK\t\t\t='" . $rsChoices[$j]->iChoiceid_PK . "',\n\t\t\t\t\t\tvChoiceValue\t\t\t='" . $this->libFunc->m_addToDB($rsChoices[$j]->vChoiceVal) . "',\n\t\t\t\t\t\tvDescription \t\t\t='" . $this->libFunc->m_addToDB($rsChoices[$j]->vDescription) . "',\n\t\t\t\t\t\tfPrice\t\t\t\t\t\t='" . $rsChoices[$j]->fPrice . "',\n\t\t\t\t\t\tvType \t\t\t\t\t='" . $this->libFunc->m_addToDB($rsChoices[$j]->vType) . "'"; $this->obDb->updateQuery(); } #END FOR CHOICE } #ENF IF CHOICE } #FOR LOOP PRODUCT END $this->request = array_merge($this->request, $_SESSION); } #IF END //$obPayGateway=new c_paymentGateways(); $obPayGateway->payStatus = 1; $this->payTotal = number_format($this->grandTotal, 2, '.', ''); //die($this->payMethod); if ($this->payTotal > 0) { switch ($this->payMethod) { #CARDSAVE case "cs_redirect": $cardSave = new c_cardSave($this->orderId); $cardSave->obDb = $this->obDb; $cardSave->obTpl = $this->obTpl; $cardSave->request = $this->request; $cardSave->libFunc = $this->libFunc; $cardSave->m_CardSave_Hosted(); exit; break; #FORM BASED PAYPAL #FORM BASED PAYPAL case "paypal": $this->ObTpl = new template(); $this->ObTpl->set_file("TPL_PAYPAL_FILE", $this->paypalTemplate); $this->ObTpl->set_var("TPL_VAR_SITEURL", SITE_SAFEURL); $this->ObTpl->set_var("TPL_VAR_SESSIONID", SESSIONID); $this->ObTpl->set_var("TPL_VAR_PAYACTION", PAYPAL_URL); $this->ObTpl->set_var("TPL_VAR_PAYPALID", PAYPAL_ID); $this->ObTpl->set_var("TPL_VAR_PAYCURRENCY", PAYMENT_CURRENCY); $this->ObTpl->set_var("TPL_VAR_ITEMNAME", SITE_NAME); $this->ObTpl->set_var("TPL_VAR_ITEMNUMBER", $this->orderId); $this->ObTpl->set_var("TPL_VAR_INVOICENUMBER", $this->invoice); $this->ObTpl->set_var("TPL_VAR_GRANDTOTAL", $this->payTotal); $this->ObTpl->pparse("return", "TPL_PAYPAL_FILE"); exit; break; case "secpay": $this->secpaySubmit(); exit; break; case "securetrading": $this->offSTSubmit(); exit; break; case "paypaldirect": $this->m_submitPaypalDirect(); break; #(BEGIN) SAGEPAY INTERGRATION #(BEGIN) SAGEPAY INTERGRATION case "sagepayform": $this->m_sagepayHostedSubmit(); exit; break; #(END) SAGEPAY INTERGRATION #(END) SAGEPAY INTERGRATION case "cc": #IMPLEMENTING PAYMENT GATEWAYS $obPayGateway->payMethod = SELECTED_PAYMENTGATEWAY; switch (SELECTED_PAYMENTGATEWAY) { case "Cardsave": $cardSave = new c_cardSave($this->orderId); $cardSave->obDb = $this->obDb; $cardSave->obTpl = $this->obTpl; $cardSave->request = $this->request; $cardSave->libFunc = $this->libFunc; $cardSave->m_CardSave_Direct(); exit; break; case "protx": $this->m_sagepaySubmit(); exit; break; case "authorizenet": $authnet_values = array("x_login" => AUTHORIZEPAYMENT_LOGIN, "x_version" => "3.1", "x_delim_char" => "|", "x_delim_data" => "TRUE", "x_url" => "FALSE", "x_type" => AUTHORIZEPAYMENT_TYPE, "x_method" => "CC", "x_tran_key" => AUTHORIZEPAYMENT_KEY, "x_relay_response" => "FALSE", "x_invoice_num" => $this->orderId, "x_card_num" => $this->request['CCNumber'], "x_card_code" => $this->request["cv2"], "x_exp_date" => $this->request['CCMonth'] . $this->request['CCYear'], "x_description" => SITE_NAME . " products", "x_amount" => $this->payTotal, "x_first_name" => $this->request["first_name"], "x_last_name" => $this->request["last_name"], "x_Company" => $this->request["company"], "x_address" => $this->request["address1"] . " " . $this->request["address2"], "x_city" => $this->request["city"], "x_state" => $this->m_stateName($this->request["bill_state_id"], $this->request["bill_state"]), "x_country" => $this->m_countryName($this->request['bill_country_id']), "x_zip" => $this->request["zip"], "x_email" => $this->request["email"], "x_phone" => $this->request["phone"], "x_Ship_To_First_Name" => $this->request["alt_name"], "x_Ship_To_Address" => $this->request["alt_address1"], "x_Ship_To_City" => $this->request["alt_city"], "x_Ship_To_State" => $this->m_stateName($this->request["ship_state_id"], ''), "x_Ship_To_Zip" => $this->request["alt_zip"], "x_country" => $this->m_countryName($this->request['ship_country_id'])); $fields = ""; foreach ($authnet_values as $key => $value) { $fields .= "{$key}=" . urlencode($value) . "&"; } $requestBody = rtrim($fields, "&"); $result = $obPayGateway->sendHttpRequest($requestBody, AUTHORIZENET_URL); $obPayGateway->fnRetStatus($result); break; case VERISIGN: if (VERISIGN_USER == "") { $verisignUser = VERISIGN_LOGIN; } else { $verisignUser = VERISIGN_USER; } #SETTING SHIP STATENAME $billStateId = $this->libFunc->ifSet($_SESSION, 'bill_state_id', '0'); $shipStateId = $this->libFunc->ifSet($_SESSION, 'ship_state_id', '0'); $this->request['CCYear'] = substr($this->request['CCYear'], 2); $verisignStr = "USER="******"&"; $verisignStr .= "VENDOR=" . VERISIGN_LOGIN . "&"; $verisignStr .= "PARTNER=" . VERISIGN_PARTNER . "&"; $verisignStr .= "PWD=" . VERISIGN_PASSWORD . "&"; $verisignStr .= "TRXTYPE=S&"; $verisignStr .= "TENDER=C&"; $verisignStr .= "ACCT=" . $this->request['CCNumber'] . "&"; $verisignStr .= "EXPDATE=" . $this->request['CCMonth'] . $this->request['CCYear'] . "&"; $verisignStr .= "AMT=" . $this->payTotal . "&"; $verisignStr .= "PONUM=" . $this->invoice . "&"; $verisignStr .= "CUSTREF=" . $_SESSION['userid'] . "&"; $verisignStr .= "CVV2=" . $this->request['cv2'] . "&"; $verisignStr .= "FIRSTNAME=" . $_SESSION['first_name'] . "&"; $verisignStr .= "LASTNAME=" . $_SESSION['last_name'] . "&"; $verisignStr .= "EMAIL=" . $_SESSION['email'] . "&"; $verisignStr .= "CITY=" . $_SESSION['city'] . "&"; $verisignStr .= "ZIP=" . $_SESSION['zip'] . "&"; $verisignStr .= "TAXAMT=" . $_SESSION['vatTotal'] . "&"; $verisignStr .= "PHONENUM=" . $_SESSION['phone'] . "&"; $verisignStr .= "STREET=" . $_SESSION['address1'] . " " . $_SESSION['address2'] . "&"; $verisignStr .= "STATE=" . $this->m_stateName($billStateId, $_SESSION['bill_state']) . "&"; $verisignStr .= "BILLTOCOUNTRY=" . $this->m_countryName($_SESSION['bill_country_id']) . "&"; $verisignStr .= "SHIPTOFIRSTNAME=" . $_SESSION['first_name'] . "&"; $verisignStr .= "SHIPTOLASTNAME=" . $_SESSION['last_name'] . "&"; $verisignStr .= "SHIPTOSTREET=" . $_SESSION['address1'] . " " . $_SESSION['address2'] . "&"; $verisignStr .= "SHIPTOCITY=" . $_SESSION['city'] . "&"; $verisignStr .= "SHIPTOSTATE=" . $this->m_stateName($shipStateId, $_SESSION['bill_state']) . "&"; $verisignStr .= "SHIPTOZIP=" . $_SESSION['zip'] . "&"; $verisignStr .= "SHIPTOCOUNTRY=" . $this->m_countryName($_SESSION['bill_country_id']) . "&"; $verisignStr .= "VERBOSITY=MEDIUM"; $libPath = SITE_PATH . "payflowpro/linux/"; exec("perl " . $libPath . "execute.pl " . VERISIGN_URL . " " . VERISIGN_PORT . " '{$verisignStr}' '{$libPath}'", $varans); //exec("perl ".SITE_PATH."payflowpro/linux/execute.pl ".VERISIGN_URL." ".VERISIGN_PORT." '$verisignStr'",$varans); $arr = explode("&", $varans[0]); $cntArr = count($arr); if ($cntArr > 0) { for ($i = 0; $i < $cntArr; $i++) { if ($arr[$i] != "" && strstr($arr[$i], '=')) { list($key, $value) = split("=", $arr[$i], 2); $resultArray[$key] = $value; } } } if (!isset($resultArray['RESULT'])) { $obPayGateway->payStatus = 0; $obPayGateway->errMsg = "Payment gateway is not setup properly"; } else { if ($resultArray['RESULT'] != 0) { $obPayGateway->payStatus = 0; } $obPayGateway->errMsg = $resultArray['RESPMSG']; $obPayGateway->transactionId = $resultArray['PNREF']; } break; case "securetrading": $this->securetradingSubmit(); break; case "propay": //Propay Gateway Integration:Starts $url = PROPAY_URL; $this->obDb->query = "select max(iInvoice) as iInvoiceId FROM " . ORDERS; $invoice = $this->obDb->fetchQuery(); $invoice_id = $invoice[0]->iInvoiceId; if ($_SESSION['alt_address1'] != "") { $address = $_SESSION['alt_address1']; } else { $address = $_SESSION['address1']; } if ($_SESSION['alt_zip'] != "") { $zip_code = $_SESSION['alt_zip']; } else { $zip_code = $_SESSION['zip']; } $exp_year = substr($_SESSION['cc_year'], -2); $grand_total = $_SESSION['grandTotal'] * 100; $post_string = "<?xml version='1.0'?>\n\t\t\t\t\t\t\t<!DOCTYPE Request.dtd>\n\t\t\t\t\t\t\t<XMLRequest>\n\t\t\t\t\t\t\t<certStr>" . PROPAY_CERTSTRING . "</certStr>\n\t\t\t\t\t\t\t<class>partner</class>\n\t\t\t\t\t\t\t\t\t<XMLTrans>\n\t\t\t\t\t\t\t\t\t<transType>04</transType>\n\t\t\t\t\t\t\t\t\t<accountNum>" . PROPAY_ACCNUMBER . "</accountNum>\n\t\t\t\t\t\t\t\t\t<amount>" . $grand_total . "</amount>\n\t\t\t\t\t\t\t\t\t<addr>" . $address . "</addr>\n\t\t\t\t\t\t\t\t\t<zip>" . $zip_code . "</zip>\n\t\t\t\t\t\t\t\t\t<sourceEmail>" . $_SESSION['email'] . "</sourceEmail>\n\t\t\t\t\t\t\t\t\t<ccNum>" . $_SESSION['cc_number'] . "</ccNum>\n\t\t\t\t\t\t\t\t\t<expDate>" . $_SESSION['cc_month'] . "" . $exp_year . "</expDate>"; $post_string .= "<AVS>Y</AVS>"; $post_string .= "<CVV2>" . $_SESSION['cv2'] . "</CVV2>\t\n\t\t\t\t\t\t\t\t\t<cardholderName>" . $_SESSION['cardholder_name'] . "</cardholderName>\n\t\t\t\t\t\t\t\t\t<invNum>" . $invoice_id . "</invNum>\n\t\t\t\t\t\t\t\t\t</XMLTrans>\t\n\t\t\t\t\t\t\t</XMLRequest>"; $xml_response = $obPayGateway->sendHttpRequest($post_string, $url); $xmlparse = $obPayGateway->xml2array($xml_response); $obPayGateway->propay_response($xmlparse); if ($obPayGateway->flag != "SUCCESS") { $_SESSION['pro'] = $obPayGateway->errMsg; $this->errMsg = $obPayGateway->errMsg; $retUrl = $this->libFunc->m_safeUrl(SITE_SAFEURL . "ecom/index.php?action=checkout.billing"); $this->libFunc->m_mosRedirect($retUrl); } else { $_SESSION['pro'] = ""; $retUrl = $this->libFunc->m_safeUrl(SITE_SAFEURL . "ecom/index.php?action=checkout.process&mode=" . $_SESSION['order_id']); $this->libFunc->m_mosRedirect($retUrl); } //Propay Gateway Integration:Ends break; } # END of online paymentgateways break; } #End of offline switch } # End of if paymethod if ($obPayGateway->payStatus != 1) { return $obPayGateway->errMsg; } if (isset($obPayGateway->transactionId)) { $this->obDb->query = "UPDATE " . ORDERS . " SET iPayStatus='1',iTransactionId='" . $obPayGateway->transactionId . "' WHERE iOrderid_PK = '" . $this->orderId . "'"; $rs = $this->obDb->updateQuery(); } $retUrl = $this->libFunc->m_safeUrl(SITE_SAFEURL . "ecom/index.php?action=checkout.process&mode=" . $this->orderId); $this->libFunc->m_mosRedirect($retUrl); }
function valiadateSystemInfo() { $this->errMsg = ""; $libFunc = new c_libFunctions(); if (empty($this->request['dbServer'])) { $this->err = 1; $this->errMsg .= MSG_DBSERVER_EMPTY . "<br>"; } if (empty($this->request['dbUserName'])) { $this->err = 1; $this->errMsg .= MSG_USERNAME_EMPTY . "<br>"; } if (empty($this->request['dbPassword'])) { $this->err = 1; $this->errMsg .= MSG_PASSWORD_EMPTY . "<br>"; } if (empty($this->request['dsn'])) { $this->err = 1; $this->errMsg .= MSG_DBNAME_EMPTY . "<br>"; } #INTIALIZING VALUES define("DATABASE_HOSTTEST", $this->request['dbServer']); define("DATABASE_USERNAMETEST", $this->request['dbUserName']); define("DATABASE_PASSWORDTEST", $this->request['dbPassword']); define("DATABASE_NAMETEST", $this->request['dsn']); define("DATABASE_PORTTEST", "3306"); $comFunc = new c_commonFunctions(); $comFunc->db_host = DATABASE_HOSTTEST; $comFunc->db_user = DATABASE_USERNAMETEST; $comFunc->db_password = DATABASE_PASSWORDTEST; $comFunc->db_port = DATABASE_PORTTEST; $comFunc->db_name = DATABASE_NAMETEST; $comFunc = new c_commonFunctions(); $comFunc->db_host = DATABASE_HOSTTEST; $comFunc->db_user = DATABASE_USERNAMETEST; $comFunc->db_password = DATABASE_PASSWORDTEST; $comFunc->db_port = DATABASE_PORTTEST; $comFunc->db_name = DATABASE_NAMETEST; $returnValue = $comFunc->checkDatabase(); if ($returnValue != 1) { $this->err = 1; $this->errMsg .= $returnValue . "<br>"; } if (empty($this->request['SITEURL'])) { $this->err = 1; $this->errMsg .= MSG_SITEURL_EMPTY . "<br>"; } if (empty($this->request['SITEPATH'])) { $this->err = 1; $this->errMsg .= MSG_SITETITLE_EMPTY . "<br>"; } if (empty($this->request['ADMINEMAIL'])) { $this->err = 1; $this->errMsg .= MSG_ADMINEMAIL_EMPTY . "<br>"; } if (empty($this->request['CURRENCY'])) { $this->err = 1; $this->errMsg .= MSG_CURRENCY_EMPTY . "<br>"; } if (!is_dir($this->libFunc->path_converter($this->request['SITEPATH']))) { $this->err = 1; $this->errMsg .= MSG_NOTDIR . "<br>"; } if (isset($this->request['SMTP_AUTH']) && $this->request['SMTP_AUTH'] == '1' && (empty($this->request['SMTP_USERNAME']) || empty($this->request['SMTP_PASSWORD']) || empty($this->request['SMTP_HOST']))) { $this->err = 1; $_errMsg = ""; if (empty($this->request['SMTP_HOST'])) { $_errMsg = MSG_SMTP_HOST_EMPTY; } if (empty($this->request['SMTP_PASSWORD'])) { $_errMsg = MSG_SMTP_PASSWORD_EMPTY; } if (empty($this->request['SMTP_USERNAME'])) { $_errMsg = MSG_SMTP_USERNAME_EMPTY; } $this->errMsg .= $_errMsg . "<br>"; } return $this->err; }
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_reviewCheckout() { $comFunc = new c_commonFunctions(); $comFunc->obDb = $this->obDb; if (count($_SESSION) == 0) { $retUrl = $this->libFunc->m_safeUrl(SITE_URL . "ecom/index.php?action=ecom.viewcart"); $this->libFunc->m_mosRedirect($retUrl); } #**Start: Reverify if the selected country carries correct shipping charges for international postage** if ($_SESSION['postagedropdown'] == "1" && DEFAULT_POSTAGE_METHOD == 'zones') { $postagePacking = $comFunc->m_recalculate_postage($_SESSION['ship_country_id']); if ($postagePacking[0] != "") { $_SESSION['postagePrice'] = $postagePacking[0]; if ($postagePacking[1] != "") { $_SESSION['zoneSpecialDelivery'] = $postagePacking[1]; } } } if ($_SESSION['postagedropdown'] == "1" && DEFAULT_POSTAGE_METHOD == 'cities') { $postagePacking = $comFunc->m_recalculate_postage($_SESSION['ship_country_id'], $_SESSION['ship_state_id']); if ($postagePacking[0] != "") { $_SESSION['postagePrice'] = $postagePacking[0]; if ($postagePacking[1] != "") { $_SESSION['citySpecialDelivery'] = $postagePacking[1]; } } } #**End: Reverify if the selected country carries correct shipping charges for international postage** #QUERY TEMPARARY CART & PRODUCT TABLE $this->obDb->query = "SELECT vTitle,vSeoTitle,fPrice,fRetailPrice,vSku,iQty,iTmpCartId_PK,iProdId_FK,vImage1,"; $this->obDb->query .= "iKit,iGiftWrap,fVolDiscount,iTaxable,fItemWeight,iFreeShip,iOnorder,"; $this->obDb->query .= "vShipCode,vShipNotes,tmDuedate "; #EXTRA SPACE IN FRONT OF FROM $this->obDb->query .= " FROM " . TEMPCART . " T," . PRODUCTS . " P WHERE "; #EXTRA SPACE $this->obDb->query .= " iProdId_FK=iProdId_PK AND vSessionId='" . SESSIONID . "'"; #FLAG TO INDICATE SEPERATE BACKORDER AND NORMAL ORDER $_SESSION['backOrderSeperate'] = $this->libFunc->ifSet($_SESSION, 'backOrderSeperate', '0'); #FLAG TO INDICATE WHETHER PROCESSING BACKORDER OR NOT $_SESSION['backOrderProcess'] = $this->libFunc->ifSet($_SESSION, 'backOrderProcess', '0'); if ($_SESSION['backOrderSeperate'] == 1 && $_SESSION['backOrderProcess'] == 1) { $this->obDb->query .= " AND T.iBackOrder='1'"; } elseif ($_SESSION['backOrderSeperate'] == 1) { $this->obDb->query .= " AND T.iBackOrder<>'1'"; } $rowCart = $this->obDb->fetchQuery(); $rowCartCount = $this->obDb->record_count; $this->ObTpl = new template(); $this->ObTpl->set_file("TPL_REVIEW_FILE", $this->reviewTemplate); #SETTING BLOCKS $this->ObTpl->set_block("TPL_REVIEW_FILE", "TPL_CART_BLK", "cart_blk"); $this->ObTpl->set_block("TPL_CART_BLK", "TPL_VAR_CARTPRODUCTS", "cartproduct_blk"); $this->ObTpl->set_block("TPL_CART_BLK", "TPL_DELIVERY_BLK", "delivery_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_MPOINTS_BLK", "memberpoint_blk"); $this->ObTpl->set_block("TPL_CART_BLK", "TPL_CARTWEIGHT_BLK", "cartWeight_blk"); $this->ObTpl->set_block("TPL_CART_BLK", "TPL_USEDMEMBERPOINTS_BLK", "usedMemberPoint_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_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_VAT", ''); $this->ObTpl->set_var("TPL_VAR_TAXNAME", VAT_TAX_TEXT); $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("memberpoint_blk", ""); $this->ObTpl->set_var("usedMemberPoint_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("gift_blk", ""); $this->ObTpl->set_var("cartproduct_blk", ""); $this->ObTpl->set_var("kit_blk", ""); $this->ObTpl->set_var("vat_blk", ""); $this->ObTpl->set_var("TPL_VAR_MSG", ""); $this->ObTpl->set_var("TPL_VAR_CART_VOLDISCOUNT", ""); $this->ObTpl->set_var("TPL_VAR_MESSAGE", ""); $this->ObTpl->set_var("TPL_VAR_SAMEASBILLING", ""); //defining language variables $this->ObTpl->set_var("LANG_VAR_REVIEWYOURORDER", LANG_REVIEWORDERTXT); $this->ObTpl->set_var("LANG_VAR_PAYMENTMETHOD", LANG_PAYMENTMETHODTXT); $this->ObTpl->set_var("LANG_VAR_POSTAGEMETHOD", LANG_POSTAGEMETHODTXT); $this->ObTpl->set_var("LANG_VAR_BILLINGADDRESS", LANG_BILLINGADDRESS); $this->ObTpl->set_var("LANG_VAR_DELIVERYADDRESS", LANG_DELIVERYADDRESS); $this->ObTpl->set_var("LANG_VAR_QUANTITY", LANG_QUANTITY); $this->ObTpl->set_var("LANG_VAR_PRODUCT", LANG_PRODUCT); $this->ObTpl->set_var("LANG_VAR_PRICE", LANG_PRICE); $this->ObTpl->set_var("LANG_VAR_TOTAL", LANG_TOTAL); $this->ObTpl->set_var("LANG_VAR_ACCUMULATES", LANG_ACCUMULATE); $this->ObTpl->set_var("LANG_VAR_MEMPOINTS", LANG_REWARDPOINTS); $this->ObTpl->set_var("LANG_VAR_SUBTOTAL", LANG_SUBTOTAL); $this->ObTpl->set_var("LANG_VAR_VOLUME", LANG_VOLUMEDISCOUNT); $this->ObTpl->set_var("LANG_VAR_PRODUCTWEIGHT", LANG_PRODUCTWEIGT); $this->ObTpl->set_var("LANG_VAR_VIEWCARTIMAGES", LANG_VIEWCARTIMAGE); $_SESSION['alt_ship'] = $this->libFunc->ifSet($_SESSION, "alt_ship", 0); if ($_SESSION['alt_ship'] == 1) { $this->ObTpl->set_var("TPL_VAR_SAMEASBILLING", MSG_SAMEASBILLING); } else { $this->ObTpl->parse("delivery_blk", "TPL_DELIVERY_BLK"); } #MESSAGE HANDLING $mode = $this->libFunc->ifSet($this->request, 'mode', '0'); $mode1 = $this->libFunc->ifSet($this->request, 'mode1', '0'); $hsbcerr = $this->libFunc->ifSet($this->request, 'errhsbc', '0'); $securetraderr = $this->libFunc->ifSet($this->request, 'securetrad', '0'); if ($hsbcerr == 1) { $msg = $this->hsbcmessages(); $this->ObTpl->set_var("TPL_VAR_MESSAGE", $msg); } elseif ($mode == 'cancel' || $mode1 == 'cancel') { $this->ObTpl->set_var("TPL_VAR_MESSAGE", MSG_PAYPAL_CANCEL); } elseif (!empty($this->errMsg)) { $this->ObTpl->set_var("TPL_VAR_MESSAGE", $this->errMsg); } #FORM URL $formUrl = $this->libFunc->m_safeUrl(SITE_SAFEURL . "ecom/index.php?action=checkout.saveorder"); $this->ObTpl->set_var("TPL_VAR_FORMURL", $formUrl); #SETTING BILL STATENAME if ($this->libFunc->ifSet($_SESSION, 'bill_state_id', '0')) { $this->obDb->query = "SELECT vStateName FROM " . STATES . " where iStateId_PK = '" . $_SESSION['bill_state_id'] . "'"; $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", $_SESSION['bill_state']); } #SETTING BILL COUNTRY NAME $this->obDb->query = "SELECT vCountryName FROM " . COUNTRY . " where iCountryId_PK = '" . $_SESSION['bill_country_id'] . "'"; $row_country = $this->obDb->fetchQuery(); $this->ObTpl->set_var("TPL_VAR_BILLCOUNTRY", $this->libFunc->m_displayContent($row_country[0]->vCountryName)); #SETTING SHIP STATENAME if ($this->libFunc->ifSet($_SESSION, 'ship_state_id', '0')) { $this->obDb->query = "SELECT vStateName FROM " . STATES . " where iStateId_PK = '" . $_SESSION['ship_state_id'] . "'"; $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", $_SESSION['ship_state']); } #SETTING SHIP COUNTRYNAME $this->obDb->query = "SELECT vCountryName FROM " . COUNTRY . " where iCountryId_PK = '" . $_SESSION['ship_country_id'] . "'"; $row_country = $this->obDb->fetchQuery(); $this->ObTpl->set_var("TPL_VAR_SHIPCOUNTRY", $this->libFunc->m_displayContent($row_country[0]->vCountryName)); #SETTING BILLLING INFO $this->ObTpl->set_var("TPL_VAR_FIRSTNAME", $this->libFunc->m_displayContent($_SESSION['first_name'])); $this->ObTpl->set_var("TPL_VAR_LASTNAME", $this->libFunc->m_displayContent($_SESSION['last_name'])); $this->ObTpl->set_var("TPL_VAR_EMAIL", $this->libFunc->m_displayContent($_SESSION['email'])); $this->ObTpl->set_var("TPL_VAR_ADDRESS1", $this->libFunc->m_displayContent($_SESSION['address1'])); $this->ObTpl->set_var("TPL_VAR_ADDRESS2", $this->libFunc->m_displayContent($_SESSION['address2'])); $this->ObTpl->set_var("TPL_VAR_CITY", $this->libFunc->m_displayContent($_SESSION['city'])); $this->ObTpl->set_var("TPL_VAR_ZIP", $this->libFunc->m_displayContent($_SESSION['zip'])); $this->ObTpl->set_var("TPL_VAR_COMPANY", $this->libFunc->m_displayContent($_SESSION['company'])); $this->ObTpl->set_var("TPL_VAR_PHONE", $this->libFunc->m_displayContent($_SESSION['phone'])); $this->ObTpl->set_var("TPL_VAR_HOMEPAGE", $this->libFunc->m_displayContent($_SESSION['company'])); $this->ObTpl->set_var("TPL_VAR_MPOINTS", ""); #SETTING SHIPPING INFO $this->ObTpl->set_var("TPL_VAR_ALTNAME", $this->libFunc->m_displayContent($_SESSION['alt_name'])); $this->ObTpl->set_var("TPL_VAR_ALTADDR1", $this->libFunc->m_displayContent($_SESSION['alt_address1'])); $this->ObTpl->set_var("TPL_VAR_ALTADDR2", $this->libFunc->m_displayContent($_SESSION['alt_address2'])); $this->ObTpl->set_var("TPL_VAR_ALTCITY", $this->libFunc->m_displayContent($_SESSION['alt_city'])); $this->ObTpl->set_var("TPL_VAR_ALTCOMPANY", $this->libFunc->m_displayContent($_SESSION['alt_company'])); $this->ObTpl->set_var("SHIP_STATE", ""); $this->ObTpl->set_var("TPL_VAR_ALTZIP", $this->libFunc->m_displayContent($_SESSION['alt_zip'])); $this->ObTpl->set_var("TPL_VAR_ALTPHONE", $this->libFunc->m_displayContent($_SESSION['alt_phone'])); #POST VARIABLES********************************************** $this->request['paymethod'] = $_SESSION['payMethod']; $_SESSION['payMethod'] = $this->libFunc->ifSet($_SESSION, 'payMethod', 'none'); if ($this->libFunc->ifSet($this->request, 'paymethod', '0')) { $_SESSION['payMethod'] = $this->request['paymethod']; } if ($this->libFunc->ifSet($this->request, 'mail_list', '0')) { $_SESSION['mail_list'] = $this->request['mail_list']; } #PAYMENT METHOD if ($this->libFunc->ifSet($this->request, 'comments', '0')) { $_SESSION['comments'] = $this->libFunc->m_displayContent($this->request['comments']); } if ($_SESSION['comments'] == 'special requirements') { $_SESSION['comments'] = ''; } if ($this->libFunc->ifSet($_SESSION, 'discountCode', '')) { $discountstring = $comFunc->m_calculateDiscount($_SESSION['discountCode']); $discountarray = explode(",", $discountstring); $this->discountPrice = $discountarray[0]; $this->offertype = $discountarray[1]; $this->minAmount = $discountarray[2]; } if ($this->libFunc->ifSet($_SESSION, 'giftCertCode', '')) { $this->giftCertPrice = $comFunc->m_calculateGiftCertPrice($_SESSION['giftCertCode']); } // Begin Card Holder Protx Modification if ($this->libFunc->ifSet($this->request, 'cardholder_name', '')) { $_SESSION['cardholder_name'] = $this->request['cardholder_name']; } else { $_SESSION['cardholder_name'] = $this->libFunc->ifSet($_SESSION, 'cardholder_name', ''); } // End Card Holder Protx Modification if ($this->libFunc->ifSet($this->request, 'cc_number', '')) { $_SESSION['cc_number'] = $this->request['cc_number']; } else { $_SESSION['cc_number'] = $this->libFunc->ifSet($_SESSION, 'cc_number', ''); } if ($this->libFunc->ifSet($this->request, 'cc_type', '')) { $_SESSION['cc_type'] = $this->request['cc_type']; } else { $_SESSION['cc_type'] = $this->libFunc->ifSet($_SESSION, 'cc_type', ''); } if ($this->libFunc->ifSet($this->request, 'cv2', '')) { $_SESSION['cv2'] = $this->request['cv2']; } else { $_SESSION['cv2'] = $this->libFunc->ifSet($_SESSION, 'cv2', ''); } if ($this->libFunc->ifSet($this->request, 'cc_year', '')) { $_SESSION['cc_year'] = $this->request['cc_year']; } else { $_SESSION['cc_year'] = $this->libFunc->ifSet($_SESSION, 'cc_year', ''); } if ($this->libFunc->ifSet($this->request, 'cc_month', '0')) { $_SESSION['cc_month'] = $this->request['cc_month']; } else { $_SESSION['cc_month'] = $this->libFunc->ifSet($_SESSION, 'cc_month', ''); } if ($this->libFunc->ifSet($this->request, 'cc_start_year', '0')) { $_SESSION['cc_start_year'] = $this->request['cc_start_year']; } else { $_SESSION['cc_start_year'] = $this->libFunc->ifSet($_SESSION, 'cc_start_year', ''); } if ($this->libFunc->ifSet($this->request, 'cc_start_month', '0')) { $_SESSION['cc_start_month'] = $this->request['cc_start_month']; } else { $_SESSION['cc_start_month'] = $this->libFunc->ifSet($_SESSION, 'cc_start_month', ''); } if ($this->libFunc->ifSet($this->request, 'issuenumber', '0')) { $_SESSION['issuenumber'] = $this->request['issuenumber']; } else { $_SESSION['issuenumber'] = $this->libFunc->ifSet($_SESSION, 'issuenumber', ''); } if ($this->libFunc->ifSet($this->request, 'acct', '0')) { $_SESSION['acct'] = $this->request['acct']; } else { $_SESSION['acct'] = $this->libFunc->ifSet($_SESSION, 'acct', '0'); } if ($this->libFunc->ifSet($this->request, 'aba', '0')) { $_SESSION['aba'] = $this->request['aba']; } else { $_SESSION['aba'] = $this->libFunc->ifSet($_SESSION, 'aba', '0'); } #************************************************************* $this->ObTpl->set_var("TPL_VAR_PAYMENTMETHOD", $comFunc->m_paymentMethod($_SESSION['payMethod'], $_SESSION['codPrice'])); $this->ObTpl->set_var("TPL_VAR_PAYMETHOD", $_SESSION['payMethod']); $this->ObTpl->set_var("TPL_VAR_CCNUMBER", $_SESSION['cc_number']); $this->ObTpl->set_var("TPL_VAR_CCTYPE", $_SESSION['cc_type']); $this->ObTpl->set_var("TPL_VAR_CV2", $_SESSION['cv2']); $this->ObTpl->set_var("TPL_VAR_CCYEAR", $_SESSION['cc_year']); $this->ObTpl->set_var("TPL_VAR_CCMONTH", $_SESSION['cc_month']); $this->ObTpl->set_var("TPL_VAR_STARTYEAR", $_SESSION['cc_start_year']); $this->ObTpl->set_var("TPL_VAR_STARTMONTH", $_SESSION['cc_start_month']); $this->ObTpl->set_var("TPL_VAR_ISSUENUMBER", $_SESSION['issuenumber']); $this->ObTpl->set_var("TPL_VAR_ACCTNUMBER", $_SESSION['acct']); $this->ObTpl->set_var("TPL_VAR_ABA_ACCT", $_SESSION['aba']); #DISPLAY CART PRODUCT if ($rowCartCount > 0) { if (!is_null($_SESSION['totalVendor']) && $_SESSION['totalVendor'] > 0) { $this->ObTpl->set_var("TPL_VAR_TOTAL_SUPPLIER", $_SESSION['totalVendor']); } else { $this->ObTpl->set_var("TPL_VAR_TOTAL_SUPPLIER", ""); } for ($i = 0; $i < $rowCartCount; $i++) { $this->ObTpl->set_var("TPL_VAR_CART_VOLDISCOUNT", ""); $this->ObTpl->set_var("TPL_VAR_BACKORDER", ""); $this->ObTpl->set_var("TPL_VAR_OPTIONS", ""); $this->ObTpl->set_var("TPL_VAR_CHOICES", ""); $this->ObTpl->set_var("TPL_VAR_FREESHIPMSG", ""); $this->ObTpl->set_var("TPL_VAR_TAXABLE", ""); $this->ObTpl->set_var("TPL_VAR_SHIPNOTES", ""); $this->ObTpl->set_var("kit_blk", ""); $this->price = 0; #INTIALIZING $this->total = 0; #MARGIN CALCULATOR switch (MARGINSTATUS) { case "increase": $rowCart[$i]->fPrice = $rowCart[$i]->fPrice * MARGINPERCENT / 100 + $rowCart[$i]->fPrice; break; case "decrease": $rowCart[$i]->fPrice = $rowCart[$i]->fPrice - $rowCart[$i]->fPrice * MARGINPERCENT / 100; break; default: $rowCart[$i]->fPrice = $rowCart[$i]->fPrice; break; } #END MARGIN CALCULATOR //--- Switch to retail price if Retail customer if ($comFunc->m_checkCustomerType() == 1 && ENABLE_WHOLESALE == 1 && $rowCart[$i]->fRetailPrice > 0) { $rowCart[$i]->fPrice = $rowCart[$i]->fRetailPrice; } //----End switch price #BACK ORDERED if (isset($_SESSION['backorder'][$rowCart[$i]->iProdId_FK]) && $_SESSION['backorder'][$rowCart[$i]->iProdId_FK] == 1) { $strBackOrder = "This item is on backorder"; if ($rowCart[$i]->iOnorder > 0) { $strBackOrder .= "<br />On Order: " . $rowCart[$i]->iOnorder; } if (!empty($rowCart[$i]->tmDuedate)) { $formatedDueDate = $this->libFunc->dateFormat2($rowCart[$i]->tmDuedate); $strBackOrder .= " (Due date: " . $formatedDueDate . ")"; } $this->ObTpl->set_var("TPL_VAR_BACKORDER", $strBackOrder); } $this->ObTpl->set_var("TPL_VAR_CARTID", $rowCart[$i]->iTmpCartId_PK); $comFunc->cartId = $rowCart[$i]->iTmpCartId_PK; #FOR POSTAGE-CODES $comFunc->productId = $rowCart[$i]->iProdId_FK; $comFunc->qty = $rowCart[$i]->iQty; $comFunc->price = $this->price; ##GIFTWRAP URL if ($rowCart[$i]->iGiftWrap != 0) { $this->ObTpl->set_var("gift_blk", ""); $this->ObTpl->set_var("TPL_VAR_GIFTWRAP", $comFunc->m_dspGiftWrap($rowCart[$i]->iGiftWrap, $rowCart[$i]->iTmpCartId_PK)); } else { $this->ObTpl->set_var("TPL_VAR_GIFTWRAP", ""); $giftWrapUrl = SITE_SAFEURL . "ecom/index.php?action=ecom.giftwrap&mode=" . $rowCart[$i]->iTmpCartId_PK; $this->ObTpl->set_var("TPL_VAR_GIFTWRAPURL", $this->libFunc->m_safeUrl($giftWrapUrl)); $this->ObTpl->parse("gift_blk", "TPL_GIFTWRAP_BLK"); } if ($rowCart[$i]->iKit == 1) { $this->obDb->query = "SELECT vTitle,iProdId_FK,vSku FROM " . PRODUCTKITS . "," . PRODUCTS . " WHERE iProdId_FK=iProdId_PK AND iKitId='" . $rowCart[$i]->iProdId_FK . "'"; $rsKit = $this->obDb->fetchQuery(); $rsKitCount = $this->obDb->record_count; for ($j = 0; $j < $rsKitCount; $j++) { $comFunc->kitProductId = $rsKit[$j]->iProdId_FK; #GET KIT OPTIONS $kitOptions = $comFunc->m_dspCartProductKitOptions(); if ($kitOptions == ' ') { $this->ObTpl->set_var("TPL_VAR_KITOPTIONS", ""); } else { $this->ObTpl->set_var("TPL_VAR_KITOPTIONS", $kitOptions); } $this->ObTpl->set_var("TPL_VAR_KITSKU", $this->libFunc->m_displayContent($rsKit[$j]->vSku)); $this->ObTpl->set_var("TPL_VAR_KITTITLE", $this->libFunc->m_displayContent($rsKit[$j]->vTitle)); $this->ObTpl->parse("kit_blk", "TPL_KIT_BLK", true); } } else { #GET CART OPTIONS $this->ObTpl->set_var("TPL_VAR_OPTIONS", $comFunc->m_dspCartProductOptions()); #GET CART CHOICES $this->ObTpl->set_var("TPL_VAR_CHOICES", $comFunc->m_dspCartProductChoices()); } # (OPTION And choice effected amount) $this->price = $comFunc->price; #VOLUME DISCOUNT************************************************** #DISCOUNT ACCORDING TO QTY $vDiscoutPerItem = number_format($rowCart[$i]->fVolDiscount, 2, '.', ''); if ($vDiscoutPerItem > 0) { $vDiscountPerCartElement = number_format($rowCart[$i]->iQty * $vDiscoutPerItem, 2, '.', ''); $this->ObTpl->set_var("TPL_VAR_CART_VOLDISCOUNT", "Volume Discount: " . CONST_CURRENCY . $vDiscoutPerItem . " each - Total: " . CONST_CURRENCY . $vDiscountPerCartElement . "<br />"); $this->volDiscount = $this->volDiscount + $vDiscountPerCartElement; } $this->ObTpl->set_var("TPL_VAR_TITLE", $this->libFunc->m_displayContent($rowCart[$i]->vTitle)); //$this->ObTpl->set_var("TPL_VAR_CARTIMAGE",$this->libFunc->m_displayContent($rowCart[$i]->vImage1)); if ($this->libFunc->m_displayContent($rowCart[$i]->vImage1) != "") { $this->ObTpl->set_var("TPL_VAR_CARTIMAGE_TAG", "<img src=\"" . SITE_SAFEURL . "libs/timthumb.php?src=/images/product/" . $this->libFunc->m_displayContent($rowCart[$i]->vImage1) . "&h=70&w=70&zc=r\" alt=\"" . $this->libFunc->m_displayContent($rowCart[$i]->vTitle) . "\" />"); } else { $this->ObTpl->set_var("TPL_VAR_CARTIMAGE_TAG", "No image available"); } $this->ObTpl->set_var("TPL_VAR_SKU", $this->libFunc->m_displayContent($rowCart[$i]->vSku)); $this->price = $this->price + $rowCart[$i]->fPrice; $fullprice = $this->price; if ($rowCart[$i]->iTaxable == 1) { if (NETGROSS == 1) { $vatPercent = $this->libFunc->m_vatCalculate(); $actualprice = $this->price * ($vatPercent / 100 + 1); $vatAmount = $this->price * ($vatPercent / 100) * $rowCart[$i]->iQty; //$this->price = $actualprice; } } $this->ObTpl->set_var("TPL_VAR_PRICE", number_format($this->price, 2, '.', '')); $this->ObTpl->set_var("TPL_VAR_QTY", $rowCart[$i]->iQty); $this->totalQty += $rowCart[$i]->iQty; $this->total += $rowCart[$i]->iQty * $this->price; $this->ObTpl->set_var("TPL_VAR_TOTAL", number_format($this->total, 2, '.', '')); if ($rowCart[$i]->iFreeShip != 1) { $this->postageTotal += $this->total; } else { $this->ObTpl->set_var("TPL_VAR_FREESHIPMSG", "<em>Free P&P</em><br />"); } if ($rowCart[$i]->iTaxable == 1) { if (NETGROSS == 1) { $this->taxTotal += $vatAmount; } else { $this->taxTotal += $this->price * $rowCart[$i]->iQty; } if ($comFunc->m_checkCustomerType() == 1 && ENABLE_WHOLESALE == 1 && $rowCart[$i]->fRetailPrice > 0) { $this->taxTotal = $this->taxTotal - ($rowCart[$i]->fPrice - $rowCart[$i]->fRetailPrice) * $rowCart[$i]->iQty; } } else { if (HIDENOVAT != 1) { $this->ObTpl->set_var("TPL_VAR_TAXABLE", "<em>" . LBL_NOTAX . "</em><br />"); } else { $this->ObTpl->set_var("TPL_VAR_TAXABLE", ""); } } //Quantity Multiplied if ($rowCart[$i]->fItemWeight > 0) { $this->cartWeight += $rowCart[$i]->fItemWeight * $rowCart[$i]->iQty; } $this->subTotal = $this->subTotal + $this->total; #SAFE URLS $removeUrl = SITE_SAFEURL . "ecom/index.php?action=ecom.remove&mode=" . $rowCart[$i]->iTmpCartId_PK; $this->ObTpl->set_var("TPL_VAR_REMOVEURL", $this->libFunc->m_safeUrl($removeUrl)); $cartUpdateUrl = SITE_SAFEURL . "ecom/index.php?action=ecom.updateCart"; $this->ObTpl->set_var("TPL_VAR_UPDATEURL", $this->libFunc->m_safeUrl($cartUpdateUrl)); $productUrl = SITE_URL . "ecom/index.php?action=ecom.pdetails&mode=" . $rowCart[$i]->vSeoTitle; $this->ObTpl->set_var("TPL_VAR_PRODUCTURL", $this->libFunc->m_safeUrl($productUrl)); if (!empty($rowCart[$i]->vShipNotes)) { $this->ObTpl->set_var("TPL_VAR_SHIPNOTES", "Notes: " . $this->libFunc->m_displayContent($rowCart[$i]->vShipNotes) . "<br />"); } $this->ObTpl->parse("cartproduct_blk", "TPL_VAR_CARTPRODUCTS", true); } //echo $this->taxTotal."<br/>"; $this->ObTpl->set_var("TPL_VAR_SUBTOTAL", number_format($this->subTotal, 2, '.', '')); $this->grandTotal = $this->subTotal; #***************MEMBER POINTS ON SUB TOTAL**************** if (OFFERMPOINT == 1) { $this->memPoints = MPOINTCALCULATION * $this->subTotal; $_SESSION['memberPointsEarned'] = floor($this->memPoints); $this->ObTpl->set_var("TPL_VAR_MPOINTS", floor($this->memPoints)); $this->ObTpl->parse("memberpoint_blk", "TPL_MPOINTS_BLK"); } #************************* PROMOTION DISCOUNTS********* $this->promotionDiscount = $comFunc->m_calculatePromotionDiscount($this->subTotal); if ($this->promotionDiscount >= 0) { if ($this->promotionDiscount == 0) { $displayDiscount = 'No Charge'; } else { $displayDiscount = "-" . CONST_CURRENCY . number_format($this->promotionDiscount, 2, '.', ''); } if (isset($comFunc->PromotionDesc) && !empty($comFunc->PromotionDesc)) { $this->ObTpl->set_var("TPL_VAR_PROMOTIONDESC", $comFunc->PromotionDesc); } else { $this->ObTpl->set_var("TPL_VAR_PROMOTIONDESC", "Promotion Discounts"); } $this->ObTpl->set_var("TPL_VAR_PDISCOUNTS", $displayDiscount); $_SESSION['promotionDiscountPrice'] = $this->promotionDiscount; $this->grandTotal -= $this->promotionDiscount; $this->taxTotal -= $this->promotionDiscount; //echo $this->taxTotal."<br/>"; $this->ObTpl->parse("promodiscounts_blk", "TPL_PROMODISCOUNTS_BLK"); } else { $_SESSION['promotionDiscountPrice'] = 0; } if ($this->volDiscount > 0) { $this->ObTpl->set_var("TPL_VAR_VOLDISCOUNT", number_format($this->volDiscount, 2, '.', '')); $this->grandTotal -= $this->volDiscount; $this->taxTotal -= $this->volDiscount; $this->ObTpl->parse("volDiscounts_blk", "TPL_VOLDISCOUNTS_BLK"); } #COD PRICE(PAYMENT GATEWAY ADDITIONAL PRICE) if ($_SESSION['codPrice'] > 0) { $this->ObTpl->set_var("TPL_VAR_CODPRICE", number_format($_SESSION['codPrice'], 2, '.', '')); $this->grandTotal += number_format($_SESSION['codPrice'], 2, '.', ''); $this->ObTpl->parse("cod_blk", "TPL_COD_BLK"); } $this->ObTpl->set_var("TPL_VAR_DISCOUNTCODE", ""); $this->ObTpl->set_var("TPL_VAR_GIFTCODE", ""); #CHECK FOR DISCOUNTS if ($this->discountPrice != 0) { if ($this->grandTotal > $this->minAmount) { if ($this->offertype == "percent") { $discountedPrice = round($this->discountPrice * ($this->grandTotal / 100), 2); } else { if ($this->discountPrice > $this->grandTotal) { $this->discountPrice = $this->grandTotal; } $discountedPrice = round($this->discountPrice, 2); } $this->ObTpl->set_var("TPL_VAR_DISCOUNTCODE", "(" . $_SESSION['discountCode'] . ")"); $this->ObTpl->set_var("TPL_VAR_DISCOUNTPRICE", number_format($discountedPrice, 2, '.', '')); if ($this->taxTotal > 0) { $this->taxTotal -= $discountedPrice; $this->grandTotal -= $discountedPrice; } else { $this->grandTotal -= $discountedPrice; //No VAT on order so do not adjust the VAT } //echo $this->taxTotal."<br/>"; $_SESSION['discountPrice'] = $discountedPrice; $this->ObTpl->parse("discount_blk", "TPL_DISCOUNT_BLK"); } else { $this->ObTpl->set_var("TPL_VAR_DISCOUNTCODE", "(" . $_SESSION['discountCode'] . ") Discount minimum is not reached "); $this->ObTpl->set_var("TPL_VAR_DISCOUNTPRICE", "0.00"); $this->ObTpl->parse("discount_blk", "TPL_DISCOUNT_BLK"); } } elseif ($this->libFunc->ifSet($_SESSION, 'discountCode', '0') && $_SESSION['discountCode'] != 'discount code') { $this->ObTpl->set_var("TPL_VAR_DISCOUNTCODE", "(" . $_SESSION['discountCode'] . ") not found"); $this->ObTpl->set_var("TPL_VAR_DISCOUNTPRICE", "0.00"); $this->ObTpl->parse("discount_blk", "TPL_DISCOUNT_BLK"); } #CHECK FOR GIFTCERTIFICATES if ($this->giftCertPrice != 0) { if ($this->grandTotal < $this->giftCertPrice) { $this->giftCertPrice = $this->grandTotal; } if ($this->grandTotal <= 0) { $this->giftCertPrice = 0; $this->grandTotal = 0; } $this->taxTotal -= $this->giftCertPrice; //echo $this->taxTotal."<br/>"; $this->grandTotal -= $this->giftCertPrice; $_SESSION['giftCertPrice'] = $this->giftCertPrice; $this->ObTpl->set_var("TPL_VAR_GIFTCERTPRICE", number_format($this->giftCertPrice, 2, '.', '')); $this->ObTpl->parse("giftcert_blk", "TPL_GIFTCERT_BLK"); } elseif ($this->libFunc->ifSet($_SESSION, 'giftCertCode', '0') && $_SESSION['giftCertCode'] != 'gift certificate number') { $this->ObTpl->set_var("TPL_VAR_GIFTCODE", "(" . $_SESSION['giftCertCode'] . ") not found"); $this->ObTpl->set_var("TPL_VAR_GIFTCERTPRICE", "0.00"); $this->ObTpl->parse("giftcert_blk", "TPL_GIFTCERT_BLK"); } #TO USE MEMBER POINTS***************************************** if (isset($_SESSION['useMemberPoints']) && $_SESSION['useMemberPoints'] == 'yes' && OFFERMPOINT == 1) { //Get the total points that will be enough to use in order. ## OrderAmount = 100 ## PointValue = 5 ## TotalPointsEnough = 20 //Deduct only these points on checkout process and leave the rest of the points if (MPOINTVALUE > 0) { $pointsRequired = $this->grandTotal / MPOINTVALUE; } else { $pointsRequired = 0; } if ($_SESSION['memberPoints'] >= $pointsRequired) { $_SESSION['usedMemberPoints'] = $pointsRequired; } else { $_SESSION['usedMemberPoints'] = $_SESSION['memberPoints']; } #Amount using member Points $_SESSION['memberPointsUsedAmount'] = $_SESSION['usedMemberPoints'] * MPOINTVALUE; #SETTING TEMPLATE VARIABLE FOR MEMBER POINTS if (isset($_SESSION['memberPointsUsedAmount']) && isset($_SESSION['usedMemberPoints'])) { $this->ObTpl->set_var("TPL_VAR_MPOINTSAVAIABLE", floor($_SESSION['usedMemberPoints'])); $this->ObTpl->set_var("TPL_VAR_MPOINTSPRICE", number_format($_SESSION['memberPointsUsedAmount'], 2, '.', '')); #Modified Total $this->grandTotal -= $_SESSION['memberPointsUsedAmount']; #SUBTRACTING MEMBERPOINTS $this->taxTotal -= $_SESSION['memberPointsUsedAmount']; //echo $this->taxTotal."<br/>"; $this->ObTpl->parse("usedMemberPoint_blk", "TPL_USEDMEMBERPOINTS_BLK"); } } if ($this->taxTotal < 0) { $this->taxTotal = 0; } #POSTAGE CALCULATION************************** $this->ObTpl->set_var("TPL_VAR_POSTAGEPRICE", number_format($_SESSION['postagePrice2'], 2, '.', '')); $this->grandTotal += $_SESSION['postagePrice2']; $this->ObTpl->set_var("TPL_VAR_POSTAGEMETHOD", $_SESSION['postagemethodname']); $this->ObTpl->parse("postage_blk", "TPL_POSTAGE_BLK"); $temp = $comFunc->m_Calculate_Tax($this->taxTotal, $_SESSION['postagePrice2'], $_SESSION['ship_country_id'], $_SESSION['ship_state_id']); $this->vatTotal = $temp[0]; $this->ObTpl->set_var("TPL_VAR_VAT", $temp[1]); if ($this->vatTotal > 0) { $this->ObTpl->set_var("TPL_VAR_VATPRICE", number_format($this->vatTotal, 2, '.', '')); $this->grandTotal += $this->vatTotal; $this->ObTpl->parse("vat_blk", "TPL_VAT_BLK"); } $_SESSION['vatTotal'] = $this->vatTotal; $_SESSION['VAT'] = $temp[1]; $_SESSION['totalQty'] = $this->totalQty; $this->grandTotal = ceil($this->grandTotal * 1000) / 1000; $_SESSION['grandTotal'] = $this->grandTotal; $this->ObTpl->set_var("TPL_VAR_CURRENTTOTAL", number_format($this->grandTotal, 2, '.', '')); $this->ObTpl->parse("cart_blk", "TPL_CART_BLK"); } else { $returnUrl = SITE_URL . "index.php"; $this->ObTpl->set_var("TPL_VAR_MSG", MSG_CART_EMPTY . " <a href=" . $this->libFunc->m_safeUrl($returnUrl) . ">" . MSG_RETURN . "</a>"); } return $this->ObTpl->parse("return", "TPL_REVIEW_FILE"); }
function m_return() { $comFunc = new c_commonFunctions(); $comFunc->obDb = $this->obDb; $this->ObTpl = new template(); $mode = $_SESSION['order_id']; $this->ObTpl = new template(); $this->ObTpl->set_file("TPL_RETURN_FILE", $this->template); $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,vSessionid,iCustomerid_FK"; $this->obDb->query .= " FROM " . ORDERS . " WHERE iOrderid_PK='" . $mode . "'"; if (isset($_SESSION['userid']) && !empty($_SESSION['userid'])) { $this->obDb->query .= " AND iCustomerid_FK='" . $_SESSION['userid'] . "'"; } $qryResult = $this->obDb->fetchQuery(); $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='" . $mode . "'"; $rsOrderProduct = $this->obDb->fetchQuery(); $_SESSION['google']['id'] = $qryResult[0]->iInvoice; $_SESSION['google']['state'] = $this->libFunc->m_displayContent($row_state[0]->vStateName); $_SESSION['google']['state'] = $qryResult[0]->vStateName; $_SESSION['google']['country'] = $this->libFunc->m_displayContent($row_country[0]->vCountryName); $_SESSION['google']['city'] = $this->libFunc->m_displayContent($qryResult[0]->vCity); $_SESSION['google']['products'] = array(); $comFunc->orderId = $mode; foreach ($rsOrderProduct as $key => $value) { $comFunc->orderProductId = $rsOrderProduct[$key]->iOrderProductid_PK; $comFunc->qty = $rsOrderProduct[$key]->iQty; $comFunc->price = 0; $_SESSION['google']['products'][] = "_gaq.push(['_addItem',\n\t\t\t\t\t '" . $_SESSION['google']['id'] . "',\n\t\t\t\t\t '" . $this->libFunc->m_displayContent($rsOrderProduct[$key]->vSku) . "',\n\t\t\t\t\t '" . $this->libFunc->m_displayContent($rsOrderProduct[$key]->vTitle) . "',\n\t\t\t\t\t '" . $comFunc->m_orderProductOptions() . " " . $comFunc->m_orderProductChoices() . "',\n\t\t\t\t\t '" . $this->price . "',\n\t\t\t\t\t '" . $rsOrderProduct[$key]->iQty . "'\n\t\t\t\t ]);"; } if ($qryResult[0]->fShipTotal > 0) { $_SESSION['google']['shipping'] = $qryResult[0]->fShipTotal; } else { $_SESSION['google']['shipping'] = 0; } $temptotal = $qryResult[0]->fTotalPrice - $_SESSION['google']['shipping'] - $qryResult[0]->fTaxPrice; $_SESSION['google']['shipping'] = $_SESSION['google']['shipping'] + $qryResult[0]->fCodCharge; $_SESSION['google']['subtotal'] = $temptotal; $_SESSION['google']['tax'] = $qryResult[0]->fTaxPrice; $_SESSION['google']['total'] = $qryResult[0]->fTotalPrice; $_SESSION['google']['paid'] = 1; //error_log(print_r($_SESSION['google'],1)."\n\n",3,'google.log'); //unset($_SESSION['google']['paid']); return $this->ObTpl->parse("return", "TPL_RETURN_FILE"); }
function valiadateSystemInfo() { if (!isset($this->request['dbServer'])) { $this->libFunc->m_mosRedirect("index.php"); } $this->errMsg = ""; $comFunc = new c_commonFunctions(); $comFunc->db_host = $this->request['dbServer']; $comFunc->db_user = $this->request['dbUserName']; $comFunc->db_password = $this->request['dbPassword']; $comFunc->db_port = "3306"; $comFunc->db_name = $this->request['dsn']; $comFunc->testTable = $this->request['dbPrefix'] . "temp_choices"; $returnValue = $comFunc->checkDatabase(); if ($returnValue != 1) { $this->err = 1; $this->errMsg .= $returnValue . "<br />"; } else { $checkPrefix = $comFunc->m_checkPrefix(); if ($checkPrefix != 1) { $this->err = 1; $this->errMsg .= $checkPrefix . "<br />"; } } if ($this->libFunc->m_isNull($this->request['dbServer'])) { $this->err = 1; $this->errMsg .= "Please enter your database server.<br /> "; } if ($this->libFunc->m_isNull($this->request['dsn'])) { $this->err = 1; $this->errMsg .= "Please enter your database name.<br /> "; } if ($this->libFunc->m_isNull($this->request['dbUserName'])) { $this->err = 1; $this->errMsg .= "Please enter your database username.<br /> "; } if ($this->libFunc->m_isNull($this->request['dbPassword'])) { $this->err = 1; $this->errMsg .= "Please enter your database password.<br /> "; } if ($this->libFunc->m_isNull($this->request['siteurl'])) { $this->err = 1; $this->errMsg .= "Please enter your secure URL.<br /> "; } if ($this->libFunc->m_isNull($this->request['adminUser'])) { $this->err = 1; $this->errMsg .= "Please enter your preferred admin username.<br /> "; } if ($this->libFunc->m_isNull($this->request['adminPassword'])) { $this->err = 1; $this->errMsg .= "Please enter your preferred admin password.<br /> "; } if ($this->libFunc->m_isNull($this->request['adminemail'])) { $this->err = 1; $this->errMsg .= "Please enter your admin email address.<br /> "; } if ($this->libFunc->m_isNull($this->request['license'])) { $this->err = 1; $this->errMsg .= "Please enter your license key.<br /> "; } else { $license = $this->license->DolicenseCheck($this->request['license']); if ($license['status'] == "Active") { if (isset($license['localkey'])) { $this->localLicense = $license['localkey']; } } elseif ($license['status'] == "Invalid") { $this->err = 1; $this->errMsg .= "Your license key is invalid.<br /> "; } elseif ($license['status'] == "Expired") { $this->err = 1; $this->errMsg .= "Your license key has expired.<br /> "; } elseif ($license['status'] == "Suspended") { $this->err = 1; $this->errMsg .= "Your license key has been suspended.<br /> "; } } if (!($handle = @fopen($this->filename, 'w+'))) { $this->err = 1; $this->errMsg .= "Unable to write file. Please make sure the <strong>/config/</strong> directory exists & is writable.<br /> "; } else { fclose($handle); } return $this->err; }
function m_viewCart() { $libFunc = new c_libFunctions(); $comFunc = new c_commonFunctions(); $comFunc->obDb = $this->obDb; $withoutBackorder = 0; $maxPostage = 0; #QUERY TEMPERARY & PRODUCT TABLE $this->obDb->query = "SELECT vTitle,vSeoTitle,fPrice,fRetailPrice,vSku,iQty,iTmpCartId_PK,iProdId_FK,vImage1,"; $this->obDb->query .= "iKit,iGiftWrap,fVolDiscount,iTaxable,fItemWeight,"; $this->obDb->query .= "iFreeShip,iOnorder,vShipCode,vShipNotes,tmDuedate "; $this->obDb->query .= " FROM " . TEMPCART . " AS T," . PRODUCTS . " AS P WHERE "; $this->obDb->query .= "(iProdId_FK=iProdId_PK AND vSessionId='" . SESSIONID . "') "; #FLAG TO INDICATE SEPERATE BACKORDER AND NORMAL ORDER $_SESSION['backOrderSeperate'] = $this->libFunc->ifSet($_SESSION, 'backOrderSeperate', '0'); #FLAG TO INDICATE WHETHER PROCESSING BACKORDER OR NOT $_SESSION['backOrderProcess'] = $this->libFunc->ifSet($_SESSION, 'backOrderProcess', '0'); if ($_SESSION['backOrderSeperate'] == 1 && $_SESSION['backOrderProcess'] == 1) { $this->obDb->query .= " AND T.iBackOrder='1'"; } elseif ($_SESSION['backOrderSeperate'] == 1) { $this->obDb->query .= " AND T.iBackOrder<>'1'"; } $this->obDb->query .= " ORDER BY T.iTmpCartId_PK"; $rowCart = $this->obDb->fetchQuery(); $rowCartCount = $this->obDb->record_count; $this->ObTpl = new template(); $this->ObTpl->set_file("TPL_DETAILS_FILE", $this->template); $this->ObTpl->set_var("TPL_VAR_JAVASCRIPTS", file_get_contents(SITE_PATH . "jscript/viewcart.js")); #SETTING BLOCKS FRO CART DISPLAY PAGE $this->ObTpl->set_block("TPL_DETAILS_FILE", "TPL_CART_BLK", "cart_blk"); $this->ObTpl->set_block("TPL_CART_BLK", "TPL_VAR_CARTPRODUCTS", "cartproduct_blk"); $this->ObTpl->set_block("TPL_CART_BLK", "TPL_VAR_POSTAGEDROPDOWN", "postagedropdown_blk"); $this->ObTpl->set_block("TPL_VAR_POSTAGEDROPDOWN", "TPL_VAR_POSTAGESTATEDROPDOWN", "postagestatedropdown_blk"); $this->ObTpl->set_block("TPL_CART_BLK", "TPL_REFUND_BLK", "return_blk"); $this->ObTpl->set_block("TPL_CART_BLK", "TPL_MPOINTS_BLK", "memberpoint_blk"); $this->ObTpl->set_block("TPL_CART_BLK", "TPL_DISCOUNTS_BLK", "discounts_blk"); $this->ObTpl->set_block("TPL_CART_BLK", "TPL_VOLDISCOUNTS_BLK", "volDiscounts_blk"); $this->ObTpl->set_block("TPL_CART_BLK", "TPL_CARTWEIGHT_BLK", "cartWeight_blk"); $this->ObTpl->set_block("TPL_CART_BLK", "TPL_POSTAGE_BLK", "postage_blk"); $this->ObTpl->set_block("TPL_CART_BLK", "TPL_DISCOUNT_BLK", "discount_blk"); $this->ObTpl->set_block("TPL_CART_BLK", "TPL_GIFTCERT_BLK", "giftcert_blk"); $this->ObTpl->set_block("TPL_CART_BLK", "TPL_VAT_BLK", "vat_blk"); $this->ObTpl->set_block("TPL_VAR_CARTPRODUCTS", "TPL_KIT_BLK", "kit_blk"); $this->ObTpl->set_block("TPL_VAR_CARTPRODUCTS", "TPL_GIFTWRAP_BLK", "gift_blk"); #IMAGES BLOCKS $this->ObTpl->set_block("TPL_CART_BLK", "TPL_MASTERCARD_BLK", "MASTERCARD_BLK"); $this->ObTpl->set_block("TPL_CART_BLK", "TPL_VISA_BLK", "VISA_BLK"); $this->ObTpl->set_block("TPL_CART_BLK", "TPL_AMEX_BLK", "AMEX_BLK"); $this->ObTpl->set_block("TPL_CART_BLK", "TPL_DISCOVER_BLK", "DISCOVER_BLK"); $this->ObTpl->set_block("TPL_CART_BLK", "TPL_DINERS_CLUB_BLK", "DINERS_CLUB_BLK"); $this->ObTpl->set_block("TPL_CART_BLK", "TPL_MAESTRO_BLK", "MAESTRO_BLK"); $this->ObTpl->set_block("TPL_CART_BLK", "TPL_SOLO_BLK", "SOLO_BLK"); $this->ObTpl->set_block("TPL_CART_BLK", "TPL_SWITCHCARD_BLK", "SWITCHCARD_BLK"); $this->ObTpl->set_block("TPL_CART_BLK", "TPL_STARTCHECKOUT_BLK", "startCheckout_blk"); #country and state blocks // $this->ObTpl->set_block("TPL_CART_BLK", "countryblk", "countryblks"); // $this->ObTpl->set_block("TPL_CART_BLK", "BillCountry", "nBillCountry"); $this->ObTpl->set_block("TPL_VAR_POSTAGEDROPDOWN", "BillCountry", "nBillCountry"); // $this->ObTpl->set_block("TPL_CART_BLK", "stateblk", "stateblks"); #INTAILAIZING $this->ObTpl->set_var("TPL_VAR_SITEURL", SITE_URL); $this->ObTpl->set_var("TPL_VAR_SAFESITEURL", 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_VAT", ""); $this->ObTpl->set_var("TPL_VAR_TAXNAME", VAT_TAX_TEXT); $this->ObTpl->set_var("TPL_VAR_MSG", ""); $this->ObTpl->set_var("cart_blk", ""); $this->ObTpl->set_var("return_blk", ""); $this->ObTpl->set_var("cartproduct_blk", ""); $this->ObTpl->set_var("memberpoint_blk", ""); $this->ObTpl->set_var("discounts_blk", ""); $this->ObTpl->set_var("volDiscounts_blk", ""); $this->ObTpl->set_var("cartWeight_blk", ""); $this->ObTpl->set_var("postage_blk", ""); $this->ObTpl->set_var("discount_blk", ""); $this->ObTpl->set_var("giftcert_blk", ""); $this->ObTpl->set_var("kit_blk", ""); $this->ObTpl->set_var("vat_blk", ""); $this->ObTpl->set_var("gift_blk", ""); $this->ObTpl->set_var("startCheckout_blk", ""); $this->ObTpl->set_var("postagedropdown_blk", ""); $this->ObTpl->set_var("postagestatedropdown_blk", ""); #defining language pack variables. $this->ObTpl->set_var("LANG_VAR_SHOPPINGBASKET", LANG_SHOPPINGBASKET); $this->ObTpl->set_var("LANG_VAR_ITEMQUANTITY", LANG_ITEMQUANTITY); $this->ObTpl->set_var("LANG_VAR_ADDGIFTWRAP", LANG_ADD_GIFTWRAP); $this->ObTpl->set_var("LANG_VAR_PRODUCT", LANG_PRODUCT); $this->ObTpl->set_var("LANG_VAR_PRICE", LANG_EXCLUDEVATPRICE); $this->ObTpl->set_var("LANG_VAR_TOTAL", LANG_TOTAL); $this->ObTpl->set_var("LANG_VAR_REMOVE", LANG_REMOVE); $this->ObTpl->set_var("LANG_VAR_MEMACCUMULATE", LANG_ACCUMULATE); $this->ObTpl->set_var("LANG_VAR_REWARDPOINTS", LANG_REWARDPOINTS); $this->ObTpl->set_var("LANG_VAR_SUBTOTAL", LANG_SUBTOTAL); $this->ObTpl->set_var("LANG_VAR_VOLUMEDISCOUNT", LANG_VOLUMEDISCOUNT); $this->ObTpl->set_var("LANG_VAR_PRODUCTWEIGHT", LANG_PRODUCTWEIGT); $this->ObTpl->set_var("LANG_VAR_POSTAGEMETHOD", LANG_POSTAGEMETHOD); $this->ObTpl->set_var("LANG_VAR_CURRENTTOTAL", LANG_CURRENTTOTAL); $this->ObTpl->set_var("LANG_VAR_STARTCHECKOUT", LANG_STARTCHECKOUT); $this->ObTpl->set_var("LANG_VAR_UPDATEBASKET", LANG_UPDATEBASKET); $this->ObTpl->set_var("LANG_VAR_EMPTYBASKET", LANG_EMPTYBASKET); $this->ObTpl->set_var("LANG_VAR_CONTINUESHOP", LANG_CONTINUESHOP); $this->ObTpl->set_var("LANG_VAR_PRODDELCONFIRM", LANG_PRODDELETECONFIRM); $this->ObTpl->set_var("LANG_VAR_EMPTYBASKCONFIRM", LANG_EMPTYBASKETCONF); #######Country blocks $this->obDb->query = "SELECT iStateId_PK, vStateName FROM " . STATES . " ORDER BY vStateName"; $row_state = $this->obDb->fetchQuery(); $row_state_count = $this->obDb->record_count; $this->obDb->query = "SELECT iCountryId_PK, vCountryName, vShortName FROM " . COUNTRY . " ORDER BY iSortFlag,vCountryName"; $row_country = $this->obDb->fetchQuery(); $row_country_count = $this->obDb->record_count; $productShipCodes = array(); # Loading billing country list for ($i = 0; $i < $row_country_count; $i++) { $this->ObTpl->set_var("k", $row_country[$i]->iCountryId_PK); $this->ObTpl->parse('countryblks', 'countryblk', true); $this->ObTpl->set_var("TPL_COUNTRY_VALUE", $row_country[$i]->iCountryId_PK); //if($row_customer[0]->vCountry> 0) //{ // if($row_customer[0]->vCountry == $row_country[$i]->iCountryId_PK) // $this->ObTpl->set_var("BILL_COUNTRY_SELECT", "selected"); // else // $this->ObTpl->set_var("BILL_COUNTRY_SELECT", ""); //} $this->ObTpl->set_var("TPL_COUNTRY_NAME", $this->libFunc->m_displayContent($row_country[$i]->vCountryName)); $this->ObTpl->parse("nBillCountry", "BillCountry", true); } if (isset($row_customer[0]->vCountry) && $row_customer[0]->vCountry != '') { $this->ObTpl->set_var('selbillcountid', $row_customer[0]->vCountry); } else { $this->ObTpl->set_var('selbillcountid', "1"); } $this->ObTpl->parse("postagestatedropdown_blk", "TPL_VAR_POSTAGESTATEDROPDOWN"); //if((isset($_SESSION['RATESDEFINED'])) && ($_SESSION['RATESDEFINED'] == "NO")){ // $this->ObTpl->set_var("TPL_VAR_MSG","<p class=\"message\">Sorry, you will not be able to checkout.</p>"); //} #To Show Cart images according to admin if (MASTERCARD) { $this->ObTpl->parse("MASTERCARD_BLK", "TPL_MASTERCARD_BLK", true); } else { $this->ObTpl->set_var("MASTERCARD_BLK", ""); } if (VISA) { $this->ObTpl->parse("VISA_BLK", "TPL_VISA_BLK", true); } else { $this->ObTpl->set_var("VISA_BLK", ""); } if (AMEX) { $this->ObTpl->parse("AMEX_BLK", "TPL_AMEX_BLK", true); } else { $this->ObTpl->set_var("AMEX_BLK", ""); } if (DISCOVER) { $this->ObTpl->parse("DISCOVER_BLK", "TPL_DISCOVER_BLK", true); } else { $this->ObTpl->set_var("DISCOVER_BLK", ""); } if (DINERS_CLUB) { $this->ObTpl->parse("DINERS_CLUB_BLK", "TPL_DINERS_CLUB_BLK", true); } else { $this->ObTpl->set_var("DINERS_CLUB_BLK", ""); } if (MAESTRO) { $this->ObTpl->parse("MAESTRO_BLK", "TPL_MAESTRO_BLK", true); } else { $this->ObTpl->set_var("MAESTRO_BLK", ""); } if (SOLO) { $this->ObTpl->parse("SOLO_BLK", "TPL_SOLO_BLK", true); } else { $this->ObTpl->set_var("SOLO_BLK", ""); } if (SWITCHCARD) { $this->ObTpl->parse("SWITCHCARD_BLK", "TPL_SWITCHCARD_BLK", true); } else { $this->ObTpl->set_var("SWITCHCARD_BLK", ""); } #CHECKING WITHOUT BACKORDER ITEMS $this->obDb->query = "SELECT iProdId_FK FROM " . TEMPCART . " AS T "; $this->obDb->query .= " WHERE (vSessionId='" . SESSIONID . "')"; if ($_SESSION['backOrderSeperate'] == 1 && $_SESSION['backOrderProcess'] == 1) { $this->obDb->query .= " AND T.iBackOrder='1'"; } elseif ($_SESSION['backOrderSeperate'] == 1) { $this->obDb->query .= " AND T.iBackOrder<>'1'"; } $rowProductId = $this->obDb->fetchQuery(); $rowIdCount = $this->obDb->record_count; if ($rowIdCount > 0) { for ($j = 0; $j < $rowIdCount; $j++) { #TO CHECK BACK ORDER if (!isset($_SESSION['backorder'][$rowProductId[$j]->iProdId_FK]) || $_SESSION['backorder'][$rowProductId[$j]->iProdId_FK] != 1) { #TO SET THE FLAG WHEATHER GOT SOME PRODUCT WITH NO BACKOREDR $withoutBackorder = 1; } } } if ($rowCartCount > 0) { /* THIS NEED TO CHECK IF DROP SHIP FEATURE IS ENABLE */ # COUNT TOTAL OF SUPPLIER FROM BASKET $id_rows = array(); for ($i = 0; $i < $rowIdCount; $i++) { $id_rows[$i] = $rowProductId[$i]->iProdId_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; $_SESSION['totalVendor'] = $totalVendor; if ($_SESSION['totalVendor'] > 0) { $this->ObTpl->set_var("TPL_VAR_TOTAL_SUPPLIER", $_SESSION['totalVendor']); } else { $this->ObTpl->set_var("TPL_VAR_TOTAL_SUPPLIER", ""); } $novattotal = 0; for ($i = 0; $i < $rowCartCount; $i++) { $this->price = 0; #INTIALIZING $this->total = 0; #FOR POSTAGE-CODES $comFunc->productId = $rowCart[$i]->iProdId_FK; $comFunc->qty = $rowCart[$i]->iQty; $comFunc->price = $this->price; #MARGIN CALCULATOR switch (MARGINSTATUS) { case "increase": $rowCart[$i]->fPrice = $rowCart[$i]->fPrice * MARGINPERCENT / 100 + $rowCart[$i]->fPrice; break; case "decrease": $rowCart[$i]->fPrice = $rowCart[$i]->fPrice - $rowCart[$i]->fPrice * MARGINPERCENT / 100; break; default: $rowCart[$i]->fPrice = $rowCart[$i]->fPrice; break; } #END MARGIN CALCULATOR //--- Switch to retail price if Retail customer if ($comFunc->m_checkCustomerType() == 1 && ENABLE_WHOLESALE == 1 && $rowCart[$i]->fRetailPrice > 0) { $rowCart[$i]->fPrice = $rowCart[$i]->fRetailPrice; } //----End switch price #INTIALIZING $this->ObTpl->set_var("TPL_VAR_SHIPNOTES", ""); $this->ObTpl->set_var("TPL_VAR_CART_VOLDISCOUNT", ""); $this->ObTpl->set_var("TPL_VAR_BACKORDER", ""); $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_VATTAXMSG", ""); $this->ObTpl->set_var("TPL_VAR_FREESHIPMSG", ""); $this->ObTpl->set_var("TPL_VAR_CARTID", $rowCart[$i]->iTmpCartId_PK); $comFunc->cartId = $rowCart[$i]->iTmpCartId_PK; #TO CHECK BACK ORDER if (isset($_SESSION['backorder'][$rowCart[$i]->iProdId_FK]) && $_SESSION['backorder'][$rowCart[$i]->iProdId_FK] == 1) { $strBackOrder = "This item is on backorder"; if ($withoutBackorder == 1) { $strBackOrder .= ": [<a href=" . $this->libFunc->m_safeUrl(SITE_URL . "ecom/index.php?action=ecom.instructions&mode=" . $rowCart[$i]->iTmpCartId_PK) . ">Instructions</a>]"; } if ($rowCart[$i]->iOnorder > 0) { $strBackOrder .= "<br />On Order: " . $rowCart[$i]->iOnorder; } if (!$this->libFunc->m_isNull($rowCart[$i]->tmDuedate)) { $formatedDueDate = $this->libFunc->dateFormat2($rowCart[$i]->tmDuedate); $strBackOrder .= " (Due date: " . $formatedDueDate . ")"; } $this->ObTpl->set_var("TPL_VAR_BACKORDER", $strBackOrder . "</ br>"); } else { $withoutBackorder = 1; } $giftWrapUrl = SITE_URL . "ecom/index.php?action=ecom.giftwrap&mode=" . $rowCart[$i]->iTmpCartId_PK; $this->ObTpl->set_var("TPL_VAR_GIFTWRAPURL", $this->libFunc->m_safeUrl($giftWrapUrl)); ##GIFTWRAP URL $this->ObTpl->set_var("TPL_VAR_GIFTWRAP", ""); $this->ObTpl->set_var("gift_blk", ""); if ($rowCart[$i]->iGiftWrap != 0 && ENABLE_GIFTWRAP == 1) { $this->ObTpl->set_var("TPL_VAR_GIFTWRAP", $comFunc->m_dspGiftWrap($rowCart[$i]->iGiftWrap, $rowCart[$i]->iTmpCartId_PK)); } elseif (ENABLE_GIFTWRAP == 1) { $this->ObTpl->parse("gift_blk", "TPL_GIFTWRAP_BLK"); } if ($rowCart[$i]->iKit == 1) { $this->obDb->query = "SELECT vTitle,iProdId_FK,vSku FROM " . PRODUCTKITS . "," . PRODUCTS . " WHERE iProdId_FK=iProdId_PK AND iKitId='" . $rowCart[$i]->iProdId_FK . "'"; $rsKit = $this->obDb->fetchQuery(); $rsKitCount = $this->obDb->record_count; for ($j = 0; $j < $rsKitCount; $j++) { $comFunc->kitProductId = $rsKit[$j]->iProdId_FK; #GET CART OPTIONS $kitOptions = $comFunc->m_dspCartProductKitOptions(); if ($kitOptions == ' ') { $this->ObTpl->set_var("TPL_VAR_KITOPTIONS", ""); } else { $this->ObTpl->set_var("TPL_VAR_KITOPTIONS", $kitOptions); } $this->ObTpl->set_var("TPL_VAR_KITSKU", $this->libFunc->m_displayContent($rsKit[$j]->vSku)); $this->ObTpl->set_var("TPL_VAR_KITTITLE", $this->libFunc->m_displayContent($rsKit[$j]->vTitle)); $this->ObTpl->parse("kit_blk", "TPL_KIT_BLK", true); } } else { #GET CART OPTIONS $this->ObTpl->set_var("TPL_VAR_OPTIONS", $comFunc->m_dspCartProductOptions()); #GET CART CHOICES $this->ObTpl->set_var("TPL_VAR_CHOICES", $comFunc->m_dspCartProductChoices()); } # (OPTION And choice effected amount) $this->price = $comFunc->price; if (!$this->libFunc->m_isNull($rowCart[$i]->vShipNotes)) { $this->ObTpl->set_var("TPL_VAR_SHIPNOTES", "Notes: " . $this->libFunc->m_displayContent($rowCart[$i]->vShipNotes) . "<br />"); } if ($rowCart[$i]->iFreeShip == 1) { $this->ObTpl->set_var("TPL_VAR_FREESHIPMSG", "<em>" . LBL_FREEPP . "</em><br />"); } if (!empty($rowCart[$i]->vShipCode)) { $productShipCodes[] = $rowCart[$i]->vShipCode; } #VOLUME DISCOUNT #**************************************************************** #DISCOUNT ACCORDING TO QTY $vDiscoutPerItem = number_format($rowCart[$i]->fVolDiscount, 2, '.', ''); $vDiscountPerCartElement = number_format($rowCart[$i]->iQty * $vDiscoutPerItem, 2, '.', ''); if ($vDiscoutPerItem > 0) { $this->ObTpl->set_var("TPL_VAR_CART_VOLDISCOUNT", "Volume Discount: " . CONST_CURRENCY . $vDiscoutPerItem . " each - Total: " . CONST_CURRENCY . $vDiscountPerCartElement . "<br />"); $this->volDiscount = $this->volDiscount + $vDiscountPerCartElement; } #************************************************************** $this->ObTpl->set_var("TPL_VAR_TITLE", $this->libFunc->m_displayContent($rowCart[$i]->vTitle)); $this->ObTpl->set_var("LANG_VAR_VIEWCARTIMAGES", LANG_VIEWCARTIMAGE); //$this->ObTpl->set_var("TPL_VAR_CARTIMAGE",$this->libFunc->m_displayContent($rowCart[$i]->vImage1)); if ($this->libFunc->m_displayContent($rowCart[$i]->vImage1) != "") { $this->ObTpl->set_var("TPL_VAR_CARTIMAGE_TAG", "<img src=\"" . SITE_URL . "libs/timthumb.php?src=/images/product/" . $this->libFunc->m_displayContent($rowCart[$i]->vImage1) . "&h=70&w=70&zc=r\" alt=\"" . $this->libFunc->m_displayContent($rowCart[$i]->vTitle) . "\" />"); } else { $this->ObTpl->set_var("TPL_VAR_CARTIMAGE_TAG", "No image available"); } $strTitle = $this->libFunc->m_displayContent($rowCart[$i]->vTitle); $strTitle = str_replace("'", "\\'", $strTitle); $this->ObTpl->set_var("TPL_VAR_TITLE1", $strTitle); $this->ObTpl->set_var("TPL_VAR_SKU", $this->libFunc->m_displayContent($rowCart[$i]->vSku)); $this->price = $this->price + $rowCart[$i]->fPrice; $fullprice = $this->price; #locloc if ($rowCart[$i]->iTaxable == 1) { $this->taxTotal += $rowCart[$i]->iQty * $this->price; } else { $novattotal = $novattotal + $rowCart[$i]->fPrice * $rowCart[$i]->iQty; } #locloc $this->ObTpl->set_var("TPL_VAR_PRICE", number_format($this->price, 2, '.', '')); $this->ObTpl->set_var("TPL_VAR_QTY", $rowCart[$i]->iQty); $this->totalQty += $rowCart[$i]->iQty; $this->total += $rowCart[$i]->iQty * $this->price; $this->ObTpl->set_var("TPL_VAR_TOTAL", number_format($this->total, 2, '.', '')); if ($rowCart[$i]->iTaxable == 0 && HIDENOVAT != 1) { $this->ObTpl->set_var("TPL_VAR_VATTAXMSG", "<em>" . LBL_NOTAX . "</em><br />"); } else { $this->ObTpl->set_var("TPL_VAR_VATTAXMSG", ""); } if ($rowCart[$i]->iFreeShip != 1) { $this->postageTotal += $this->total; } else { $this->postageQty += $rowCart[$i]->iQty; } $this->subTotal = $this->subTotal + $this->total; //Quantity Multiplied if ($rowCart[$i]->fItemWeight > 0) { $this->cartWeight += $rowCart[$i]->fItemWeight * $rowCart[$i]->iQty; } $_SESSION['cartweight'] = $this->cartWeight; // for shipping estimate #SAFE URLS $removeUrl = SITE_URL . "ecom/index.php?action=ecom.remove&mode=" . $rowCart[$i]->iTmpCartId_PK; $this->ObTpl->set_var("TPL_VAR_REMOVEURL", $this->libFunc->m_safeUrl($removeUrl)); $cartUpdateUrl = SITE_URL . "ecom/index.php?action=ecom.updateCart"; $this->ObTpl->set_var("TPL_VAR_UPDATEURL", $this->libFunc->m_safeUrl($cartUpdateUrl)); $productUrl = SITE_URL . "ecom/index.php?action=ecom.pdetails&mode=" . $rowCart[$i]->vSeoTitle; $this->ObTpl->set_var("TPL_VAR_PRODUCTURL", $this->libFunc->m_safeUrl($productUrl)); $this->ObTpl->parse("cartproduct_blk", "TPL_VAR_CARTPRODUCTS", true); } #**********************END PRODUCT DISPLAY********************** $this->ObTpl->set_var("TPL_VAR_NOVATTOTAL", $novattotal); #*********Start: Check if shipping estimates dropdown required.***************** if (DEFAULT_POSTAGE_METHOD == 'regions') { $this->ObTpl->parse("postagedropdown_blk", "TPL_VAR_POSTAGEDROPDOWN"); } #*********End: Check if shipping estimates dropdown required.***************** #******************TO CHECK MEMBER POINT ENABLE****************** if (OFFERMPOINT == 1) { $this->memPoints = MPOINTCALCULATION * $this->subTotal; $this->ObTpl->set_var("TPL_VAR_MPOINTS", floor($this->memPoints)); if (isset($_SESSION['userid']) && $_SESSION['userid'] != 0) { $this->obDb->query = "SELECT fMemberPoints FROM " . CUSTOMERS . " WHERE iCustmerid_PK ='" . $_SESSION['userid'] . "'"; $row_customer = $this->obDb->fetchQuery(); $recordCount = $this->obDb->record_count; if ($recordCount == 1) { $mpoints = $row_customer[0]->fMemberPoints; $mptext = "You have " . $mpoints . " " . LANG_REWARDPOINTS . " saved up. Check to use them. <input type=\"checkbox\" onclick=\"updateMemPoints()\" value=\"yes\" id=\"memptsbox\" name=\"member_points\"/>"; $this->ObTpl->set_var("TPL_VAR_LOGSTATUS", "1"); } } else { $mpoints = 0; $mptext = " Login to see how many " . LANG_REWARDPOINTS . " you have and the option to use them."; $this->ObTpl->set_var("TPL_VAR_LOGSTATUS", "0"); } //<p class=\"note\"><input type=\"checkbox\" value=\"1\" name=\"member_points\"/></p> $this->ObTpl->set_var("TPL_VAR_MPOINTSR", "<span class=\"mpoints\">" . $mptext . "</span>"); if ($_SESSION['useMemberPoints'] == 'yes') { $this->ObTpl->set_var("TPL_VAR_SCRIPTMEMB", "<script type=\"text/javascript\">document.getElementById('memptsbox').checked=true;</script>"); } $this->ObTpl->parse("memberpoint_blk", "TPL_MPOINTS_BLK"); } else { $this->ObTpl->set_var("TPL_VAR_MPOINTSR", ""); $this->ObTpl->set_var("TPL_VAR_LOGSTATUS", "0"); $this->ObTpl->parse("memberpoint_blk", ""); } #**************************SUB TOTAL HERE********** $this->ObTpl->set_var("TPL_VAR_SUBTOTAL", number_format($this->subTotal, 2, '.', '')); $_SESSION['subtotal'] = $this->subTotal; $this->grandTotal = $this->subTotal; $_SESSION['grandsubTotal'] = number_format($this->grandTotal, 2, '.', ''); #************************* PROMOTION DISCOUNTS********* $this->promotionDiscount = $comFunc->m_calculatePromotionDiscount($this->subTotal); if ($this->promotionDiscount >= 0) { // Fix tev6.2: Vat charged must be subtotal subtracted from calculated discount. if ($this->promotionDiscount > 0) { $this->taxTotal = $this->taxTotal - $this->promotionDiscount; } if ($this->promotionDiscount == 0) { $displayDiscount = 'No Charge'; } else { $displayDiscount = "-" . CONST_CURRENCY . number_format($this->promotionDiscount, 2, '.', ''); } if (isset($comFunc->PromotionDesc) && !$this->libFunc->m_isNull($comFunc->PromotionDesc)) { $this->ObTpl->set_var("TPL_VAR_PROMOTIONDESC", $comFunc->PromotionDesc); } else { $this->ObTpl->set_var("TPL_VAR_PROMOTIONDESC", "Promotion Discount"); } $this->ObTpl->set_var("TPL_VAR_PDISCOUNTS", $displayDiscount); $_SESSION['promotionDiscountPrice'] = $this->promotionDiscount; $this->grandTotal -= $this->promotionDiscount; $this->ObTpl->parse("discounts_blk", "TPL_DISCOUNTS_BLK"); } else { $_SESSION['promotionDiscountPrice'] = 0; } #VOLUME DISCOUNTS if ($this->volDiscount > 0) { $this->ObTpl->set_var("TPL_VAR_VOLDISCOUNT", number_format($this->volDiscount, 2, '.', '')); $this->grandTotal -= $this->volDiscount; $this->postageTotal -= $this->volDiscount; $this->taxTotal = $this->taxTotal - $this->volDiscount; //Recalculate VAT total based on grant total after discount. $this->ObTpl->parse("volDiscounts_blk", "TPL_VOLDISCOUNTS_BLK"); } $this->ObTpl->set_var("LANG_VAR_DISCCODETXT", LANG_DISCOUNTCODETEXT); $this->ObTpl->set_var("LANG_VAR_DISCCERTTXT", LANG_DISCOUNTCERTTEXT); #DISCOUNT CODE DISCOUNTS if (isset($_SESSION['discountPrice'])) { $this->discountPrice = $_SESSION['discountPrice']; } if (isset($this->discountPrice) && $this->discountPrice != 0) { $this->minAmount = $_SESSION['discountMini']; $this->offertype = $_SESSION['discountType']; if ($this->grandTotal > $this->minAmount) { if ($this->offertype == "percent") { $discountedPrice = round($this->discountPrice * ($this->grandTotal / 100), 2); } elseif ($this->offertype == "fix") { if ($this->discountPrice > $this->grandTotal) { $this->discountPrice = $this->grandTotal; } $discountedPrice = round($this->discountPrice, 2); } $this->ObTpl->set_var("TPL_VAR_DISCOUNTCODE", "(" . $_SESSION['discountCode'] . ")"); $this->ObTpl->set_var("TPL_VAR_DISCOUNTPRICE", number_format($discountedPrice, 2, '.', '')); if ($this->taxTotal > 0) { $this->taxTotal -= $discountedPrice; $this->grandTotal -= $discountedPrice; } else { $this->grandTotal -= $discountedPrice; //No VAT on order so do not adjust the VAT } //$_SESSION['discountPrice']=$discountedPrice; $this->ObTpl->parse("discount_blk", "TPL_DISCOUNT_BLK"); } else { $this->ObTpl->set_var("TPL_VAR_DISCOUNTCODE", "(" . $_SESSION['discountCode'] . ") Discount minimum is not reached "); $this->ObTpl->set_var("TPL_VAR_DISCOUNTPRICE", "0.00"); $this->ObTpl->parse("discount_blk", "TPL_DISCOUNT_BLK"); } } elseif ($this->libFunc->ifSet($_SESSION, 'discountCode', '0') && $_SESSION['discountCode'] != 'discount code') { $this->ObTpl->set_var("TPL_VAR_DISCOUNTCODE", "(" . $_SESSION['discountCode'] . ") not found"); $this->ObTpl->set_var("TPL_VAR_DISCOUNTPRICE", "0.00"); $this->ObTpl->parse("discount_blk", "TPL_DISCOUNT_BLK"); } #GIFT CERTIFICATE DISCOUNTS if (isset($_SESSION['giftCertPrice']) && isset($_SESSION['giftCertCode'])) { $this->giftCertPrice = $_SESSION['giftCertPrice']; } if (isset($this->giftCertPrice) && $this->giftCertPrice != 0) { if ($this->grandTotal < $this->giftCertPrice) { $this->giftCertPrice = $this->grandTotal; } if ($this->grandTotal <= 0) { $this->giftCertPrice = 0; $this->grandTotal = 0; } $this->taxTotal -= $this->giftCertPrice; $this->grandTotal -= $this->giftCertPrice; $_SESSION['giftCertPrice'] = $this->giftCertPrice; $this->ObTpl->set_var("TPL_VAR_GIFTCODE", "(" . $_SESSION['giftCertCode'] . ")"); $this->ObTpl->set_var("TPL_VAR_GIFTCERTPRICE", number_format($this->giftCertPrice, 2, '.', '')); $this->ObTpl->parse("giftcert_blk", "TPL_GIFTCERT_BLK"); } elseif (isset($_SESSION['giftCertCode']) && !empty($_SESSION['giftCertCode']) && $_SESSION['giftCertCode'] != 'gift certificate number') { $this->ObTpl->set_var("TPL_VAR_GIFTCODE", "(" . $_SESSION['giftCertCode'] . ") not found"); $this->ObTpl->set_var("TPL_VAR_GIFTCERTPRICE", "0.00"); $this->ObTpl->parse("giftcert_blk", "TPL_GIFTCERT_BLK"); } #ASSIGNING PRICE ,QTY FOR METHODS TO CALULATE ON TOTAL PRICE $comFunc->grandTotal = $this->postageTotal; $comFunc->totalQty = $this->totalQty; #POSTAGE VALUE IN SESSION $this->postagePrice = $comFunc->caclulatePostage(DEFAULT_POSTAGE_COUNTRY, DEFAULT_POSTAGE_STATE, 0, $this->grandTotal, $this->totalQty, $this->cartWeight, 0, $productShipCodes); $_SESSION['product_codes'] = $productShipCodes; $_SESSION['defPostageMethod'] = DEFAULT_POSTAGE_NAME; $_SESSION['defPostagePrice'] = $this->postagePrice; $this->ObTpl->set_var("TPL_VAR_POSTAGENAME", DEFAULT_POSTAGE_NAME); $this->ObTpl->set_var("TPL_VAR_POSTAGE", number_format($this->postagePrice, 2, '.', '')); $this->grandTotal += $this->postagePrice; $this->ObTpl->parse("postage_blk", "TPL_POSTAGE_BLK"); $_SESSION['taxable_total'] = $this->taxTotal; $temp = $comFunc->m_Calculate_Tax($this->taxTotal, $this->postagePrice, 0, 0); $this->vatTotal = $temp[0]; $_SESSION['vatrate'] = $temp[1]; $this->ObTpl->set_var("TPL_VAR_VAT", $temp[1]); if ($this->vatTotal > 0) { $this->ObTpl->set_var("TPL_VAR_VATPRICE", number_format($this->vatTotal, 2, '.', '')); $this->grandTotal += $this->vatTotal; $this->ObTpl->parse("vat_blk", "TPL_VAT_BLK"); } $_SESSION['totalQty'] = $this->totalQty; $_SESSION['grandTotal'] = number_format($this->grandTotal, 2, '.', ''); $this->ObTpl->set_var("TPL_VAR_CURRENTTOTAL", number_format($this->grandTotal, 2, '.', '')); //Checking for minimum order total if (MINORDERTOTAL > 0) { if (number_format($this->grandTotal, 2, '.', '') > MINORDERTOTAL) { $this->ObTpl->parse("startCheckout_blk", "TPL_STARTCHECKOUT_BLK"); } else { $this->ObTpl->set_var("TPL_VAR_MSG", "<p class=\"message\">Your order total does not meet the minimum order total of " . CONST_CURRENCY . MINORDERTOTAL . " </p>"); } } else { $this->ObTpl->parse("startCheckout_blk", "TPL_STARTCHECKOUT_BLK"); } # DISPLAY THE NOTICE BOX FOR REFUND if (isset($_SESSION['INVOICE_EDITING']) && $_SESSION['INVOICE_EDITING'] != "") { $this->ObTpl->parse("return_blk", "TPL_REFUND_BLK"); } $this->ObTpl->parse("cart_blk", "TPL_CART_BLK"); } else { $_SESSION['totalQty'] = 0; $_SESSION['grandTotal'] = number_format(0, 2, '.', ''); $returnUrl = SITE_URL; $this->ObTpl->set_var("TPL_VAR_MSG", MSG_CART_EMPTY . " <a href='" . $this->libFunc->m_safeUrl($returnUrl) . "'>" . MSG_RETURN . "</a>"); } if ($this->checkout == 1) { $retUrl = $this->libFunc->m_safeUrl(SITE_SAFEURL . "ecom/index.php?action=checkout.billing"); $this->libFunc->m_mosRedirect($retUrl); exit; } // Select postage start $this->ObTpl->set_var("TPL_VAR_DEFAULT_POSTAGEMETHOD", $_SESSION['defPostageMethod']); $this->ObTpl->set_var("TPL_VAR_DEFAULT_POSTAGEPRICE", number_format($_SESSION['defPostagePrice'], 2)); //-- if (DEFAULT_POSTAGE_METHOD == 'zones') { $postagePrice = $_SESSION['defPostagePrice']; $this->ObTpl->set_var("TPL_VAR_DISPLAYPRICE", number_format($postagePrice, 2)); $this->ObTpl->set_var("TPL_VAR_POSTAGEMETHOD", "Special Delivery"); $this->ObTpl->set_var("TPL_VAR_DEFAULT_POSTAGEMETHOD", $_SESSION['defPostageMethod']); $this->ObTpl->set_var("TPL_VAR_DEFAULT_POSTAGEPRICE", $postagePrice); $this->ObTpl->set_var("TPL_VAR_METHODID", "1"); $this->ObTpl->set_var("TPL_VAR_POSTAGEPRICE", $postagePrice); $this->ObTpl->parse("postageoptions_blk", "TPL_POSTAGEOPTIONS_BLK"); $this->ObTpl->set_var("TPL_VAR_METHODID", "2"); $this->ObTpl->set_var("TPL_VAR_POSTAGEPRICE", number_format($postagePrice, 2)); $this->ObTpl->parse("postageoptions_blk", "TPL_POSTAGEOPTIONS_BLK"); $this->ObTpl->parse("default_postage_blk", "TPL_DEFAULTPOSTAGE_BLK"); //$this->ObTpl->parse("special_postage_blk","TPL_SPECIALPOSTAGE_BLK"); $this->ObTpl->parse("specialrate_blk", "TPL_SPECIALRATE_BLK", true); } elseif (DEFAULT_POSTAGE_METHOD == 'cities') { $postagePrice = $_SESSION['defPostagePrice']; $this->ObTpl->set_var("TPL_VAR_DISPLAYPRICE", number_format($postagePrice, 2)); $this->ObTpl->set_var("TPL_VAR_POSTAGEMETHOD", "Special Delivery"); $this->ObTpl->set_var("TPL_VAR_DEFAULT_POSTAGEMETHOD", $_SESSION['defPostageMethod']); $this->ObTpl->set_var("TPL_VAR_DEFAULT_POSTAGEPRICE", $postagePrice); $this->ObTpl->set_var("TPL_VAR_METHODID", "1"); $this->ObTpl->set_var("TPL_VAR_POSTAGEPRICE", $postagePrice); $this->ObTpl->parse("postageoptions_blk", "TPL_POSTAGEOPTIONS_BLK"); $this->ObTpl->set_var("TPL_VAR_METHODID", "2"); $this->ObTpl->set_var("TPL_VAR_POSTAGEPRICE", number_format($postagePrice, 2)); $this->ObTpl->parse("postageoptions_blk", "TPL_POSTAGEOPTIONS_BLK"); $this->ObTpl->parse("default_postage_blk", "TPL_DEFAULTPOSTAGE_BLK"); //$this->ObTpl->parse("special_postage_blk","TPL_SPECIALPOSTAGE_BLK"); $this->ObTpl->parse("specialrate_blk", "TPL_SPECIALRATE_BLK", true); } //-- #IF SPECIAL POSTAGE IS NOT ENABLED THE DEFAULT POSTAGE OPTION WILL BE DISPLAYED #OTHERWISE DEFAULT RATES WILL BE ADDED TO SPECIAL if (!SPECIAL_POSTAGE) { $this->ObTpl->parse("default_postage_blk", "TPL_DEFAULTPOSTAGE_BLK"); } else { $this->ObTpl->parse("default_postage_blk", "TPL_DEFAULTPOSTAGE_BLK"); $this->ObTpl->parse("special_postage_blk", "TPL_SPECIALPOSTAGE_BLK"); } $this->obDb->query = "SELECT vField1,vField2,iPostDescId_PK,PD.vDescription FROM " . POSTAGE . " P," . POSTAGEDETAILS . " PD WHERE iPostId_PK=iPostId_FK AND vKey='special' AND iStatus='1'"; $rsPostage = $this->obDb->fetchQuery(); $rsCount = $this->obDb->record_count; if ($rsCount > 0 && SPECIAL_POSTAGE) { for ($j = 0; $j < $rsCount; $j++) { $this->ObTpl->set_var("TPL_VAR_METHODID", $rsPostage[$j]->iPostDescId_PK); $this->ObTpl->set_var("TPL_VAR_POSTAGEMETHOD", $rsPostage[$j]->vDescription); #REASON FOR SUBTRACT 1 is additional after first $addtional = $_SESSION['totalQty'] - 1; if ($addtional > 0) { $postagePrice = $rsPostage[$j]->vField1 + $rsPostage[$j]->vField2 * $addtional; } else { $postagePrice = $rsPostage[$j]->vField1; } $this->ObTpl->set_var("TPL_VAR_DISPLAYPRICE", number_format($postagePrice, 2)); if (SPECIAL_POSTAGE) { $this->ObTpl->set_var("TPL_VAR_SPECIAL_POSTAGEPRICE", $rsPostage[$j]->vField2); $postagePrice = $postagePrice + $_SESSION['defPostagePrice']; } $this->ObTpl->set_var("TPL_VAR_POSTAGEPRICE", $postagePrice); $this->ObTpl->parse("postageoptions_blk", "TPL_POSTAGEOPTIONS_BLK", true); } } else { if ($_SESSION['zoneSpecialDelivery'] == 0 || !SPECIAL_POSTAGE) { $_SESSION['postageId'] = '0'; $_SESSION['postageMethod'] = $_SESSION['defPostageMethod']; $_SESSION['postagePrice'] = $_SESSION['defPostagePrice']; $this->ObTpl->set_var("postage_blk", ""); } } $this->ObTpl->parse("specialrate_blk", "TPL_SPECIALRATE_BLK"); // End Select postage return $this->ObTpl->parse("return", "TPL_DETAILS_FILE"); }
function m_updateCart($checkout = '0') { $comFunc = new c_commonFunctions(); $comFunc->obDb = $this->obDb; $libFunc = new c_libFunctions(); $totalQty = 0; $cntItems = count($this->request['cartid']); #TOTAL ITEMS IN CART for ($i = 0; $i < $cntItems; $i++) { $update = 1; if (!isset($this->request['qty'][$i]) || empty($this->request['qty'][$i]) || !is_numeric($this->request['qty'][$i]) || $this->request['qty'][$i] < 1) { $this->request['qty'][$i] = 1; } $iTmpCartId = $this->request['cartid'][$i]; $iQty = $this->request['qty'][$i]; $iProdId = $this->m_getProductId($iTmpCartId); $comFunc->productId = $iProdId; $this->m_getTotalQty($iProdId); #Total of product quantity except the the current item;s quantity. $this->m_getTotalQty($iProdId, 1, $iTmpCartId); $_SESSION['backorder'][$iProdId] = 0; #MAIN STOCK CHECK -SETTINGS FROM FEATURES if (STOCK_CHECK == 1) { #TO CHECK STOCK CONTROL ENABLED FOR PRODUCT if ($this->iUseinventory == 1 && !$this->is_options($iProdId)) { $qtyAvailable = $this->iInventory - $this->totalQtyInTemp; if ($qtyAvailable < $this->request['qty'][$i]) { if ($this->iBackorder == 1) { $_SESSION['backorder'][$iProdId] = 1; } else { $this->request['qty'][$i] = $qtyAvailable; $this->errMsg .= "<li>" . $this->libFunc->m_displayContent($this->vTitle) . "</li>"; $update = 0; } } #quantity check $displayOptChoice = 1; } #end inventory check $displayOptChoice = 1; #QUANTITY CHECK ON OPTIONS foreach ($_POST as $field => $fieldValue) { $fArray = explode('_', $field); $cnt = count($fArray); if ($cnt == 2) { $fieldId = $fArray[1]; #GET OPTION ID } elseif ($cnt == 3) { $fieldId = $fArray[2]; #GET OPTION ID $prodId = $fArray[1]; #GET PROD } #$iProdId product id according to cartid #$prodId product id according to options/choice if ($fArray[0] == 'option') { if ($iProdId == $prodId) { $qtyAvailable = $this->m_getOptionQty($prodId, $fieldValue, $iTmpCartId); #TO CHECK STOCK CONTROL ENABLED if ($this->iUseinventory == 1) { if ($qtyAvailable < $this->request['qty'][$i] - $this->carttotalqty) { if ($this->iBackorder == 1) { $_SESSION['backorder'][$iProdId] = 1; } else { $this->request['qty'][$i] = $qtyAvailable; $this->errMsg .= "<li>" . $this->libFunc->m_displayContent($this->vTitle) . " - option(" . $this->libFunc->m_displayContent($this->vOptTitle) . ")</li>"; $update = 0; } } } } } /* if($fArray[0]=='choice' && !empty($fieldValue)) { if($iProdId==$prodId) { $qtyAvailable=$this->m_getChoiceQty($prodId,$fieldId); #TO CHECK STOCK CONTROL ENABLED if($this->iUseinventory==1) { if($qtyAvailable<$this->request['qty'][$i]) { if($this->iBackorder==1) { $_SESSION['backorder'][$iProdId]=1; } else { $this->request['qty'][$i]=$qtyAvailable; $this->errMsg.="<li>".$this->vTitle." - choice(".$this->vOptTitle.")</li>"; $update=0; } } } } }*/ } } #end main stock check $totalQty += $this->request['qty'][$i]; if ($this->request['qty'][$i] < 1) { $this->request['qty'][$i] = 1; } if ($update == 1) { $vDiscoutPerItem = $comFunc->m_dspCartProductVolDiscount($this->request['qty'][$i]); $this->obDb->query = "UPDATE " . TEMPCART . " SET iQty='" . $this->request['qty'][$i] . "',"; $this->obDb->query .= "fVolDiscount='" . $vDiscoutPerItem . "'"; $this->obDb->query .= " WHERE (iTmpCartId_PK='" . $this->request['cartid'][$i] . "')"; $this->obDb->updateQuery(); } } $_SESSION['totalQty'] = $totalQty; if (!empty($this->errMsg)) { return false; } if ($checkout == 1) { $this->Interface->checkout = 1; $this->Interface->template = $this->templatePath . "viewcart.tpl.htm"; $this->Interface->m_viewCart(); exit; } else { $retUrl = $this->libFunc->m_safeUrl(SITE_URL . "ecom/index.php?action=ecom.viewcart"); $this->libFunc->m_mosRedirect($retUrl); exit; } }
$rscount = $obDatabase->record_count; if ($rscount < 1) { $comFunc = new c_commonFunctions(); $comFunc->obDb = $obDatabase; $comFunc->request['mode'] = 'product'; $obMainTemplate->set_var("TPL_VAR_BODY", $comFunc->m_dspError()); $obMainTemplate->set_var("TPL_VAR_BREDCRUMBS", " » Error"); $notFoundErrorFlag = 1; header("HTTP/1.0 404 Not Found"); } } elseif (isset($_REQUEST['action']) && $_REQUEST['action'] == 'ecom.cdetails') { $obDatabase->query = "SELECT vTitle,vMetaTitle,tMetaDescription,tKeywords,vLayout FROM " . CONTENTS . "," . FUSIONS . " WHERE iSubId_FK=iContentid_PK AND iState=1 AND vSeoTitle='" . $_REQUEST['mode'] . "'"; $rs = $obDatabase->fetchQuery(); $rscount = $obDatabase->record_count; if ($rscount < 1) { $comFunc = new c_commonFunctions(); $comFunc->obDb = $obDatabase; $comFunc->request['mode'] = 'content'; $obMainTemplate->set_var("TPL_VAR_BODY", $comFunc->m_dspError()); $obMainTemplate->set_var("TPL_VAR_BREDCRUMBS", " » Error"); $notFoundErrorFlag = 1; header("HTTP/1.0 404 Not Found"); } } if ($notFoundErrorFlag !== 1) { global $sModule; switch ($sModule) { case "ecom": $obEcomAdmin = new c_ecomController($obDatabase, $obMainTemplate, $attributes); break; case "user":