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_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"); }