public function HandlePage() { $action = @$_REQUEST['action']; switch ($action) { case "post_review": //zcs=>only login customer can access "Product Reviews" if (!CustomerIsSignedIn()) { echo '<script language="javascript">alert("Sorry! You may login to access in.");location.href="' . $GLOBALS['ShopPath'] . '";</script>'; exit(0); } //<=zcs $this->PostReview(); break; case 'review_helpful': $this->ReviewHelpful(); break; case 'view': $this->view(); break; default: // Abandon ship! ob_end_clean(); header("Location:" . $GLOBALS['ShopPath']); die; } }
public function HandlePage() { $action = ""; if ($GLOBALS['EnableSEOUrls'] == 1 and count($GLOBALS['PathInfo']) > 0) { if (isset($GLOBALS['PathInfo'][1])) { $_REQUEST['action'] = $GLOBALS['PathInfo'][1]; } else { $_REQUEST['action'] = $GLOBALS['PathInfo'][0]; } } if (isset($_REQUEST['action'])) { $action = isc_strtolower($_REQUEST['action']); } // Don't allow any access to this file if gift certificates aren't enabled if (GetConfig('EnableGiftCertificates') == 0) { ob_end_clean(); header("Location: " . $GLOBALS['ShopPath']); die; } if (!gzte11(ISC_LARGEPRINT)) { ob_end_clean(); header("Location: " . $GLOBALS['ShopPath']); die; } switch ($action) { case "saved": $this->SaveDefectForm(); break; case "reports": if (CustomerIsSignedIn()) { $this->ListReports(); break; } else { // Naughty naughty, you need to sign in to be here $this_page = urlencode(sprintf("account.php?action=%s", $action)); ob_end_clean(); header(sprintf("Location: %s/login.php?from=%s", $GLOBALS['ShopPath'], $this_page)); die; } case "editdefect": if (CustomerIsSignedIn()) { $this->EditDefectForm(); break; } else { // Naughty naughty, you need to sign in to be here $this_page = urlencode(sprintf("account.php?action=%s", $action)); ob_end_clean(); header(sprintf("Location: %s/login.php?from=%s", $GLOBALS['ShopPath'], $this_page)); die; } case "editsave": $this->SaveEditedDefect(); case "deletedefect": $this->DeleteDefect(); default: $this->DisplayReport(); } }
function LoadCustomerWishLists() { $wishLists = array(); if (CustomerIsSignedIn()) { $GLOBALS['ISC_CLASS_CUSTOMER'] = GetClass('ISC_CUSTOMER'); $customer_id = $GLOBALS['ISC_CLASS_CUSTOMER']->GetCustomerId(); // get customer's wish list from database $query = "SELECT * FROM [|PREFIX|]wishlists WHERE customerid = " . $customer_id; $result = $GLOBALS['ISC_CLASS_DB']->Query($query); while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) { $wishLists[] = $row; } } return $wishLists; }
public function __construct() { //zcs=>must sign in if (!CustomerIsSignedIn()) { $this_page = ''; if ($GLOBALS['EnableSEOUrls'] == 1) { $this_page = sprintf("%s/%s/%s", GetConfig('ShopPathNormal'), "login", "account"); } else { $this_page = sprintf("%s/login.php", $GLOBALS['ShopPath']); } echo "<script language=\"javascript\">alert('Sorry, you need to sign in!'); window.opener.location='{$this_page}'; window.close();</script>"; exit; } //<=zcs }
public function isTrue() { if (!CustomerIsSignedIn()) { return null; } $GLOBALS['ISC_CLASS_CART'] = GetClass('ISC_CART'); $custID = $GLOBALS['ISC_CLASS_CUSTOMER']->GetCustomerId(); $query = "SELECT count(*)\n\t\t\t\tFROM [|PREFIX|]orders\n\t\t\t\tWHERE ordcustid = '{$custID}'\n\t\t"; $result = $GLOBALS['ISC_CLASS_DB']->Query($query); $count = $GLOBALS['ISC_CLASS_DB']->Fetch($result); if ($count['count(*)'] > $this->orders) { $GLOBALS['ISC_CLASS_CART']->api->SetArrayPush('DISCOUNT_MESSAGES', sprintf(GetLang($this->getName() . 'DiscountMessage'), $this->amount)); $this->subtotal = $this->amount; return true; } return false; }
public function SetPanelSettings() { // Are gift certificates enabled? If so, we need to show the gift certificates link if(gzte11(ISC_LARGEPRINT) && GetConfig('EnableGiftCertificates') != 0) { $GLOBALS['SNIPPETS']['TopMenuGiftCertificates'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("TopMenuGiftCertificates"); } // Show the login/logout link as required $GLOBALS['HideLogoutLink'] = 'display: none'; if(!isset($GLOBALS['LoginOrLogoutText'])) { if(CustomerIsSignedIn()) { // If they're a customer, set their name so it's available in the templates $c = GetClass('ISC_CUSTOMER'); $customerData = $c->GetCustomerDataByToken(); $GLOBALS['CurrentCustomerFirstName'] = isc_html_escape($customerData['custconfirstname']); $GLOBALS['CurrentCustomerLastName'] = isc_html_escape($customerData['custconlastname']); $GLOBALS['CurrentCustomerEmail'] = isc_html_escape($customerData['custconemail']); $GLOBALS['LoginOrLogoutLink'] = "login.php?action=logout"; $GLOBALS['LoginOrLogoutText'] = sprintf(GetLang('LogoutLink'), $GLOBALS['ShopPathNormal']); $GLOBALS['HideLogoutLink'] = ''; } else { $loginLinkFunction = ''; $createAccountLinkFunction = ''; $GLOBALS['OptimizerLinkScript'] = $this -> insertOptimizerLinkScript(); if($GLOBALS['OptimizerLinkScript'] != '') { $loginLinkFunction = "gwoTracker._link(\"".$GLOBALS['ShopPathSSL']."/login.php?tk=".session_id()."\"); return false;"; $createAccountLinkFunction = "gwoTracker._link(\"".$GLOBALS['ShopPathSSL']."/login.php?action=create_account&tk=".session_id()."\"); return false;"; } // If they're a guest, set their name to 'Guest' $GLOBALS['CurrentCustomerFirstName'] = GetLang('Guest'); $GLOBALS['CurrentCustomerLastName'] = $GLOBALS['CurrentCustomerEmail'] = ''; $GLOBALS['LoginOrLogoutLink'] = "login.php"; $GLOBALS['LoginOrLogoutText'] = sprintf(GetLang('SignInOrCreateAccount'), $GLOBALS['ShopPath'], $loginLinkFunction, $GLOBALS['ShopPath'], $createAccountLinkFunction); } } // Display our currency flags. Has been disabled for the time being. Theory being that this will include the whole locale (text aswell) $GLOBALS['CurrencyFlags'] = ""; }
public function HandlePage() { $action = ""; if (count($GLOBALS['PathInfo']) > 0) { if (isset($GLOBALS['PathInfo'][1])) { $_REQUEST['action'] = $GLOBALS['PathInfo'][1]; } else { $_REQUEST['action'] = $GLOBALS['PathInfo'][0]; } } if (isset($_REQUEST['action'])) { $action = isc_strtolower($_REQUEST['action']); } if (isset($_GET['from'])) { $_SESSION['LOGIN_REDIR'] = sprintf("%s/%s", $GLOBALS['ShopPath'], urldecode($_GET['from'])); } /* Baskarn */ if ($GLOBALS['EnableSEOUrls'] == 1) { $GLOBALS['WishListAccountLink'] = "%%GLOBAL_ShopPathSSL%%/account"; $GLOBALS['WishListLink'] = "%%GLOBAL_ShopPathSSL%%/wishlist"; } else { $GLOBALS['WishListAccountLink'] = "%%GLOBAL_ShopPathSSL%%/account.php"; $GLOBALS['WishListLink'] = "%%GLOBAL_ShopPathSSL%%/wishlist.php"; } if ($GLOBALS['EnableSEOUrls'] == 1) { if (count($GLOBALS['PathInfo']) == 3) { $_GET[$GLOBALS['PathInfo'][1]] = $GLOBALS['PathInfo'][2]; if (isset($_GET['publicwishlist'])) { $this->DisplayPublicWishList(); return true; } } } else { if (isset($_GET['publicwishlist'])) { $this->DisplayPublicWishList(); return true; } } /**/ // Are they signed in? if (CustomerIsSignedIn()) { CheckReferrer(); // checking and assigning the back to search link switch ($action) { case "add": $this->AddItemToWishList(); break; case "remove": $this->RemoveItemFromWishList(); break; case "viewwishlistitems": $this->DisplayWishListItems(); break; case "editwishlist": $this->DisplayEditWishListForm(); break; case "deletewishlist": $this->DeleteWishLists(); break; case "addwishlist": $this->DisplayAddWishListForm(); break; case "sharewishlist": $this->DisplayShareWishList(); break; default: $this->MyWishLists(); } } else { // Naughty naughty, you need to sign in to be here if (isset($_SERVER['QUERY_STRING'])) { $get_vars = $_SERVER['QUERY_STRING']; } else { $get_vars = ""; } $this_page = urlencode(sprintf("wishlist.php?%s", $get_vars)); ob_end_clean(); if ($GLOBALS['EnableSEOUrls'] == 1) { header(sprintf("Location:%s/%s/%s", GetConfig('ShopPathNormal'), "login", "wishlist")); } else { header(sprintf("Location: %s/login.php?from=%s", $GLOBALS['ShopPath'], $this_page)); } //header(sprintf("Location: %s/login.php?from=%s", $GLOBALS['ShopPath'], $this_page)); die; } }
/** * get the shipping and payment information that customer selected from paypal * and redirect customer to choose a shipping provider page * */ private function GetExpressCheckoutDetails() { $merchant = $this->GetMerchantSettings(); if($merchant['testmode'] == 'YES') { $transactionURL = $this->_testTransactionURL; $transactionURI = $this->_testTransactionURI; } else { $transactionURL = $this->_liveTransactionURL; $transactionURI = $this->_liveTransactionURI; } $pp_array = array( 'USER' => $merchant['userid'], 'PWD' => $merchant['password'], 'VENDOR' => $merchant['vendorid'], 'PARTNER' => $merchant['partnerid'], 'ACTION' => 'G', 'TENDER' => 'P', 'TRXTYPE' => $merchant['transactionType'], 'TOKEN' => $_REQUEST['token'], 'NOTIFYURL' => $GLOBALS['ShopPath'].'/checkout.php?action=gateway_ping&provider='.$this->GetId(), ); $paypal_query = ''; foreach ($pp_array as $key => $value) { $paypal_query .= $key.'['.strlen($value).']='.$value.'&'; } $paypal_query = rtrim($paypal_query, '&'); $result = $this->_ConnectToProvider($transactionURL, $transactionURI, $paypal_query, uniqid(rand())); $nvpArray = $this->_DecodePaypalResult($result); if(isset($nvpArray['RESULT']) && $nvpArray['RESULT'] == 0) { $query = "select countryid, countryname from [|PREFIX|]countries where countryiso2 = '".$GLOBALS['ISC_CLASS_DB']->Quote($nvpArray['SHIPTOCOUNTRY'])."'"; $result = $GLOBALS['ISC_CLASS_DB']->Query($query); $countryInfo = $GLOBALS['ISC_CLASS_DB']->Fetch($result); $countryID = $countryInfo['countryid']; $countryName = $countryInfo['countryname']; $stateName = trim($nvpArray['SHIPTOSTATE']); $query = "Select stateid from [|PREFIX|]country_states where stateabbrv = '".$GLOBALS['ISC_CLASS_DB']->Quote($stateName)."' AND statecountry = '".$GLOBALS['ISC_CLASS_DB']->Quote($countryID)."' "; $result = $GLOBALS['ISC_CLASS_DB']->Query($query); $stateID = $GLOBALS['ISC_CLASS_DB']->FetchOne($result); $shipaddress2 = ''; if (isset($nvpArray['SHIPTOSTREET2'])) { $shipaddress2 = $nvpArray['SHIPTOSTREET2']; } $address = array( 'shipfirstname' => $nvpArray['FIRSTNAME'], 'shiplastname' => $nvpArray['LASTNAME'], 'shipcompany' => '', 'shipaddress1' => $nvpArray['SHIPTOSTREET'], 'shipaddress2' => $shipaddress2, 'shipcity' => $nvpArray['SHIPTOCITY'], 'shipstate' => $nvpArray['SHIPTOSTATE'], 'shipstateid' => $stateID, 'shipzip' => $nvpArray['SHIPTOZIP'], 'shipcountry' => $countryName, 'shipcountryid' => $countryID, 'shipdestination' => 'residential', ); if(CustomerIsSignedIn()) { $GLOBALS['ISC_CLASS_CUSTOMER'] = GetClass('ISC_CUSTOMER'); $customerID = $GLOBALS['ISC_CLASS_CUSTOMER']->GetCustomerId(); $address['shipcustomerid'] = $customerID; // check if the customer's address we get back from paypal is already exist in the customer's ISC address book $addressid = $this->GetAddressID($address); if($addressid > 0) { //if address is already in ISC address book, set the ISC address id to session so it can be selected by default on the checkout page. $_SESSION['CHECKOUT']['SelectAddress'] = $addressid; } else { //if address isn't in ISC address book, add it to customer's address book. $_SESSION['CHECKOUT']['SelectAddress'] = $GLOBALS['ISC_CLASS_DB']->InsertQuery("shipping_addresses", $address, 1); } } $address['shipemail'] = $nvpArray['EMAIL']; $address['saveAddress'] = 0; $GLOBALS['ISC_CLASS_CHECKOUT'] = GetClass('ISC_CHECKOUT'); //set the address to the session $GLOBALS['ISC_CLASS_CHECKOUT'] -> SetOrderBillingAddress($address); $GLOBALS['ISC_CLASS_CHECKOUT'] -> SetOrderShippingAddress($address); $_SESSION['CHECKOUT']['PayPalExpressCheckout'] = $nvpArray; // Only want to display paypal as the payment provider on order confirmation page, as customer has already selected the pay with paypal previously, so save paypal in provider list in session, so confirmation page will read from the session. $_SESSION['CHECKOUT']['ProviderListHTML'] = $this->ParseTemplate('paypalpaymentsprouk.providerlist', true); if(GetConfig('CheckoutType') == 'single') { $returnURL = $GLOBALS['ShopPath']."/checkout.php"; $_SESSION['CHECKOUT']['GoToCheckoutStep'] = "ShippingProvider"; } else { $returnURL = $GLOBALS['ShopPath']."/checkout.php?action=choose_shipper"; } header("Location: ".$returnURL); } }
/** * Get the search SQL * * Method will return the search SQL * * @access public * @param array $searchQuery The search query array. Currently will only understand the 'search_query' option * @param int $start The optional start position of the result total. Default is 0 * @param int $limit The optional limit position of the result total. Default is -1 (no limit) * @param string $fieldsToUse the optional fields to select from. Default is * (all) plus the score * @param bool $includeOrder TRUE to include the ORDER BY statement. Default is TRUE * @return string The search SQL on success, FALSE on error */ static public function searchForItemsSQL($searchQuery, $start=0, $limit=-1, $fieldsToUse="", $includeOrder=true) { if (!is_array($searchQuery)) { return false; } if (!array_key_exists("search_query", $searchQuery) || trim($searchQuery["search_query"]) == "") { return false; } if (CustomerIsSignedIn()) { $customerLoggedIn = "TRUE"; } else { $customerLoggedIn = "FALSE"; } $fullTextFields = array("ps.pagetitle", "ps.pagecontent", "ps.pagedesc", "ps.pagesearchkeywords"); if (trim($fieldsToUse) == "") { $fieldsToUse = "SQL_CALC_FOUND_ROWS p.*, v.vendorfriendlyname "; } $fieldsToUse = trim($fieldsToUse); // Hard code in the score SQL if (substr($fieldsToUse, -1) !== ",") { $fieldsToUse .= ", "; } $fieldsToUse .= " (IF(p.pagetitle='" . $GLOBALS["ISC_CLASS_DB"]->Quote($searchQuery["search_query"]) . "', 10000, 0) + ((" . $GLOBALS["ISC_CLASS_DB"]->FullText(array("ps.pagetitle"), $searchQuery["search_query"], false) . ") * 10) + " . $GLOBALS["ISC_CLASS_DB"]->FullText($fullTextFields, $searchQuery["search_query"], false) . ") AS score"; $query = "SELECT " . $fieldsToUse . " FROM [|PREFIX|]pages p INNER JOIN [|PREFIX|]page_search ps ON p.pageid = ps.pageid LEFT JOIN [|PREFIX|]vendors v ON p.pagevendorid = v.vendorid WHERE p.pagestatus = 1 AND (p.pagecustomersonly = 0 OR " . $customerLoggedIn . ")"; $searchPart = array(); if (GetConfig("SearchOptimisation") == "fulltext" || GetConfig("SearchOptimisation") == "both") { $searchPart[] = $GLOBALS["ISC_CLASS_DB"]->FullText($fullTextFields, $searchQuery["search_query"], true); } if (GetConfig("SearchOptimisation") == "like" || GetConfig("SearchOptimisation") == "both") { $searchPart[] = "p.pagetitle LIKE '%" . $GLOBALS["ISC_CLASS_DB"]->Quote($searchQuery["search_query"]) . "%'"; $searchPart[] = "p.pagesearchkeywords LIKE '%" . $GLOBALS["ISC_CLASS_DB"]->Quote($searchQuery["search_query"]) . "%'"; } $query .= " AND (" . implode(" OR ", $searchPart) . ") "; if ($includeOrder) { $query .= " ORDER BY score DESC"; } if (is_numeric($limit) && $limit > 0) { if (is_numeric($start) && $start > 0) { $query .= " LIMIT " . (int)$start . "," . (int)$limit; } else { $query .= " LIMIT " . (int)$limit; } } return $query; }
public function SetPanelSettings() { // Are gift certificates enabled? If so, we need to show the gift certificates link if (gzte11(ISC_LARGEPRINT) && GetConfig('EnableGiftCertificates') != 0) { $GLOBALS['SNIPPETS']['TopMenuGiftCertificates'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("TopMenuGiftCertificates"); } // Show the login/logout link as required if (!isset($GLOBALS['LoginOrLogoutText'])) { if (CustomerIsSignedIn()) { // If they're a customer, set their name so it's available in the templates $c = GetClass('ISC_CUSTOMER'); $customerData = $c->GetCustomerDataByToken(); $GLOBALS['CurrentCustomerFirstName'] = isc_html_escape($customerData['custconfirstname']); $GLOBALS['CurrentCustomerLastName'] = isc_html_escape($customerData['custconlastname']); $GLOBALS['CurrentCustomerEmail'] = isc_html_escape($customerData['custconemail']); $GLOBALS['LoginOrLogoutLink'] = "login.php?action=logout"; $GLOBALS['LoginOrLogoutText'] = sprintf(GetLang('LogoutLink'), $GLOBALS['ShopPathNormal']); } else { // If they're a guest, set their name to 'Guest' $GLOBALS['CurrentCustomerFirstName'] = GetLang('Guest'); $GLOBALS['CurrentCustomerLastName'] = $GLOBALS['CurrentCustomerEmail'] = ''; $GLOBALS['LoginOrLogoutLink'] = "login.php"; $GLOBALS['LoginOrLogoutText'] = sprintf(GetLang('SignInOrCreateAccount'), $GLOBALS['ShopPath'], $GLOBALS['ShopPath']); } } // Display our currency flags. Has been disabled for the time being. Theory being that this will include the whole locale (text aswell) $GLOBALS['CurrencyFlags'] = ""; /* $GLOBALS['CurrencyFlags'] = ""; $query = " SELECT cu.currencyid, cu.currencyname, co.countryname, co.countryiso2 AS countryflagname FROM [|PREFIX|]currencies cu JOIN [|PREFIX|]countries co ON cu.currencycountryid = co.countryid WHERE cu.currencystatus = 1 ORDER BY currencyname ASC "; $result = $GLOBALS['ISC_CLASS_DB']->Query($query); $total = $GLOBALS['ISC_CLASS_DB']->CountResult($result); if ($total <= 1) { $GLOBALS['HideCurrencyFlags'] = "none"; } else { $currenciesDone = 0; while($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) { ++$currenciesDone; if (!file_exists(ISC_BASE_PATH . "/lib/flags/" . strtolower($row['countryflagname']) . ".gif")) { continue; } $GLOBALS["CurrencyID"] = $row['currencyid']; $GLOBALS['CurrencyFlagURL'] = GetConfig("ShopPath") . '/lib/flags/' . strtolower($row['countryflagname']) . '.gif'; $GLOBALS["CurrencyName"] = isc_html_escape($row['currencyname']); if($row['currencyid'] == $GLOBALS['CurrentCurrency'] && $currenciesDone == $total) { $GLOBALS['CurrencyClass'] = ' class="Selected Last"'; } else if($row['currencyid'] == $GLOBALS['CurrentCurrency']) { $GLOBALS['CurrencyClass'] = ' class="Selected"'; } else if ($currenciesDone == $total) { $GLOBALS['CurrencyClass'] = ' class="Last"'; } else { $GLOBALS['CurrencyClass'] = ''; } $currencyFlag = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("HomeCurrencyFlags"); if($row['currencyid'] == $GLOBALS['CurrentCurrency']) { $GLOBALS['CurrencyFlags'] = $currencyFlag . $GLOBALS['CurrencyFlags']; } else { $GLOBALS['CurrencyFlags'] .= $currencyFlag; } } } */ }
public function SetPanelSettings() { // this panel should only be shown for guests entering an address if(CustomerIsSignedIn()) { $this->DontDisplay = true; return; } $formHtml = ''; // Enter a billing address if($GLOBALS['ShippingFormAction'] == 'save_biller') { $formFieldType = FORMFIELDS_FORM_BILLING; $quoteAddress = getCustomerQuote()->getBillingAddress(); // load the email address field $GLOBALS['ISC_CLASS_FORM']->addFormFieldUsed($GLOBALS['ISC_CLASS_FORM']->getFormField(FORMFIELDS_FORM_ACCOUNT, '1', '', true)); // load html for email field $formHtml .= $GLOBALS['ISC_CLASS_FORM']->loadFormField(FORMFIELDS_FORM_ACCOUNT, '1'); $GLOBALS['CheckEmail'] = 'true'; } else { $formFieldType = FORMFIELDS_FORM_SHIPPING; $quoteAddress = getCustomerQuote()->setIsSplitShipping(false) ->getShippingAddress(); } $addressFormFields = $GLOBALS['ISC_CLASS_FORM']->getFormFields($formFieldType, false); // Coming back here from an error, so use the $_POST values $savedFormFieldValues = array(); if(!empty($GLOBALS['ErrorMessage']) && !empty($_POST['FormField'][$formFieldType])) { $savedFormFieldValues = $_POST['FormField'][$formFieldType]; } // Use the address already saved in the quote if there is one else { // An array containing the methods available in $quoteAddress and the form field "private ID" $quoteAddressFields = array( 'EmailAddress' => 'getEmail', 'FirstName' => 'getFirstName', 'LastName' => 'getLastName', 'CompanyName' => 'getCompany', 'AddressLine1' => 'getAddress1', 'AddressLine2' => 'getAddress2', 'City' => 'getCity', 'Zip' => 'getZip', 'State' => 'getStateName', 'Country' => 'getCountryName', 'Phone' => 'getPhone', ); foreach($addressFormFields as $formFieldId => $formField) { $formFieldPrivateId = $formField->record['formfieldprivateid']; if(isset($quoteAddressFields[$formFieldPrivateId])) { $method = $quoteAddressFields[$formFieldPrivateId]; $savedFormFieldValues[$formFieldId] = $quoteAddress->$method(); } else { $customField = $quoteAddress->getCustomField($formFieldId); if($customField !== false) { $savedFormFieldValues[$formFieldId] = $customField; } } } } $countryFieldId = 0; $stateFieldId = 0; foreach($addressFormFields as $formFieldId => $formField) { $formFieldPrivateId = $formField->record['formfieldprivateid']; if(isset($savedFormFieldValues[$formFieldId])) { $formField->setValue($savedFormFieldValues[$formFieldId]); } if($formFieldPrivateId == 'Country') { $countryFieldId = $formFieldId; } else if($formFieldPrivateId == 'State') { $stateFieldId = $formFieldId; } } if($countryFieldId) { $addressFormFields[$countryFieldId]->setOptions(array_values(GetCountryListAsIdValuePairs())); if ($addressFormFields[$countryFieldId]->getValue() == '') { $addressFormFields[$countryFieldId]->setValue(GetConfig('CompanyCountry')); } if ($stateFieldId) { $addressFormFields[$countryFieldId]->addEventHandler('change', 'FormFieldEvent.SingleSelectPopulateStates', array('countryId' => $countryFieldId, 'stateId' => $stateFieldId)); $countryId = GetCountryByName($addressFormFields[$countryFieldId]->getValue()); $stateOptions = GetStateListAsIdValuePairs($countryId); if (is_array($stateOptions) && !empty($stateOptions)) { $addressFormFields[$stateFieldId]->setOptions($stateOptions); } else { // no states for our country, we need to mark this as not required $addressFormFields[$stateFieldId]->setRequired(false); } } } foreach($addressFormFields as $formField) { if (isc_strtolower($formField->record['formfieldprivateid']) == 'savethisaddress' || isc_strtolower($formField->record['formfieldprivateid']) == 'shiptoaddress') { continue; } $formHtml .= $formField->loadForFrontend(); $GLOBALS['ISC_CLASS_FORM']->addFormFieldUsed($formField); } $GLOBALS['ShipCustomFields'] = $formHtml; $GLOBALS['AddressFormFieldID'] = $formFieldType; $GLOBALS['FormFieldRequiredJS'] = $GLOBALS['ISC_CLASS_FORM']->buildRequiredJS(); }
public function ShowPage() { if ($this->_prodid > 0) { $GLOBALS['ProductIds'] = $this->_prodid; // Check that the customer has permisison to view this product $canView = false; $path = GetConfig('ShopPath'); $productCategories = explode(',', $this->_product['prodcatids']); foreach ($productCategories as $categoryId) { // Do we have permission to access this category? if (CustomerGroupHasAccessToCategory($categoryId)) { $canView = true; } } if ($canView == false) { $noPermissionsPage = GetClass('ISC_403'); $noPermissionsPage->HandlePage(); exit; } if ($this->_prodmetakeywords != "") { $GLOBALS['ISC_CLASS_TEMPLATE']->SetMetaKeywords(isc_html_escape($this->_prodmetakeywords)); } if ($this->_prodmetadesc != "") { $GLOBALS['ISC_CLASS_TEMPLATE']->SetMetaDescription(isc_html_escape($this->_prodmetadesc)); } $GLOBALS['CompareLink'] = CompareLink(); // If we're showing images as a lightbox, we need to load up the URLs for the other images for this product if (GetConfig('ProductImageMode') == 'lightbox') { $GLOBALS['AdditionalStylesheets'][] = GetConfig('ShopPath') . '/javascript/jquery/plugins/lightbox/lightbox.css'; } $url_string = $_SERVER['REQUEST_URI']; if (isset($_SERVER['QUERY_STRING'])) { $url_string .= $_SERVER['QUERY_STRING']; } if (eregi('refer=true', $url_string) && isset($_SESSION['back2url'])) { $GLOBALS['B2Search'] = " < <a href='{$path}/" . $_SESSION['back2url'] . "'>Back to search results</a>"; } else { $_SESSION['v_cols'] = array(); $_SESSION['p_cols'] = array(); } //zcs=>only login customer can access "Product Reviews" $GLOBALS['StyleProductReviews'] = CustomerIsSignedIn() ? 'style="text-decoration:none;"' : 'style="display:none;"'; //<=zcs $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate($this->_prodlayoutfile); $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(); } else { ShowInvalidError('product'); die; } }
public function SetPanelSettings() { // Are reviews disabled? Then don't show anything related to reviews if (GetConfig('EnableProductReviews') == 0) { $this->DontDisplay = true; return; } $GLOBALS['StyleProductReviews'] = CustomerIsSignedIn() ? 'style="text-decoration:none;float:right;"' : 'style="display:none;"'; $GLOBALS['ProductId'] = (int) $GLOBALS['ISC_CLASS_PRODUCT']->GetProductId(); $GLOBALS['ProductName'] = $GLOBALS['ISC_CLASS_PRODUCT']->GetProductName(); //2010-11-11 Ronnie add ,if product not exist,show error Message $GLOBALS['HideErrorReviewMessage'] = "none"; if ($GLOBALS['ProductId'] == 0) { $GLOBALS['HideErrorReviewMessage'] = "block"; $GLOBALS['HideReviewMessage'] = "none"; $GLOBALS['Divstyle'] = "style='display:none'"; $GLOBALS['ReviewMessage'] = sprintf(GetLang('InvalidProductError'), GetConfig('StoreName')); $GLOBALS['ReviewErrorMessage'] = GetLang('InvalidProductErrorDetails'); return; } // Are there any reviews for this product? If so, load them if (GetConfig('EnableProductReviews') == 1) { //if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumReviews() > 0) { $this->LoadProductReviews(); /*} else { $this->DontDisplay = true; return; //$GLOBALS['NoReviews'] = GetLang('NoReviews'); }*/ } // Is captcha enabled? if (GetConfig('CaptchaEnabled') == false) { $GLOBALS['HideReviewCaptcha'] = "none"; } else { // Generate the captcha image $GLOBALS['ISC_CLASS_CAPTCHA'] = GetClass('ISC_CAPTCHA'); $GLOBALS['ISC_CLASS_CAPTCHA']->CreateSecret(); $GLOBALS['CaptchaImage'] = $GLOBALS['ISC_CLASS_CAPTCHA']->ShowCaptcha(); $GLOBALS['CaptchaImage2'] = $GLOBALS['ShopPath'] . "/captcha.php?" . rand(500, 8000); } // Should we automatically show the comments form? This is set if captcha fails if (isset($GLOBALS['BadCaptcha']) && $GLOBALS['BadCaptcha'] == true || isset($GLOBALS['ReviewError']) && $GLOBALS['ReviewError'] == true) { $GLOBALS['AutoShowReviewForm'] = "1"; if (isset($_POST['revtitle'])) { $GLOBALS['RevTitle'] = isc_html_escape($_POST['revtitle']); } if (isset($_POST['revtext'])) { $GLOBALS['RevText'] = isc_html_escape($_POST['revtext']); } if (isset($_POST['revfromname'])) { $GLOBALS['RevFromName'] = isc_html_escape($_POST['revfromname']); } if (isset($_POST['revrating'])) { $tempindex = str_replace('.', '_', $_POST['revrating']); //$GLOBALS["ReviewRating" . (int) $_POST['revrating']] = 'selected="selected"'; $GLOBALS["ReviewRating" . $tempindex] = 'selected="selected"'; } if (isset($_POST['qualityrating'])) { $tempindex = str_replace('.', '_', $_POST['qualityrating']); //$GLOBALS["ReviewRating" . (int) $_POST['revrating']] = 'selected="selected"'; $GLOBALS["QualityRating" . $tempindex] = 'selected="selected"'; } if (isset($_POST['installrating'])) { $tempindex = str_replace('.', '_', $_POST['installrating']); //$GLOBALS["ReviewRating" . (int) $_POST['revrating']] = 'selected="selected"'; $GLOBALS["InstallRating" . $tempindex] = 'selected="selected"'; } if (isset($_POST['supportrating'])) { $tempindex = str_replace('.', '_', $_POST['supportrating']); //$GLOBALS["ReviewRating" . (int) $_POST['revrating']] = 'selected="selected"'; $GLOBALS["SupportRating" . $tempindex] = 'selected="selected"'; } if (isset($_POST['deliveryrating'])) { $tempindex = str_replace('.', '_', $_POST['deliveryrating']); //$GLOBALS["ReviewRating" . (int) $_POST['revrating']] = 'selected="selected"'; $GLOBALS["DeliveryRating" . $tempindex] = 'selected="selected"'; } if (isset($_POST['valuerating'])) { $tempindex = str_replace('.', '_', $_POST['valuerating']); //$GLOBALS["ReviewRating" . (int) $_POST['revrating']] = 'selected="selected"'; $GLOBALS["ValueRating" . $tempindex] = 'selected="selected"'; } if (isset($GLOBALS['BadCaptcha'])) { $GLOBALS['ReviewError'] = GetLang('ReviewBadCaptcha'); } else { $GLOBALS['ReviewError'] = GetLang('ReviewInternalError'); } $GLOBALS['ReviewErrorMessage'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ProductReviewBadCaptcha"); } // Is there a message to show above the reviews? if (!isset($GLOBALS['ReviewMessage'])) { $GLOBALS['HideReviewMessage'] = "none"; } // Should we go straight to the reviews? if (isset($GLOBALS['ReviewSaved'])) { $GLOBALS['JumpToReviews'] = "1"; } }
/** * Set the settings for this panel. */ public function SetPanelSettings() { $GLOBALS['HideTabMultiple'] = 'display: none'; $GLOBALS['ActiveTabSingle'] = 'Active'; $GLOBALS['SNIPPETS']['ShippingAddressList'] = ""; $GLOBALS['ShippingAddressRow'] = ""; $count = 0; $GLOBALS['ISC_CLASS_CUSTOMER'] = GetClass('ISC_CUSTOMER'); $cart = GetClass('ISC_CART'); $numItems = $cart->api->GetNumPhysicalProducts(); // Get a list of all shipping addresses for this customer and out them as radio buttons $shipping_addresses = $GLOBALS['ISC_CLASS_CUSTOMER']->GetCustomerShippingAddresses(); $GLOBALS['SplitAddressList'] = ''; foreach ($shipping_addresses as $address) { $GLOBALS['ShippingAddressId'] = (int) $address['shipid']; $GLOBALS['ShipFullName'] = isc_html_escape($address['shipfirstname'] . ' ' . $address['shiplastname']); $GLOBALS['ShipCompany'] = ''; if ($address['shipcompany']) { $GLOBALS['ShipCompany'] = isc_html_escape($address['shipcompany']) . '<br />'; } $GLOBALS['ShipAddressLine1'] = isc_html_escape($address['shipaddress1']); if ($address['shipaddress2'] != "") { $GLOBALS['ShipAddressLine2'] = isc_html_escape($address['shipaddress2']); } else { $GLOBALS['ShipAddressLine2'] = ''; } $GLOBALS['ShipSuburb'] = isc_html_escape($address['shipcity']); $GLOBALS['ShipState'] = isc_html_escape($address['shipstate']); $GLOBALS['ShipZip'] = isc_html_escape($address['shipzip']); $GLOBALS['ShipCountry'] = isc_html_escape($address['shipcountry']); if ($address['shipphone'] != "") { $GLOBALS['ShipPhone'] = isc_html_escape(sprintf("%s: %s", GetLang('Phone'), $address['shipphone'])); } else { $GLOBALS['ShipPhone'] = ""; } $splitAddressFields = array($address['shipfirstname'] . ' ' . $address['shiplastname'], $address['shipcompany'], $address['shipaddress1'], $address['shipaddress2'], $address['shipcity'], $address['shipstate'], $address['shipzip'], $address['shipcountry']); // Please see self::GenerateShippingSelect below. $splitAddressFields = array_filter($splitAddressFields, array($this, 'FilterAddressFields')); $splitAddress = isc_html_escape(implode(', ', $splitAddressFields)); $GLOBALS['SplitAddressList'] .= '<option value="' . $address['shipid'] . '" <sel' . $address['shipid'] . '>>' . $splitAddress . '</option>'; $GLOBALS['SNIPPETS']['ShippingAddressList'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CheckoutShippingAddressItemOffer"); } $GLOBALS['SNIPPETS']['MultiShippingItem'] = ''; if (!gzte11(ISC_MEDIUMPRINT) || !GetConfig('MultipleShippingAddresses') || !CustomerIsSignedIn() || $numItems == 1 || !isset($GLOBALS['ISC_CLASS_CHECKOUT'])) { $GLOBALS['HideShippingTabs'] = 'display: none'; $GLOBALS['HideMultiShipping'] = 'display: none'; } else { if (isset($_REQUEST['type']) && $_REQUEST['type'] == 'multiple' || isset($_SESSION['CHECKOUT']['IS_SPLIT_SHIPPING']) && $_SESSION['CHECKOUT']['IS_SPLIT_SHIPPING'] == true && CustomerIsSignedIn()) { $GLOBALS['HideTabSingle'] = 'display: none'; $GLOBALS['HideTabMultiple'] = ''; $GLOBALS['ActiveTabSingle'] = ''; $GLOBALS['ActiveTabMultiple'] = 'Active'; } $selectedAddresses = array(); if (isset($_SESSION['CHECKOUT']['SPLIT_SHIPPING'])) { foreach ($_SESSION['CHECKOUT']['SPLIT_SHIPPING'] as $addressId => $products) { foreach ($products as $product => $quantity) { for ($i = 1; $i <= $quantity; ++$i) { $selectedAddresses[$product][] = $addressId; } } } } $cartProducts = $cart->api->GetProductsInCart(); foreach ($cartProducts as $cartItemId => $product) { // If this isn't a physical item, skip it if ($product['data']['prodtype'] != PT_PHYSICAL) { continue; } $GLOBALS['ProductName'] = isc_html_escape($product['data']['prodname']); // Is this product a variation? $GLOBALS['ProductOptions'] = ''; if (isset($product['options']) && !empty($product['options'])) { $GLOBALS['ProductOptions'] .= "<br /><small>("; $comma = ''; foreach ($product['options'] as $name => $value) { if (!trim($name) || !trim($value)) { continue; } $GLOBALS['ProductOptions'] .= $comma . isc_html_escape($name) . ": " . isc_html_escape($value); $comma = ', '; } $GLOBALS['ProductOptions'] .= ")</small>"; } // Loop through the cart items and add them individually to the list for ($i = 1; $i <= $product['quantity']; ++$i) { $GLOBALS['AddressFieldId'] = $cartItemId . '_' . $i; if (isset($selectedAddresses[$cartItemId][$i - 1])) { $sel = $selectedAddresses[$cartItemId][$i - 1]; } else { $sel = 0; } $GLOBALS['ShippingAddressSelect'] = $this->GenerateShippingSelect($GLOBALS['SplitAddressList'], $sel); $GLOBALS['SNIPPETS']['MultiShippingItem'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet('MultiShippingItem'); } } } }
public function HandlePage() { $action = ""; if (isset($_REQUEST['action'])) { $action = isc_strtolower($_REQUEST['action']); } if (isset($_GET['from'])) { $_GET['from'] = str_replace(array("\n", "\r", "\r\n", "\t"), "", $_GET['from']); $_SESSION['LOGIN_REDIR'] = sprintf("%s/%s", $GLOBALS['ShopPath'], urldecode($_GET['from'])); } if ($action === "download_item") { $this->DownloadOrderItem(); return; } // Are they signed in? if (CustomerIsSignedIn()) { $GLOBALS['ISC_CLASS_CUSTOMER'] = GetClass('ISC_CUSTOMER'); $customer = $GLOBALS['ISC_CLASS_CUSTOMER']->GetCustomerDataByToken(); if ($customer['custstorecredit'] == 0) { $GLOBALS['HidePanels'][] = "SideAccountStoreCredit"; } switch ($action) { case "send_message": { $this->SendMessage(); break; } case "save_new_shipping_address": { $this->SaveNewShippingAddress(); break; } case "add_shipping_address": { $this->AddShippingAddress(); break; } case "edit_shipping_address": { $this->EditShippingAddress(); break; } case "update_new_shipping_address": { $this->SaveEditedShippingAddress(); break; } case "delete_shipping_address": { $this->DeleteShippingAddress(); break; } case "inbox": { $this->Inbox(); break; } case "order_status": { $this->OrderStatus(); break; } case "view_orders": { $this->ViewOrders(); break; } case "view_order": { $this->ViewOrderDetails(); break; } case "download_item": { $this->DownloadOrderItem(); break; } case "print_invoice": { $this->PrintInvoice(); break; } case "address_book": { $this->AddressBook(); break; } case "account_details": { $this->EditAccount(); break; } case "update_account": { $this->SaveAccountDetails(); break; } case "recent_items": { $this->ShowRecentItems(); break; } case "new_return": { $this->NewReturn(); break; } case "save_new_return": { $this->SaveNewReturn(); break; } case "view_returns": { $this->ShowReturns(); break; } case "reorder": { $this->DoReorder(); break; } default: { $this->MyAccountPage(); } } } else { // Naughty naughty, you need to sign in to be here $this_page = urlencode(sprintf("account.php?action=%s", $action)); ob_end_clean(); header(sprintf("Location: %s/login.php?from=%s", $GLOBALS['ShopPath'], $this_page)); die(); } }
/** * Redirect to the payment provider if one is chosen - otherwise process the payment for an order. */ private function PayForOrder() { // If guest checkout is not enabled and the customer isn't signed in then send the customer // back to the beginning of the checkout process. if(!GetConfig('GuestCheckoutEnabled') && !CustomerIsSignedIn() && !isset($_SESSION['CHECKOUT']['CREATE_ACCOUNT'])) { @ob_end_clean(); header("Location: ".GetConfig('ShopPath').'/checkout.php'); exit; } if (GetConfig('EnableOrderTermsAndConditions')==1 && !isset($_POST['AgreeTermsAndConditions'])) { @ob_end_clean(); $_SESSION['REDIRECT_TO_CONFIRMATION_MSG'] = GetLang('TickArgeeTermsAndConditions'); header("Location: ".$GLOBALS['ShopPath']."/checkout.php?action=confirm_order"); exit; } // ensure products are in stock $this->CheckStockLevels(); // Customer actually chose to apply a gift certificate or coupon code to this order so // we actually show the confirm order page again which does all of the magic. if (isset($_REQUEST['apply_code'])) { $this->ConfirmOrder(); return; } // Attempt to create the pending order with the selected details $pendingResult = $this->SavePendingOrder(); // There was a problem creating the pending order if(!is_array($pendingResult)) { @ob_end_clean(); header("Location: ".$GLOBALS['ShopPath']."/checkout.php?action=confirm_order"); exit; } // There was a problem creating the pending order but we have an actual error message if(isset($pendingResult['error'])) { if(isset($pendingResult['errorDetails'])) { $this->BadOrder('', $pendingResult['error'], $pendingResult['errorDetails']); } else { $this->BadOrder('', $pendingResult['error']); } } // We've been told all we need to do is redirect to the finish order page, so do that if(isset($pendingResult['redirectToFinishOrder']) && $pendingResult['redirectToFinishOrder']) { @ob_end_clean(); header("Location: ".$GLOBALS['ShopPath']."/finishorder.php"); die(); } // Otherwise, the gateway want's to do something if(!empty($pendingResult['provider']) && ($pendingResult['provider']->GetPaymentType() == PAYMENT_PROVIDER_ONLINE || method_exists($pendingResult['provider'], "ShowPaymentForm"))) { // ProviderListHTML is stored in the session when the provider requires that it can only be the only payment provider during checkout, disable the other checkout method. if(isset($_SESSION['CHECKOUT']['ProviderListHTML']) && method_exists($pendingResult['provider'], 'DoExpressCheckoutPayment')) { $pendingResult['provider']->DoExpressCheckoutPayment(); die(); } // If we have a payment form to show then show that if(isset($pendingResult['showPaymentForm']) && $pendingResult['showPaymentForm']) { $this->ShowPaymentForm($pendingResult['provider']); } else { $pendingResult['provider']->TransferToProvider(); } } else { // It's an offline payment method, no need to accept payment now if(!empty($pendingResult['provider'])) $providerId = $pendingResult['provider']->GetId(); else $providerId = ''; @ob_end_clean(); header(sprintf("Location:%s/finishorder.php?provider=%s", $GLOBALS['ShopPath'], $providerId)); die(); } }
/** * Get Express Checkout Details step * When customer come back from paypal after they select the payment method and shipping address in paypal, * This function takes the shipping address and redirect customer to choose shipping provider page. */ private function GetExpressCheckoutDetails() { if(isset($_SESSION['CHECKOUT']['FromCartPage'])) { unset($_COOKIE['SHOP_ORDER_TOKEN']); } $merchant = $this->GetMerchantSettings(); if($merchant['testmode'] == 'YES') { $transactionURL = $this->_testTransactionURL; $transactionURI = $this->_testTransactionURI; } else { $transactionURL = $this->_liveTransactionURL; $transactionURI = $this->_liveTransactionURI; } $pp_array = array( 'METHOD' => 'GetExpressCheckoutDetails', 'USER' => $merchant['username'], 'PWD' => $merchant['password'], 'SIGNATURE' => $merchant['signature'], 'VERSION' => '53.0', 'PAYMENTACTION' => $merchant['transactionType'], 'TOKEN' => $_REQUEST['token'], 'NOTIFYURL' => $GLOBALS['ShopPath'].'/checkout.php?action=gateway_ping&provider='.$this->GetId(), ); $paypal_query = ''; foreach ($pp_array as $key => $value) { $paypal_query .= $key.'='.urlencode($value).'&'; } $paypal_query = rtrim($paypal_query, '&'); // get the customer details from paypal $result = $this->_ConnectToProvider($transactionURL, $transactionURI, $paypal_query); $nvpArray = $this->_DecodePaypalResult($result); if(strtolower($nvpArray['ACK']) == 'success') { $_SESSION['CHECKOUT']['PayPalExpressCheckout'] = $nvpArray; // if user started paypal express checkout at confirmation page, redirect user back to confirmation page if(isset($_COOKIE['SHOP_ORDER_TOKEN'])) { // Load the pending order $orders = LoadPendingOrdersByToken($_COOKIE['SHOP_ORDER_TOKEN']); if(!is_array($orders)) { @ob_end_clean(); header("Location: ".$GLOBALS['ShopPath']."/checkout.php?action=confirm_order"); die(); } $this->SetOrderData($orders); $this->DoExpressCheckoutPayment(); exit; } $countryID = GetCountryIdByISO2($nvpArray['SHIPTOCOUNTRYCODE']); $countryName = GetCountryById($countryID); $stateID = $this->GetStateId($countryID, $nvpArray['SHIPTOSTATE']); $stateName = GetStateById($stateID); $phone = ''; if(isset($nvpArray['PHONENUM'])) { // phone will only be available if (see ISC-937) // 1. seller chooses "On (Required Field)" for contact telephone // 2. and, buyer ticks "Share this phone number with <store_name>" $phone = $nvpArray['PHONENUM']; } $shipaddress2 = ''; if (isset($nvpArray['SHIPTOSTREET2'])) { $shipaddress2 = $nvpArray['SHIPTOSTREET2']; } $address = array( 'shipfirstname' => $nvpArray['FIRSTNAME'], 'shiplastname' => $nvpArray['LASTNAME'], 'shipcompany' => '', 'shipaddress1' => $nvpArray['SHIPTOSTREET'], 'shipaddress2' => $shipaddress2, 'shipcity' => $nvpArray['SHIPTOCITY'], 'shipstate' => $stateName, 'shipzip' => $nvpArray['SHIPTOZIP'], 'shipcountry' => $countryName, 'shipstateid' => $stateID, 'shipcountryid' => $countryID, 'shipdestination' => 'residential', 'shipphone' => $phone ); if(CustomerIsSignedIn()) { $GLOBALS['ISC_CLASS_CUSTOMER'] = GetClass('ISC_CUSTOMER'); $customerID = $GLOBALS['ISC_CLASS_CUSTOMER']->GetCustomerId(); $address['shipcustomerid'] = $customerID; // check if the customer's address we get back from paypal is already exist in the customer's ISC address book $addressid = $this->GetAddressID($address); if($addressid > 0) { //if address is already in ISC address book, set the ISC address id to session so it can be selected by default on the checkout page. $_SESSION['CHECKOUT']['SelectAddress'] = $addressid; } else { //if address isn't in ISC address book, add it to customer's address book. $_SESSION['CHECKOUT']['SelectAddress'] = $GLOBALS['ISC_CLASS_DB']->InsertQuery("shipping_addresses", $address, 1); } } $address['shipemail'] = $nvpArray['EMAIL']; $address['saveAddress'] = 0; $GLOBALS['ISC_CLASS_CHECKOUT'] = GetClass('ISC_CHECKOUT'); //set the address to the session $GLOBALS['ISC_CLASS_CHECKOUT'] -> SetOrderBillingAddress($address); if($nvpArray['FIRSTNAME']." ".$nvpArray['LASTNAME'] != $nvpArray['SHIPTONAME']) { $_SESSION['CHECKOUT']['GoToCheckoutStep'] = "BillingAddress"; $firstName = trim(preg_replace('/\s.*$/', '', $nvpArray['SHIPTONAME'])); $lastName = trim(str_replace($firstName, '', $nvpArray['SHIPTONAME'])); $address['shipfirstname'] = $firstName; $address['shiplastname'] = $lastName; } else { $_SESSION['CHECKOUT']['GoToCheckoutStep'] = "ShippingProvider"; } $GLOBALS['ISC_CLASS_CHECKOUT'] -> SetOrderShippingAddress($address); // Only want to display paypal as the payment provider on order confirmation page, as customer has already selected the pay with paypal previously, so save paypal in provider list in session, so confirmation page will read from the session. $_SESSION['CHECKOUT']['ProviderListHTML'] = $this->ParseTemplate('paypalexpress.providerlist', true); // Skip choose a billing and shipping address step if(GetConfig('CheckoutType') == 'single') { $returnURL = $GLOBALS['ShopPath']."/checkout.php"; } else { //set the address to the session $GLOBALS['ISC_CLASS_CHECKOUT']->SetOrderBillingAddress($address); $GLOBALS['ISC_CLASS_CHECKOUT']->SetOrderShippingAddress($address); $returnURL = $GLOBALS['ShopPath']."/checkout.php?action=choose_shipper"; } header("Location: ".$returnURL); } }
public function SetPanelSettings() { $GLOBALS['FooterScripts'] = ''; $GLOBALS['HideLogoutLink'] = 'display: none'; if(CustomerIsSignedIn()) { $GLOBALS['HideLogoutLink'] = ''; } if($_SERVER['REQUEST_METHOD'] == 'POST') { $baseURL = getConfig('ShopPathNormal'); } else { $baseURL = getCurrentLocation(); } if(strpos($baseURL, '?') === false) { $baseURL .= '?'; } else { $baseURL .= '&'; } $fullSiteLink = $baseURL.'fullSite=1'; $GLOBALS['ISC_CLASS_TEMPLATE']->assign('FullSiteLink', $fullSiteLink); // Show Mobile Site link if(canViewMobileSite()) { $mobileSiteURL = preg_replace('/(&)?fullSite=\d*/i', '', $baseURL); $GLOBALS['MobileSiteURL'] = $mobileSiteURL.'fullSite=0'; $GLOBALS['MobileSiteLink'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet('MobileSiteLink'); } // Show "All prices are in [currency code]" $currency = GetCurrencyById($GLOBALS['CurrentCurrency']); if(is_array($currency) && $currency['currencycode']) { $GLOBALS['AllPricesAreInCurrency'] = sprintf(GetLang('AllPricesAreInCurrency'), isc_html_escape($currency['currencyname']), isc_html_escape($currency['currencycode'])); } if(GetConfig('DebugMode') == 1) { $end_time = microtime_float(); $GLOBALS['ScriptTime'] = number_format($end_time - ISC_START_TIME, 4); $GLOBALS['QueryCount'] = $GLOBALS['ISC_CLASS_DB']->NumQueries; if (function_exists('memory_get_peak_usage')) { $GLOBALS['MemoryPeak'] = "Memory usage peaked at ".Store_Number::niceSize(memory_get_peak_usage(true)); } else { $GLOBALS['MemoryPeak'] = ''; } if (isset($_REQUEST['debug'])) { $GLOBALS['QueryList'] = "<ol class='QueryList' style='font-size: 13px;'>\n"; foreach($GLOBALS['ISC_CLASS_DB']->QueryList as $query) { $GLOBALS['QueryList'] .= "<li style='line-height: 1.4; margin-bottom: 4px;'>".isc_html_escape($query['Query'])." — <em>".number_format($query['ExecutionTime'], 4)."seconds</em></li>\n"; } $GLOBALS['QueryList'] .= "</ol>"; } $GLOBALS['DebugDetails'] = "<p>Page built in ".$GLOBALS['ScriptTime']."s with ".$GLOBALS['QueryCount']." queries. ".$GLOBALS['MemoryPeak']."</p>"; } else { $GLOBALS['DebugDetails'] = ''; } // Do we have any live chat service code to show in the footer $modules = GetConfig('LiveChatModules'); if(!empty($modules)) { $liveChatClass = GetClass('ISC_LIVECHAT'); $GLOBALS['LiveChatFooterCode'] = $liveChatClass->GetPageTrackingCode('footer'); } // Load our whitelabel file for the front end require_once ISC_BASE_PATH.'/includes/whitelabel.php'; // Load the configuration file for this template $poweredBy = 0; require_once ISC_BASE_PATH.'/templates/'.GetConfig('template').'/config.php'; if(isset($GLOBALS['TPL_CFG']['PoweredBy'])) { if(!isset($GLOBALS['ISC_CFG']['TemplatePoweredByLines'][$GLOBALS['TPL_CFG']['PoweredBy']])) { $GLOBALS['TPL_CFG']['PoweredBy'] = 0; } $poweredBy = $GLOBALS['TPL_CFG']['PoweredBy']; } // Showing the powered by? $GLOBALS['PoweredBy'] = ''; if($GLOBALS['ISC_CFG']['DisableFrontEndPoweredBy'] == false && isset($GLOBALS['ISC_CFG']['TemplatePoweredByLines'][$poweredBy])) { $GLOBALS['PoweredBy'] = $GLOBALS['ISC_CFG']['TemplatePoweredByLines'][$poweredBy]; } if(empty($GLOBALS['OptimizerConversionScript']) && empty($GLOBALS['OptimizerTrackingScript']) && empty($GLOBALS['OptimizerControlScript'])) { $this->setGwoCookieCrossDomain(); } $GLOBALS['SitemapURL_HTML'] = isc_html_escape(SitemapLink()); $GLOBALS['SNIPPETS']['SitemapLink'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet('SitemapLink'); if (Interspire_TaskManager::hasTasks()) { // hasTasks is only implemented for Internal so this will (should) never run for Resque-based task manager $GLOBALS['FooterScripts'] .= Interspire_TaskManager::getTriggerHtml('json'); } if (ISC_CATEGORY::areCategoryFlyoutsEnabled()) { // this needs to be output from php into the body since it's based on config vars // @todo use the stuff gaston is working on instead // bgiframe fixes some IE-related issues with CSS menus (like hovering over SELECT elements) $GLOBALS['FooterScripts'] .= '<script type="text/javascript" src="' . GetConfig('AppPath') . '/javascript/superfish/js/jquery.bgiframe.min.js?' . GetConfig('JSCacheToken') . '"></script>' . "\n"; $GLOBALS['FooterScripts'] .= '<script type="text/javascript" src="' . GetConfig('AppPath') . '/javascript/superfish/js/superfish.js?' . GetConfig('JSCacheToken') . '"></script>' . "\n"; $GLOBALS['FooterScripts'] .= '<script type="text/javascript"> $(function(){ if (typeof $.fn.superfish == "function") { $("ul.sf-menu").superfish({ delay: ' . ((float)GetConfig('categoryFlyoutMouseOutDelay') * 1000) . ', dropShadows: ' . isc_json_encode(GetConfig('categoryFlyoutDropShadow')) . ', speed: "fast" }) .find("ul") .bgIframe(); } }) </script> '; } if (GetConfig('FastCartAction') == 'popup' && GetConfig('ShowCartSuggestions')) { $GLOBALS['SNIPPETS']['FastCartThickBoxJs'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet('FastCartThickBoxJs'); } }
/** * Get Express Checkout Details step * When customer come back from paypal after they select the payment method and shipping address in paypal, * This function takes the shipping address and redirect customer to choose shipping provider page. */ private function GetExpressCheckoutDetails() { $merchant = $this->GetMerchantSettings(); if ($merchant['testmode'] == 'YES') { $transactionURL = $this->_testTransactionURL; $transactionURI = $this->_testTransactionURI; } else { $transactionURL = $this->_liveTransactionURL; $transactionURI = $this->_liveTransactionURI; } $pp_array = array('METHOD' => 'GetExpressCheckoutDetails', 'USER' => $merchant['username'], 'PWD' => $merchant['password'], 'SIGNATURE' => $merchant['signature'], 'VERSION' => '52.0', 'PAYMENTACTION' => $merchant['transactionType'], 'TOKEN' => $_REQUEST['token']); $paypal_query = http_build_query($pp_array); // get the customer details from paypal $result = $this->_ConnectToProvider($transactionURL, $transactionURI, $paypal_query); $nvpArray = $this->_DecodePaypalResult($result); if (strtolower($nvpArray['ACK']) == 'success') { $countryName = trim($nvpArray['SHIPTOCOUNTRYNAME']); $query = "select\n\t\t\t\t\t\t\t\tcountryid\n\t\t\t\t\t\t\tfrom\n\t\t\t\t\t\t\t\t[|PREFIX|]countries\n\t\t\t\t\t\t\twhere\n\t\t\t\t\t\t\t\tcountryname = '" . $GLOBALS['ISC_CLASS_DB']->Quote($countryName) . "'"; $result = $GLOBALS['ISC_CLASS_DB']->Query($query); $countryID = $GLOBALS['ISC_CLASS_DB']->FetchOne($result); $stateName = trim($nvpArray['SHIPTOSTATE']); $query = "Select\n\t\t\t\t\t\t\t\tstateid\n\t\t\t\t\t\t\tfrom\n\t\t\t\t\t\t\t\t[|PREFIX|]country_states\n\t\t\t\t\t\t\twhere\n\t\t\t\t\t\t\t\tstateabbrv = '" . $GLOBALS['ISC_CLASS_DB']->Quote($stateName) . "'\n\t\t\t\t\t\t\t\tAND\n\t\t\t\t\t\t\t\tstatecountry = '" . $GLOBALS['ISC_CLASS_DB']->Quote($countryID) . "'\n\t\t\t\t\t\t\t\t"; $result = $GLOBALS['ISC_CLASS_DB']->Query($query); $stateID = $GLOBALS['ISC_CLASS_DB']->FetchOne($result); $address = array('shipfirstname' => $nvpArray['FIRSTNAME'], 'shiplastname' => $nvpArray['LASTNAME'], 'shipcompany' => '', 'shipaddress1' => $nvpArray['SHIPTOSTREET'], 'shipaddress2' => '', 'shipcity' => $nvpArray['SHIPTOCITY'], 'shipstate' => $nvpArray['SHIPTOSTATE'], 'shipzip' => $nvpArray['SHIPTOZIP'], 'shipcountry' => $countryName, 'shipstateid' => $stateID, 'shipcountryid' => $countryID, 'shipdestination' => 'residential'); if (CustomerIsSignedIn()) { $GLOBALS['ISC_CLASS_CUSTOMER'] = GetClass('ISC_CUSTOMER'); $customerID = $GLOBALS['ISC_CLASS_CUSTOMER']->GetCustomerId(); $address['shipcustomerid'] = $customerID; // check if the customer's address we get back from paypal is already exist in the customer's ISC address book $addressid = $this->GetAddressID($address); if ($addressid > 0) { //if address is already in ISC address book, set the ISC address id to session so it can be selected by default on the checkout page. $_SESSION['CHECKOUT']['SelectAddress'] = $addressid; } else { //if address isn't in ISC address book, add it to customer's address book. $_SESSION['CHECKOUT']['SelectAddress'] = $GLOBALS['ISC_CLASS_DB']->InsertQuery("shipping_addresses", $address, 1); } } $address['shipemail'] = $nvpArray['EMAIL']; $address['saveAddress'] = 0; $GLOBALS['ISC_CLASS_CHECKOUT'] = GetClass('ISC_CHECKOUT'); //set the address to the session $GLOBALS['ISC_CLASS_CHECKOUT']->SetOrderBillingAddress($address); $GLOBALS['ISC_CLASS_CHECKOUT']->SetOrderShippingAddress($address); $_SESSION['CHECKOUT']['PayPalExpressCheckout'] = $nvpArray; //only want to display paypal as the payment provider on order confirmation page, as customer has already selected the pay with paypal previously, so save paypal in provider list in session, so confirmation page will read from the session. $_SESSION['CHECKOUT']['ProviderListHTML'] = $this->ParseTemplate('paypalpaymentsprous.providerlist', true); $GLOBALS['ISC_CLASS_CART'] = GetClass('ISC_CART'); $GLOBALS['ISC_CLASS_CART']->SetCartValues(); //skip choose a billing and shipping address step if (GetConfig('CheckoutType') == 'single') { $returnURL = $GLOBALS['ShopPathSSL'] . "/checkout.php"; $_SESSION['CHECKOUT']['GoToCheckoutStep'] = "ShippingProvider"; } else { //set the address to the session $GLOBALS['ISC_CLASS_CHECKOUT']->SetOrderBillingAddress($address); $GLOBALS['ISC_CLASS_CHECKOUT']->SetOrderShippingAddress($address); $returnURL = $GLOBALS['ShopPathSSL'] . "/checkout.php?action=choose_shipper"; } header("Location: " . $returnURL); } }
public function HandlePage() { $action = ""; if(isset($_REQUEST['action'])) { $action = isc_strtolower($_REQUEST['action']); } if(isset($_GET['from'])) { $_SESSION['LOGIN_REDIR'] = sprintf("%s/%s", $GLOBALS['ShopPath'], urldecode($_GET['from'])); } if (isset($_GET['publicwishlist'])) { $this->DisplayPublicWishList(); return true; } // Are they signed in? if(CustomerIsSignedIn()) { switch($action) { case "add": { $this->AddItemToWishList(); break; } case "remove": { $this->RemoveItemFromWishList(); break; } case "viewwishlistitems": { $this->DisplayWishListItems(); break; } case "editwishlist": { $this->DisplayEditWishListForm(); break; } case "deletewishlist": { $this->DeleteWishLists(); break; } case "addwishlist": { $this->DisplayAddWishListForm(); break; } case "sharewishlist": { $this->DisplayShareWishList(); break; } default: { $this->MyWishLists(); } } } else { // Naughty naughty, you need to sign in to be here if(isset($_SERVER['QUERY_STRING'])) { $get_vars = $_SERVER['QUERY_STRING']; } else { $get_vars = ""; } $this_page = urlencode(sprintf("wishlist.php?%s", $get_vars)); ob_end_clean(); header(sprintf("Location: %s/login.php?from=%s", $GLOBALS['ShopPath'], $this_page)); die(); } }
private function GetExpressOfferConfirmation() { $GLOBALS['ISC_CLASS_FINALIZEOFFER'] = GetClass('ISC_FINALIZEOFFER'); $GLOBALS['ISC_CLASS_MAKEAOFFER'] = GetClass('ISC_MAKEAOFFER'); // If the customer is not logged in and guest checkout is enabled, then don't go any further if (!CustomerIsSignedIn() && !GetConfig('GuestCheckoutEnabled') && !isset($_POST['createAccount'])) { $tags[] = $this->MakeXMLTag('status', 0); $tags[] = $this->MakeXMLTag('step', 'AccountDetails'); $tags[] = $this->MakeXMLTag('message', GetLang('GuestCheckoutDisabledError')); $this->SendXMLHeader(); $this->SendXMLResponse($tags); } // If the customer is creating an account, validate their account creation if (isset($_POST['createAccount'])) { $this->ExpressCheckoutRegister(true); } // Using a new billing address if (isset($_REQUEST['billingType']) && $_REQUEST['billingType'] == 'new') { // Loop through all of the address fields and build the address to save with the order $addressData = $this->GetExpressCheckoutAddressData('billing'); if (isset($_POST['billing_SaveThisAddress'])) { $addressData['saveAddress'] = true; } // Set aside any of the custom fields if we have any if (isset($_POST['custom']) && is_array($_POST['custom'])) { // We need to split it up between customer and billing custom data $accountFields = $GLOBALS['ISC_CLASS_FORM']->getFormFields(FORMFIELDS_FORM_ACCOUNT); $accountData = array(); $billingData = array(); foreach (array_keys($_POST['custom']) as $fieldId) { if (array_key_exists($fieldId, $accountFields)) { $accountData[$fieldId] = $_POST['custom'][$fieldId]; } else { $billingData[$fieldId] = $_POST['custom'][$fieldId]; } } if (!empty($accountData)) { $GLOBALS['ISC_CLASS_FINALIZEOFFER']->SetCustomFieldData('customer', $accountData); } if (!empty($billingData)) { $GLOBALS['ISC_CLASS_FINALIZEOFFER']->SetCustomFieldData('billing', $billingData); } } if (!$GLOBALS['ISC_CLASS_FINALIZEOFFER']->SetOrderBillingAddress($addressData)) { $tags[] = $this->MakeXMLTag('status', 0); $tags[] = $this->MakeXMLTag('step', 'BillingAddress'); $tags[] = $this->MakeXMLTag('message', GetLang('UnableSaveOrderBillingAddress')); $this->SendXMLHeader(); $this->SendXMLResponse($tags); exit; } } else { // If we're here, we need to save the details the customer entered in the session if (!$GLOBALS['ISC_CLASS_FINALIZEOFFER']->SetOrderBillingAddress($_REQUEST['billingAddressId'])) { $tags[] = $this->MakeXMLTag('status', 0); $tags[] = $this->MakeXMLTag('step', 'BillingAddress'); $tags[] = $this->MakeXMLTag('message', GetLang('UnableSaveOrderBillingAddress')); $this->SendXMLHeader(); $this->SendXMLResponse($tags); exit; } } if (!$GLOBALS['ISC_CLASS_MAKEAOFFER']->api->AllProductsInCartAreIntangible()) { // If the shipping provider couldn't be saved with the order show an error message $checkout = GetClass('ISC_FINALIZEOFFER'); $cartContent = $checkout->BreakdownCartByAddressVendorforshipping(); foreach ($cartContent as $vendorId => $addresses) { foreach (array_keys($addresses) as $addressId) { if (!isset($_REQUEST['selectedShippingMethod'][$vendorId][$addressId]) || !$GLOBALS['ISC_CLASS_FINALIZEOFFER']->SetOrderShippingProvider($vendorId, $addressId, $_REQUEST['selectedShippingMethod'][$vendorId][$addressId])) { $tags[] = $this->MakeXMLTag('status', 0); $tags[] = $this->MakeXMLTag('step', 'ShippingAddress'); $tags[] = $this->MakeXMLTag('message', GetLang('UnableSaveOrderShippingAddress')); $this->SendXMLHeader(); $this->SendXMLResponse($tags); exit; } } } } $confirmation = $GLOBALS['ISC_CLASS_FINALIZEOFFER']->GenerateExpressCheckoutConfirmation(); $tags[] = $this->MakeXMLTag('status', 1); $tags[] = $this->MakeXMLTag('confirmationContents', $confirmation, true); $this->SendXMLHeader(); $this->SendXMLResponse($tags); exit; }
/** * Build the contents for the order confirmation page. This function sets up everything to be used by * the order confirmation on the express checkout page as well as the ConfirmOrder page when using a * multi step checkout. */ public function BuildOrderConfirmation() { //alandy.check customer email. $GLOBALS['Hasemailflag'] = "no"; /*$sql="select customerid from [|PREFIX|]customers where custconemail='".$_SESSION['CHECKOUT']['account_email']."'"; $query=$GLOBALS['ISC_CLASS_DB']->Query($sql); while($rs=$GLOBALS['ISC_CLASS_DB']->Fetch($query)){ $GLOBALS['Hasemailflag']="yes"; }*/ if ($_SESSION['Haslogin'] == 1) { $GLOBALS['Hasemailflag'] = "no"; } if (!GetConfig('ShowMailingListInvite')) { $GLOBALS['HideMailingListInvite'] = 'none'; } // Do we need to show the special offers & discounts checkbox and should they // either of the newsletter checkboxes be ticked by default? if (GetConfig('MailAutomaticallyTickNewsletterBox')) { $GLOBALS['NewsletterBoxIsTicked'] = 'checked="checked"'; } // Is Interspire Email Marketer integrated? if (GetConfig('MailXMLAPIValid') && GetConfig('UseMailerForOrders') && GetConfig('MailOrderList') > 0) { // Yes, should we tick the speical offers & discounts checkbox by default? if (GetConfig('MailAutomaticallyTickOrderBox')) { $GLOBALS['OrderBoxIsTicked'] = 'checked="checked"'; } } else { $GLOBALS['HideOrderCheckBox'] = "none"; } if (isset($_REQUEST['ordercomments'])) { $GLOBALS['OrderComments'] = $_REQUEST['ordercomments']; } // Now we check if we have an incoming coupon or gift certificate code to apply if (isset($_REQUEST['couponcode']) && $_REQUEST['couponcode'] != '') { $code = trim($_REQUEST['couponcode']); // Were we passed a gift certificate code? if (isc_strlen($code) == GIFT_CERTIFICATE_LENGTH && gzte11(ISC_LARGEPRINT)) { $cart = GetClass('ISC_MAKEAOFFER'); if ($cart->api->ApplyGiftCertificate($code)) { // If successful show a message $GLOBALS['CheckoutSuccessMsg'] = GetLang('GiftCertificateAppliedToCart'); } else { $GLOBALS['CheckoutErrorMsg'] = implode('<br />', $cart->api->GetErrors()); } } else { $cart = GetClass('ISC_MAKEAOFFER'); if ($cart->api->ApplyCoupon($code)) { $cart->api->ReapplyCouponsFromCart(); //Added by Simha temp fix to avoid having multiple times coupon for same item $cart->api->UpdateCartInformation(); // Coupon code applied successfully $GLOBALS['CheckoutSuccessMsg'] = GetLang('CouponAppliedToCart'); } else { $GLOBALS['CheckoutErrorMsg'] = implode('<br />', $cart->api->GetErrors()); } } } $GLOBALS['ISC_CLASS_ACCOUNT'] = GetClass('ISC_ACCOUNT'); // Determine what we'll be showing for the redeem gift certificate/coupon code box if (gzte11(ISC_LARGEPRINT)) { $GLOBALS['RedeemTitle'] = GetLang('RedeemGiftCertificateOrCoupon'); $GLOBALS['RedeemIntro'] = GetLang('RedeemGiftCertificateorCouponIntro'); } else { $GLOBALS['RedeemTitle'] = GetLang('RedeemCouponCode'); $GLOBALS['RedeemIntro'] = GetLang('RedeemCouponCodeIntro'); } $GLOBALS['HideCheckoutError'] = "none"; $GLOBALS['HidePaymentOptions'] = ""; $GLOBALS['HideUseCoupon'] = ''; // if the provider list html is set in session then use it as the payment provider options. // it's normally set in payment modules when it's required. if (isset($_SESSION['CHECKOUT']['ProviderListHTML'])) { $GLOBALS['HidePaymentProviderList'] = ""; $GLOBALS['HidePaymentOptions'] = ""; $GLOBALS['PaymentProviders'] = $_SESSION['CHECKOUT']['ProviderListHTML']; $GLOBALS['StoreCreditPaymentProviders'] = $_SESSION['CHECKOUT']['ProviderListHTML']; $GLOBALS['CheckoutWith'] = ""; } else { // Get a list of checkout providers $checkoutProviders = GetCheckoutModulesThatCustomerHasAccessTo(true); // If no checkout providers are set up, send an email to the store owner and show an error message if (empty($checkoutProviders)) { $GLOBALS['HideConfirmOrderPage'] = "none"; $GLOBALS['HideCheckoutError'] = ''; $GLOBALS['HideTopPaymentButton'] = "none"; $GLOBALS['HidePaymentProviderList'] = "none"; $GLOBALS['CheckoutErrorMsg'] = GetLang('NoCheckoutProviders'); $GLOBALS['NoCheckoutProvidersError'] = sprintf(GetLang("NoCheckoutProvidersErrorLong"), $GLOBALS['ShopPath']); $GLOBALS['EmailHeader'] = GetLang("NoCheckoutProvidersSubject"); $GLOBALS['EmailMessage'] = sprintf(GetLang("NoCheckoutProvidersErrorLong"), $GLOBALS['ShopPath']); $emailTemplate = FetchEmailTemplateParser(); $emailTemplate->SetTemplate("general_email"); $message = $emailTemplate->ParseTemplate(true); require_once ISC_BASE_PATH . "/lib/email.php"; $obj_email = GetEmailClass(); $obj_email->Set('CharSet', GetConfig('CharacterSet')); $obj_email->From(GetConfig('OrderEmail'), GetConfig('StoreName')); $obj_email->Set("Subject", GetLang("NoCheckoutProvidersSubject")); $obj_email->AddBody("html", $message); $obj_email->AddRecipient(GetConfig('AdminEmail'), "", "h"); $email_result = $obj_email->Send(); } else { if (count($checkoutProviders) > 1) { $GLOBALS['HideTopPaymentButton'] = "none"; $GLOBALS['HideCheckoutError'] = "none"; } else { $GLOBALS['HidePaymentProviderList'] = "none"; $GLOBALS['HideCheckoutError'] = "none"; $GLOBALS['HidePaymentOptions'] = "none"; list(, $provider) = each($checkoutProviders); if (method_exists($provider['object'], 'ShowPaymentForm') && !isset($_SESSION['CHECKOUT']['ProviderListHTML'])) { $GLOBALS['ExpressCheckoutLoadPaymentForm'] = 'ExpressCheckout.ShowSingleMethodPaymentForm();'; } if ($provider['object']->GetPaymentType() == PAYMENT_PROVIDER_OFFLINE) { $GLOBALS['PaymentButtonSwitch'] = "ShowContinueButton();"; } $GLOBALS['CheckoutWith'] = $provider['object']->GetDisplayName(); } } // Build the list of payment provider options $GLOBALS['PaymentProviders'] = $GLOBALS['StoreCreditPaymentProviders'] = ""; foreach ($checkoutProviders as $provider) { $GLOBALS['ProviderChecked'] = ''; if (count($checkoutProviders) == 1) { $GLOBALS['ProviderChecked'] = 'checked="checked"'; } $GLOBALS['ProviderId'] = $provider['object']->GetId(); $GLOBALS['ProviderName'] = isc_html_escape($provider['object']->GetDisplayName()); $GLOBALS['ProviderType'] = $provider['object']->GetPaymentType("text"); if (method_exists($provider['object'], 'ShowPaymentForm')) { $GLOBALS['ProviderPaymentFormClass'] = 'ProviderHasPaymentForm'; } else { $GLOBALS['ProviderPaymentFormClass'] = ''; } $GLOBALS['PaymentFieldPrefix'] = ''; $GLOBALS['PaymentProviders'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CheckoutProviderOption"); $GLOBALS['PaymentFieldPrefix'] = 'credit_'; $GLOBALS['StoreCreditPaymentProviders'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CheckoutProviderOption"); } } // Are we coming back to this page for a particular reason? if (isset($_SESSION['REDIRECT_TO_CONFIRMATION_MSG'])) { $GLOBALS['HideCheckoutError'] = ''; $GLOBALS['CheckoutErrorMsg'] = $_SESSION['REDIRECT_TO_CONFIRMATION_MSG']; unset($_SESSION['REDIRECT_TO_CONFIRMATION_MSG']); } // Get a summary of the order $orderSummary = $this->CalculateOrderSummary(); // Start building the summary of all of the items in the order $GLOBALS['SNIPPETS']['CartItems'] = ''; /* Baskaran */ $compprice = 0; $comptotal = 0; /* Code Ends */ foreach ($orderSummary['products'] as $cartKey => $product) { $GLOBALS['ProductQuantity'] = $product['quantity']; $GLOBALS['ProductPrice'] = CurrencyConvertFormatPrice($product['price']); $GLOBALS['ProductTotal'] = CurrencyConvertFormatPrice($product['total']); // If the item in the cart is a gift certificate, we need to show a special type of row if (isset($product['type']) && $product['type'] == "giftcertificate") { $GLOBALS['GiftCertificateName'] = isc_html_escape($product['data']['prodname']); $GLOBALS['GiftCertificateTo'] = isc_html_escape($product['certificate']['to_name']); //$GLOBALS['SNIPPETS']['CartItems'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CheckoutCartItemGiftCertificate"); } else { $GLOBALS['ProductAvailability'] = isc_html_escape($product['data']['prodavailability']); $GLOBALS['ItemId'] = $product['data']['productid']; // If this is a discounted price (from a coupon) override the product price to the was/now version if (isset($product['discount_price']) && $product['discount_price'] != $product['original_price']) { $GLOBALS['ProductPrice'] = sprintf("<s class='CartStrike'>%s</s> %s", CurrencyConvertFormatPrice($product['original_price']), CurrencyConvertFormatPrice($product['price'])); } // Is this product a variation? $GLOBALS['ProductOptions'] = ''; if (isset($product['options']) && !empty($product['options'])) { $GLOBALS['ProductOptions'] .= "<br /><small>("; $comma = ''; foreach ($product['options'] as $name => $value) { if (!trim($name) || !trim($value)) { continue; } $GLOBALS['ProductOptions'] .= $comma . isc_html_escape($name) . ": " . isc_html_escape($value); $comma = ', '; } $GLOBALS['ProductOptions'] .= ")</small>"; } $GLOBALS['EventDate'] = ''; if (isset($product['event_date'])) { $GLOBALS['EventDate'] = '<div style="font-style: italic; font-size:11px; padding-left:10px">' . $product['event_name'] . ': ' . isc_date('M jS Y', $product['event_date']) . '</div>'; } $GLOBALS['HideGiftWrapping'] = 'display: none'; $GLOBALS['HideGiftMessagePreview'] = 'display: none'; $GLOBALS['GiftWrappingName'] = ''; $GLOBALS['GiftMessagePreview'] = ''; if (isset($product['wrapping_name'])) { $GLOBALS['HideGiftWrapping'] = ''; $GLOBALS['GiftWrappingName'] = isc_html_escape($product['wrapping_name']); if (isset($product['wrapping_message'])) { if (isc_strlen($product['wrapping_message']) > 30) { $product['wrapping_message'] = substr($product['wrapping_message'], 0, 27) . '...'; } $GLOBALS['GiftMessagePreview'] = isc_html_escape($product['wrapping_message']); if ($product['wrapping_message']) { $GLOBALS['HideGiftMessagePreview'] = ''; } } } //create configurable product fields on order confirmation page with the data posted from add to cart page $GLOBALS['CartProductFields'] = ''; if (isset($product['productFields'])) { require_once ISC_BASE_PATH . '/includes/display/OfferContent.php'; ISC_MAKEAOFFERCONTENT_PANEL::GetProductFieldDetails($product['productFields'], $cartKey); } $GLOBALS['ProductName'] = isc_html_escape($product['data']['prodname']); $GLOBALS['ProductQuantity'] = 1; $GLOBALS['ProductPrice'] = CurrencyConvertFormatPrice($_SESSION['the_offered_price']); $GLOBALS['ProductTotal'] = $GLOBALS['ProductPrice']; $GLOBALS['SNIPPETS']['CartItems'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CheckoutCartItem"); } } // Do we have a shipping price to show? if ($orderSummary['digitalOrder'] == 0) { $GLOBALS['ShippingCost'] = CurrencyConvertFormatPrice($orderSummary['shippingCost']); $GLOBALS['ShippingMethod'] = sprintf("%s %s %s", isc_html_escape($orderSummary['shippingProvider']), GetLang('For'), $GLOBALS['ShippingCost']); $GLOBALS['HideShoppingCartShippingCost'] = ''; $GLOBALS['ShippingProvider'] = isc_html_escape($orderSummary['shippingProvider']); if (count($orderSummary['shippingAddresses']) == 1) { $address = current($orderSummary['shippingAddresses']); $GLOBALS['ShippingAddress'] = $GLOBALS['ISC_CLASS_ACCOUNT']->FormatShippingAddress($address); } else { if (count($orderSummary['shippingAddresses']) > 1) { $GLOBALS['ShippingAddress'] = '<em>(Order will be shipped to multiple addresses)</em>'; } else { $GLOBALS['ShippingAddress'] = GetLang('NA'); } } // Show the shipping details $GLOBALS['HideShippingDetails'] = ''; } else { $GLOBALS['HideShippingDetails'] = 'display: none'; $GLOBALS['HideShoppingCartShippingCost'] = 'none'; $GLOBALS['ShippingAddress'] = GetLang('NotRequiredForDigitalDownloads'); $GLOBALS['ShippingMethod'] = GetLang('ShippingImmediateDownload'); } if (isset($orderSummary['billingAddressId'])) { $GLOBALS['BillingAddress'] = $GLOBALS['ISC_CLASS_ACCOUNT']->GetAndFormatShippingAddressById($orderSummary['billingAddressId']); } else { $GLOBALS['BillingAddress'] = $GLOBALS['ISC_CLASS_ACCOUNT']->FormatShippingAddress($orderSummary['billingAddress']); } // Do we have a handling cost to show? if (isset($orderSummary['handlingCost']) && $orderSummary['handlingCost'] > 0) { $GLOBALS['HandlingCost'] = CurrencyConvertFormatPrice($orderSummary['handlingCost']); } else { $GLOBALS['HideShoppingCartHandlingCost'] = 'none'; } // Format the item total $GLOBALS['ItemTotal'] = CurrencyConvertFormatPrice($orderSummary['itemTotal']); if ($orderSummary['wrappingCost'] > 0) { $GLOBALS['GiftWrappingTotal'] = CurrencyConvertFormatPrice($orderSummary['wrappingCost']); } else { $GLOBALS['HideGiftWrappingTotal'] = 'display: none'; } // Hide everything related to tax by default $GLOBALS['HideShoppingCartTaxCost'] = "none"; $GLOBALS['HideShoppingCartIncludedTaxCost'] = "none"; // Do we have any tax we need to show? if ($orderSummary['taxCost'] > 0) { $taxLines = ""; $taxLang = ""; if ($orderSummary['taxIncluded']) { $taxLang = "Included"; } // get the taxes from the addresses and merge them if they are from the same tax rate $taxes = array(); foreach ($orderSummary['vendors'] as $vendorId => $addresses) { foreach ($addresses as $addressId => $addressInfo) { $taxId = $addressInfo['taxId']; if (isset($taxes[$taxId])) { $taxes[$taxId]['taxCost'] += $addressInfo['taxCost']; } else { $taxes[$taxId] = array('taxName' => $addressInfo['taxName'], 'taxCost' => $addressInfo['taxCost'], 'taxRate' => $addressInfo['taxRate']); } } } $GLOBALS['SNIPPETS']['TaxLines'] = ""; // generate lines for each tax rate foreach ($taxes as $taxId => $tax) { $GLOBALS['TaxName'] = isc_html_escape(sprintf(GetLang($taxLang . 'TaxLine'), $tax['taxName'], $tax['taxRate'] / 1)); $GLOBALS['TaxCost'] = CurrencyConvertFormatPrice($tax['taxCost']); $taxLines .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CheckoutTaxLine"); } // if more than one tax rate is used, display a total line if (count($taxes) > 1) { $GLOBALS['TaxName'] = isc_html_escape(GetLang($taxLang . 'TotalTax')); $GLOBALS['TaxCost'] = CurrencyConvertFormatPrice($orderSummary['taxCost']); $taxLines .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CheckoutTaxLine"); } $GLOBALS['SNIPPETS']['TaxLines'] = ""; $GLOBALS['SNIPPETS']['IncludedTax'] = ""; // are we displaying the tax before the total or after as included tax? if ($orderSummary['taxIncluded']) { $GLOBALS['SNIPPETS']['IncludedTax'] = $taxLines; } else { $GLOBALS['SNIPPETS']['TaxLines'] = $taxLines; } } // Format the grand total of the order $GLOBALS['ItemTotal'] = CurrencyConvertFormatPrice($_SESSION['the_offered_price']); $GLOBALS['TotalCost'] = CurrencyConvertFormatPrice($_SESSION['the_offered_price'] + $orderSummary['shippingCost']); $_SESSION['makeaoffertotal'] = $GLOBALS['TotalCost']; $GLOBALS['HideAdjustedTotal'] = "none"; $GLOBALS['SNIPPETS']['GiftCertificates'] = ''; if ($orderSummary['adjustedTotal'] != $orderSummary['total']) { $GLOBALS['HideAdjustedTotal'] = ''; $GLOBALS['AdjustedTotalCost'] = $orderSummary['adjustedTotal']; } $GLOBALS['SNIPPETS']['Coupons'] = ''; if (count($orderSummary['coupons'])) { foreach ($orderSummary['coupons'] as $coupon) { $GLOBALS['CouponId'] = $coupon['couponid']; $GLOBALS['CouponCode'] = $coupon['couponcode']; // percent coupon if ($coupon['coupontype'] == 1) { $discount = $coupon['discount'] . "%"; } else { $discount = CurrencyConvertFormatPrice($coupon['discount']); } $GLOBALS['CouponDiscount'] = $discount; $GLOBALS['SNIPPETS']['Coupons'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ConfirmOrderCoupon"); } } // If we have any gift certificates, list those too if (!empty($orderSummary['giftCertificates'])) { foreach ($orderSummary['giftCertificates'] as $certificate) { $GLOBALS['GiftCertificateCode'] = isc_html_escape($certificate['giftcertcode']); $GLOBALS['GiftCertificateId'] = $certificate['giftcertid']; $GLOBALS['GiftCertificateBalance'] = CurrencyConvertFormatPrice($certificate['giftcertbalance']); $GLOBALS['GiftCertificateRemaining'] = CurrencyConvertFormatPrice($certificate['balanceremaining']); $GLOBALS['CertificateAmountUsed'] = CurrencyConvertFormatPrice($certificate['amountused']); $GLOBALS['SNIPPETS']['GiftCertificates'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ConfirmOrderGiftCertificate"); } } // If the order total comes to $0.00, then we don't show the payment options and a lot of other things (because they have nothing to pay) if ($orderSummary['adjustedTotal'] == 0) { $GLOBALS['HidePaymentOptions'] = "none"; $GLOBALS['HideUseCoupon'] = 'none'; $GLOBALS['HidePaymentProviderList'] = "none"; $GLOBALS['PaymentButtonSwitch'] = "ShowContinueButton(); ExpressCheckout.UncheckPaymentProvider();"; } // Does the customer have any store credit they can use? $GLOBALS['HideUseStoreCredit'] = "none"; $GLOBALS['HideRemainingStoreCredit'] = "none"; $customer = $GLOBALS['ISC_CLASS_CUSTOMER']->GetCustomerDataByToken(); if ($customer['custstorecredit'] > 0) { $GLOBALS['HidePaymentOptions'] = ""; $GLOBALS['StoreCredit'] = CurrencyConvertFormatPrice($customer['custstorecredit']); $GLOBALS['HideUseStoreCredit'] = ""; $GLOBALS['HidePaymentProviderList'] = "none"; // The customer has enough store credit to pay for the entirity of this order if ($customer['custstorecredit'] >= $orderSummary['adjustedTotal']) { $GLOBALS['PaymentButtonSwitch'] = "ShowContinueButton();"; $GLOBALS['HideLimitedCreditWarning'] = "none"; $GLOBALS['HideLimitedCreditPaymentOption'] = "none"; $GLOBALS['HideCreditPaymentMethods'] = "none"; $GLOBALS['RemainingCredit'] = $customer['custstorecredit'] - $orderSummary['adjustedTotal']; if ($GLOBALS['RemainingCredit'] > 0) { $GLOBALS['HideRemainingStoreCredit'] = ''; $GLOBALS['RemainingCredit'] = CurrencyConvertFormatPrice($GLOBALS['RemainingCredit']); } } else { $GLOBALS['Remaining'] = CurrencyConvertFormatPrice($orderSummary['adjustedTotal'] - $customer['custstorecredit']); if (count($checkoutProviders) == 1) { $GLOBALS['CheckoutStoreCreditWarning'] = sprintf(GetLang('CheckoutStoreCreditWarning2'), $GLOBALS['Remaining'], $GLOBALS['CheckoutWith']); $GLOBALS['HideLimitedCreditPaymentOption'] = "none"; } else { $GLOBALS['CheckoutStoreCreditWarning'] = GetLang('CheckoutStoreCreditWarning'); } $GLOBALS['ISC_LANG']['CreditPaymentMethod'] = sprintf(GetLang('CreditPaymentMethod'), $GLOBALS['Remaining']); } if (count($checkoutProviders) > 1) { $GLOBALS['CreditAlt'] = GetLang('CheckoutCreditAlt'); } else { if (count($checkoutProviders) <= 1 && isset($GLOBALS['CheckoutWith'])) { $GLOBALS['CreditAlt'] = sprintf(GetLang('CheckoutCreditAltOneMethod'), $GLOBALS['CheckoutWith']); } else { if ($customer['custstorecredit'] >= $orderSummary['adjustedTotal']) { $GLOBALS['HideCreditAltOptionList'] = "none"; $GLOBALS['HideConfirmOrderPage'] = ""; $GLOBALS['HideTopPaymentButton'] = "none"; $GLOBALS['HideCheckoutError'] = "none"; $GLOBALS['CheckoutErrorMsg'] = ''; } } } } // Customer has hit this page before. Delete the existing pending order // The reason we do a delete is if they're hitting this page again, something // has changed with their order or something has become invalid with it along the way. if (isset($_COOKIE['SHOP_ORDER_TOKEN'])) { $query = "\n\t\t\t\tSELECT orderid\n\t\t\t\tFROM [|PREFIX|]offers\n\t\t\t\tWHERE ordtoken='" . $GLOBALS['ISC_CLASS_DB']->Quote($_COOKIE['SHOP_ORDER_TOKEN']) . "' AND ordstatus=0\n\t\t\t"; $result = $GLOBALS['ISC_CLASS_DB']->Query($query); while ($offer = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) { if ($offer['orderid']) { $this->DeletePendingOffer($offer['orderid']); } } } // Are we showing an error message? if (isset($GLOBALS['CheckoutErrorMsg']) && $GLOBALS['CheckoutErrorMsg'] != '') { $GLOBALS['HideCheckoutError'] = ''; } else { $GLOBALS['HideCheckoutError'] = "none"; } // Is there a success message to show? if (isset($GLOBALS['CheckoutSuccessMsg']) && $GLOBALS['CheckoutSuccessMsg'] != '') { $GLOBALS['HideCheckoutSuccess'] = ''; } else { $GLOBALS['HideCheckoutSuccess'] = "none"; } // Save the information about the pending order in the checkout session, we'll be using it when they visit the next page $_SESSION['CHECKOUT']['PENDING_DATA'] = array("ITEM_TOTAL" => $orderSummary['itemTotal'], "TAX_COST" => number_format($orderSummary['taxCost'], GetConfig('DecimalPlaces'), ".", ""), "TAX_INCLUDED" => $orderSummary['taxIncluded'], "ORDER_TOTAL" => number_format($orderSummary['total'] - $GLOBALS['ISC_CLASS_MAKEAOFFER']->api->Get('SUBTOTAL_DISCOUNT'), GetConfig('DecimalPlaces'), ".", ""), "GATEWAY_AMOUNT" => number_format($orderSummary['adjustedTotal'], GetConfig('DecimalPlaces'), ".", ""), "GIFTCERTIFICATE_AMOUNT" => number_format($orderSummary['giftCertificateTotal'], GetConfig('DecimalPlaces'), ".", "")); // Store information about each vendor in the order foreach ($orderSummary['vendors'] as $vendorId => $addressInfo) { foreach ($addressInfo as $addressId => $vendorInfo) { $_SESSION['CHECKOUT']['PENDING_DATA']['VENDORS'][$vendorId . '_' . $addressId] = array('ITEM_TOTAL' => $vendorInfo['itemTotal'], 'TAX_COST' => number_format($vendorInfo['taxCost'], GetConfig('DecimalPlaces'), ".", ""), 'TAX_RATE' => number_format($vendorInfo['taxRate'], GetConfig('DecimalPlaces'), ".", ""), 'TAX_NAME' => $vendorInfo['taxName'], 'ORDER_TOTAL' => number_format($vendorInfo['total'] - $GLOBALS['ISC_CLASS_MAKEAOFFER']->api->Get('SUBTOTAL_DISCOUNT'), GetConfig('DecimalPlaces'), ".", "")); } } // If this is an anonymous checkout, save that if (isset($_POST['anonymousCheckout'])) { $_SESSION['CHECKOUT']['PENDING_DATA']['GUEST_CHECKOUT'] = 1; } else { $_SESSION['CHECKOUT']['PENDING_DATA']['GUEST_CHECKOUT'] = 0; } // Checkout out as a new customer and wishing to create an account, we need to save those details if (!CustomerIsSignedIn()) { if (isset($_POST['createAccount']) || GetConfig('GuestCheckoutCreateAccounts')) { // If we're automatically creating accounts, assign the user a random password $autoAccount = 0; if (isset($_POST['billing_Password'])) { $password = $_POST['billing_Password']; } if (!isset($_POST['createAccount']) && GetConfig('GuestCheckoutCreateAccounts')) { $password = substr(md5(uniqid(true)), 0, 8); $autoAccount = 1; } if (!isset($_SESSION['CHECKOUT']['CREATE_ACCOUNT']) && isset($_POST['billing_EmailAddress'])) { $_SESSION['CHECKOUT']['CREATE_ACCOUNT'] = 1; $_SESSION['CHECKOUT']['ACCOUNT_DETAILS'] = array('email' => $_POST['billing_EmailAddress'], 'password' => $password, 'firstname' => $_POST['billing_FirstName'], 'lastname' => $_POST['billing_LastName'], 'company' => $_POST['billing_CompanyName'], 'phone' => $_POST['billing_Phone'], 'autoAccount' => $autoAccount); } } else { unset($_SESSION['CHECKOUT']['CREATE_ACCOUNT']); unset($_SESSION['CHECKOUT']['ACCOUNT_DETAILS']); } } else { unset($_SESSION['CHECKOUT']['CREATE_ACCOUNT']); unset($_SESSION['CHECKOUT']['ACCOUNT_DETAILS']); } if (GetConfig('EnableOrderComments') == 1) { $GLOBALS['HideOrderComments'] = ""; } else { $GLOBALS['HideOrderComments'] = "none"; } if ($GLOBALS['ISC_CLASS_MAKEAOFFER']->api->Get('SUBTOTAL_DISCOUNT') == 0) { $GLOBALS['HideOrderDiscount'] = "display : none"; } else { $GLOBALS['OrderDiscount'] = CurrencyConvertFormatPrice($GLOBALS['ISC_CLASS_MAKEAOFFER']->api->Get('SUBTOTAL_DISCOUNT')); $GLOBALS['HideOrderDiscount'] = ""; } if (GetConfig('EnableOrderTermsAndConditions') == 1) { $GLOBALS['HideOrderTermsAndConditions'] = ""; if (GetConfig('OrderTermsAndConditionsType') == "link") { $GLOBALS['AgreeTermsAndConditions'] = GetLang('YesIAgree'); $GLOBALS['TermsAndConditionsLink'] = "<a href='" . GetConfig('OrderTermsAndConditionsLink') . "' target='_BLANK'>" . strtolower(GetLang('TermsAndConditions')) . "</a>."; $GLOBALS['HideTermsAndConditionsTextarea'] = "display:none;"; } else { $GLOBALS['HideTermsAndConditionsTextarea'] = ''; $GLOBALS['OrderTermsAndConditions'] = GetConfig('OrderTermsAndConditions'); $GLOBALS['AgreeTermsAndConditions'] = GetLang('AgreeTermsAndConditions'); $GLOBALS['TermsAndConditionsLink'] = ''; } } else { $GLOBALS['HideOrderTermsAndConditions'] = "display:none;"; } $GLOBALS['AdjustedTotalCost'] = CurrencyConvertFormatPrice($orderSummary['adjustedTotal']); }