public function SetPanelSettings()
 {
     $GLOBALS['ISC_CLASS_CUSTOMER'] = GetClass('ISC_CUSTOMER');
     $customerid = $GLOBALS['ISC_CLASS_CUSTOMER']->GetCustomerId();
     if (gzte11(ISC_LARGEPRINT)) {
         // Get the number of new messages for this customer
         $order_ids = "";
         $query = sprintf("select orderid from [|PREFIX|]orders where ordcustid='%d'", $GLOBALS['ISC_CLASS_DB']->Quote($customerid));
         $result = $GLOBALS['ISC_CLASS_DB']->Query($query);
         while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
             $order_ids .= sprintf("%s,", $row['orderid']);
         }
         $order_ids = rtrim($order_ids, ",");
         if ($order_ids != "") {
             $query = sprintf("select count(messageid) as num from [|PREFIX|]order_messages where messageorderid in (%s) and messagefrom='admin' and messagestatus='unread'", $GLOBALS['ISC_CLASS_DB']->Quote($order_ids));
             $GLOBALS['NumNewMessages'] = $GLOBALS['ISC_CLASS_DB']->FetchOne($query);
         } else {
             $GLOBALS['NumNewMessages'] = 0;
         }
     } else {
         $GLOBALS['HideMessagesMenu'] = "none";
     }
     // Do we want to show or hide the return requests menu item?
     if (gzte11(ISC_LARGEPRINT) && GetConfig('EnableReturns') == 1) {
         $query = sprintf("SELECT returnid FROM [|PREFIX|]returns WHERE retcustomerid='%d'", $GLOBALS['ISC_CLASS_DB']->Quote($customerid));
         if (!$GLOBALS['ISC_CLASS_DB']->FetchOne($query)) {
             $GLOBALS['HideReturnRequestsMenu'] = "none";
         }
     } else {
         $GLOBALS['HideReturnRequestsMenu'] = 'none';
     }
     // How many products are in their wish list?
     $query = sprintf("select count(wishlistid) as num from [|PREFIX|]wishlists where customerid='%d'", $GLOBALS['ISC_CLASS_DB']->Quote($customerid));
     $GLOBALS['NumWishListItems'] = $GLOBALS['ISC_CLASS_DB']->FetchOne($query);
 }
Example #2
0
	public function __construct()
	{
		$GLOBALS['ISC_CLASS_ADMIN_ENGINE']->LoadLangFile('batch.importer');

		/**
		 * @var array Array of importable fields and their friendly names.
		 */
		$this->_ImportFields = array(
			"productid" => GetLang('ProductID'),
			"prodcode" => GetLang('ProductCodeSKU'),
			"prodname" => GetLang('ProductName'),
			"prodvarsku" => GetLang('ProductVarSKU'),
			"prodvarprice" => GetLang('ProductVarPrice'),
			"prodvarweight" => GetLang('ProductVarWeight'),
			"prodvarimage" => GetLang('ProductVarImage'),
			"prodvarstock" => GetLang('ProductVarStock'),
			"prodvarlowstock" => GetLang('ProductVarLowStock')
		);

		if($GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId() == 0 && gzte11(ISC_HUGEPRINT)) {
			$this->_ImportFields['prodvendorid'] = GetLang('Vendor');
		}

		$this->productEntity = new ISC_ENTITY_PRODUCT();

		parent::__construct();
	}
Example #3
0
		public function SetPanelSettings()
		{
			$GLOBALS['ISC_CLASS_CUSTOMER'] = GetClass('ISC_CUSTOMER');
			$customerid = $GLOBALS['ISC_CLASS_CUSTOMER']->GetCustomerId();

			if(gzte11(ISC_LARGEPRINT)) {
				// Get the number of new messages for this customer
				$query = "
					SELECT
					COUNT(*)
					FROM [|PREFIX|]orders o, [|PREFIX|]order_messages om
					WHERE o.ordcustid = " . (int)$customerid . " AND o.deleted = 0 AND om.messageorderid = o.orderid AND om.messagefrom = 'admin' AND messagestatus = 'unread'
				";
				$GLOBALS['NumNewMessages'] = (int)$GLOBALS['ISC_CLASS_DB']->FetchOne($query);
			}
			else {
				$GLOBALS['HideMessagesMenu'] = "none";
			}

			// Do we want to show or hide the return requests menu item?
			if(gzte11(ISC_LARGEPRINT) && GetConfig('EnableReturns') == 1) {
				$query = sprintf("SELECT returnid FROM [|PREFIX|]returns WHERE retcustomerid='%d'", $GLOBALS['ISC_CLASS_DB']->Quote($customerid));
				if(!$GLOBALS['ISC_CLASS_DB']->FetchOne($query)) {
					$GLOBALS['HideReturnRequestsMenu'] = "none";
				}
			}
			else {
				$GLOBALS['HideReturnRequestsMenu'] = 'none';
			}

			// How many products are in their wish list?
			$query = sprintf("select count(wishlistid) as num from [|PREFIX|]wishlists where customerid='%d'", $GLOBALS['ISC_CLASS_DB']->Quote($customerid));
			$GLOBALS['NumWishListItems'] = $GLOBALS['ISC_CLASS_DB']->FetchOne($query);
		}
 public function SetPanelSettings()
 {
     if (!gzte11(ISC_HUGEPRINT)) {
         $this->DontDisplay = true;
         return false;
     }
     $output = "";
     // Get the link to the 'all vendors' page
     $GLOBALS['AllVendorsLink'] = VendorLink();
     // Get the 10 most popular vendors
     $query = "\n\t\t\tSELECT vendorid, vendorname, vendorfriendlyname\n\t\t\tFROM [|PREFIX|]vendors\n\t\t\tORDER BY vendornumsales DESC, vendorname ASC\n\t\t";
     $query .= $GLOBALS['ISC_CLASS_DB']->AddLimit(0, 11);
     // Fetch 10 + 1 - so that way we can determine if we need the all vendors link
     $result = $GLOBALS['ISC_CLASS_DB']->Query($query);
     $x = 1;
     while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
         if ($x <= 10) {
             $GLOBALS['VendorLink'] = VendorLink($row);
             $GLOBALS['VendorName'] = isc_html_escape($row['vendorname']);
             $output .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("PopularVendorsItem");
         }
         ++$x;
     }
     if ($x == 11) {
         $GLOBALS['SNIPPETS']['ShopByVendorAllItem'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("PopularVendorsAllItem");
     }
     if (!$output) {
         $this->DontDisplay = true;
     }
     $GLOBALS['SNIPPETS']['PopularVendorsList'] = $output;
 }
 /**
  * Handle the incoming action.
  *
  * @param string The action to perform.
  */
 public function HandleToDo($do)
 {
     if (!$GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Manage_Vendors)) {
         exit;
     }
     if (!gzte11(ISC_HUGEPRINT)) {
         ob_end_clean();
         header('Location: index.php');
         exit;
     }
     // Set up some generic breadcrumb entries as these will be used on most pages
     $GLOBALS['BreadcrumEntries'] = array(GetLang('Home') => 'index.php', GetLang('VendorPayments') => 'index.php?ToDo=viewVendorPayments');
     switch (strtolower($do)) {
         case 'addvendorpayment':
             $this->AddVendorPayment();
             break;
         case 'savenewvendorpayment':
             $this->SaveNewVendorPayment();
             break;
         case 'exportvendorpayments':
             $this->ExportVendorPayments();
             break;
         case 'deletevendorpayments':
             $this->DeleteVendorPayments();
         default:
             $this->ManageVendorPayments();
             break;
     }
 }
Example #6
0
	public function GetSearches ()
	{
		$query = "
			SELECT searchid, searchname, searchlabel
			FROM [|PREFIX|]custom_searches
			WHERE searchtype='" . $this->db->Quote($this->_searchType) . "'
			ORDER BY searchname ASC
		";

		$result = $this->db->Query($query);
		$rows = array();
		while ($row = $this->db->Fetch($result)) {
			if ($this->_searchType == 'orders' && ($row['searchname'] == 'Orders from eBay' || $row['searchlabel'] == 'ebayorders') && !($GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Ebay_Selling) && gzte11(ISC_LARGEPRINT))) {
				continue;
			}

			if ($this->_searchType == 'orders' && $row['searchlabel'] == 'deletedorders' && GetConfig('DeletedOrdersAction') != 'delete') {
				// don't show deleted orders view if setting not enabled
				continue;
			}

			$rows[] = $row;
		}
		return $rows;
	}
 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();
     }
 }
Example #8
0
 /**
  * The constructor.
  */
 public function __construct()
 {
     $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->LoadLangFile('backups');
     if (!gzte11(ISC_MEDIUMPRINT) || GetConfig('DisableBackupSettings')) {
         exit;
     }
     // If being run by cron, we don't want to show any output
     if (PHP_SAPI == "cli") {
         $this->Verbose = false;
     }
 }
	/**
	* Returns a flat count of all vendors, used for paging purposes
	*
	* @return int
	*/
	public function countAll()
	{
		if (!gzte11(ISC_HUGEPRINT)) {
			return 0;
		}

		$sql = "SELECT COUNT(vendorid) as c FROM `[|PREFIX|]vendors`";
		$result = $GLOBALS['ISC_CLASS_DB']->Query($sql);
		if (!$result) {
			return false;
		}
		return $GLOBALS['ISC_CLASS_DB']->FetchOne($result);
	}
Example #10
0
	public function HandleToDo()
	{
		if(!$GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Ebay_Selling) || !gzte11(ISC_LARGEPRINT)) {
			exit;
		}

		$what = isc_strtolower(@$_REQUEST['w']);

		$methodName = $what . 'Action';
		if(!method_exists($this, $methodName)) {
			exit;
		}

		$this->$methodName();
	}
Example #11
0
 public function HandleToDo($Do)
 {
     if (!gzte11(ISC_MEDIUMPRINT)) {
         $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR);
     }
     switch (isc_strtolower($Do)) {
         default:
             if (!isset($_REQUEST['ajax'])) {
                 $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintHeader();
             }
             $this->ManageFormFields();
             if (!isset($_REQUEST['ajax'])) {
                 $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintFooter();
             }
     }
 }
	public function HandlePage()
	{
		$action = "";
		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 "do_purchase": {
				if($_SERVER['REQUEST_METHOD'] == "POST") {
					$this->DoPurchaseGiftCertificate();
					break;
				}
				else {
					$this->PurchaseGiftCertificate();
				}
			}
			case "balance": {
				$this->CheckGiftCertificateBalance();
				break;
			}
			case "preview": {
				$this->PreviewGiftCertificate();
				break;
			}
			case "redeem": {
				$this->RedeemGiftCertificate();
				break;
			}
			default: {
				$this->PurchaseGiftCertificate();
			}
		}
	}
 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;
     }
     CheckReferrer();
     // checking and assigning the back to search link
     switch ($action) {
         case "do_purchase":
             if ($_SERVER['REQUEST_METHOD'] == "POST") {
                 $this->DoPurchaseGiftCertificate();
                 break;
             } else {
                 $this->PurchaseGiftCertificate();
             }
         case "balance":
             $this->CheckGiftCertificateBalance();
             break;
         case "preview":
             $this->PreviewGiftCertificate();
             break;
         case "redeem":
             $this->RedeemGiftCertificate();
             break;
         default:
             $this->PurchaseGiftCertificate();
     }
 }
Example #14
0
	public function HandleToDo($do)
	{
		$GLOBALS['ISC_CLASS_ADMIN_ENGINE']->LoadLangFile('export');
		$GLOBALS['ISC_CLASS_ADMIN_ENGINE']->LoadLangFile('exporttemplates');

		$this->templates = GetClass('ISC_ADMIN_EXPORTTEMPLATES');
		$this->type = isc_strtolower($_GET['t']);

		// load the file type for this export
		if (!$this->filetype = ISC_ADMIN_EXPORTFILETYPE_FACTORY::GetExportFileType($this->type)) {
			FlashMessage(GetLang("InvalidType"), MSG_ERROR, 'index.php?ToDo=viewExportTemplates');
		}

		// does user have permission to export this type?
		if (!$this->filetype->HasPermission() || !gzte11(ISC_MEDIUMPRINT)) {
			$GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR);
		}

		$details = $this->filetype->GetTypeDetails();
		$title = $details['title'];
		$this->type_title = $title;
		$this->title = sprintf(GetLang("ExportTitle"), $title);

		switch (isc_strtolower($do)) {
			case 'startexport':
				$GLOBALS['BreadcrumEntries'] = array(GetLang('Home') => "index.php", $title => $details['viewlink'], GetLang('Export') => "");

				if (!isset($_REQUEST['ajax'])) {
					$GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintHeader();
				}

				$this->StartExport();

				if (!isset($_REQUEST['ajax'])) {
					$GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintFooter();
				}

				break;
			case 'runexport':
				$GLOBALS['BreadcrumEntries'] = array(GetLang('Home') => "index.php", GetLang('Export') => "", $title => "");

				$GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintHeader();
				$this->RunExport();
				$GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintFooter();
		}
	}
Example #15
0
	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'] = "";
	}
Example #16
0
 /**
  * Handle the incoming page request.
  */
 public function HandlePage()
 {
     if (!gzte11(ISC_HUGEPRINT)) {
         exit;
     }
     $this->SetVendorData();
     if ($this->displaying == 'products') {
         $this->ShowVendorProducts();
     } else {
         if ($this->displaying == 'page') {
             $this->ShowVendorPage();
         } else {
             if ($this->displaying == 'profile') {
                 $this->ShowVendorProfile();
             } else {
                 $this->ShowVendors();
             }
         }
     }
 }
 /**
  * Handle the action for this section.
  *
  * @param string The name of the action to do.
  */
 public function HandleToDo($Do)
 {
     if (isset($_REQUEST['currentTab'])) {
         $GLOBALS['CurrentTab'] = (int) $_REQUEST['currentTab'];
     } else {
         $GLOBALS['CurrentTab'] = 0;
     }
     $GLOBALS['BreadcrumEntries'] = array(GetLang('Home') => "index.php", GetLang('Settings') => "index.php?ToDo=viewSettings", GetLang('OrderSettings') => "index.php?ToDo=viewScriptSettings");
     if (!$GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Manage_Settings) || !gzte11(ISC_MEDIUMPRINT)) {
         $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR);
         return;
     }
     /**
      * Load the language file
      */
     $lang = 'en';
     if (strpos(GetConfig('Language'), '/') === false) {
         $lang = GetConfig('Language');
     }
     switch (isc_strtolower($Do)) {
         case "viewscriptsettings":
             $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintHeader();
             $this->ManageOrderSettings();
             $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintFooter();
             break;
         case "saveupdatedscriptsettings":
             $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintHeader();
             $this->SaveUpdatedOrderSettings();
             $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintFooter();
             break;
         default:
             if (!isset($_REQUEST['ajax'])) {
                 $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintHeader();
             }
             $this->ManageOrderSettings();
             if (!isset($_REQUEST['ajax'])) {
                 $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintFooter();
             }
             break;
     }
 }
 public function CopyProductStep1($MsgDesc = "", $MsgStatus = "", $PreservePost = false, $OriginalProductID = 0)
 {
     if ($MsgDesc != "") {
         $GLOBALS['Message'] = MessageBox($MsgDesc, $MsgStatus);
     }
     // Show the form to edit a product
     if (isset($_REQUEST['productId']) && isId($_REQUEST['productId'])) {
         $OriginalProductID = $_REQUEST['productId'];
     }
     $prodId = $OriginalProductID;
     $z = 0;
     $arrData = array();
     $arrImages = array();
     $arrCustomFields = array();
     if (GetConfig('CurrencyLocation') == 'right') {
         $GLOBALS['CurrencyTokenLeft'] = '';
         $GLOBALS['CurrencyTokenRight'] = GetConfig('CurrencyToken');
     } else {
         $GLOBALS['CurrencyTokenLeft'] = GetConfig('CurrencyToken');
         $GLOBALS['CurrencyTokenRight'] = '';
     }
     $GLOBALS['ServerFiles'] = $this->_GetImportFilesOptions();
     $GLOBALS['ISC_CLASS_ADMIN_CATEGORY'] = GetClass('ISC_ADMIN_CATEGORY');
     // Make sure the product exists
     if (ProductExists($prodId)) {
         if ($PreservePost == true) {
             $this->_GetProductData(0, $arrData);
             $this->_GetCustomFieldData(0, $arrCustomFields);
             $GLOBALS['ProductFields'] = $this->_GetProductFieldsLayout(0, true);
             // Restore the hash
             $GLOBALS['ProductHash'] = $arrData['prodhash'];
         } else {
             $this->_GetProductData($prodId, $arrData);
             $this->_GetCustomFieldData($prodId, $arrCustomFields);
             $GLOBALS['ProductFields'] = $this->_GetProductFieldsLayout($prodId, true);
             // Generate the hash
             $GLOBALS['ProductHash'] = md5(time() . uniqid(rand(), true));
             // We'll need to duplicate (copy) the thumbnail, images and download files here
             $this->_CopyProductImages($prodId, 0, $GLOBALS['ProductHash']);
             $this->_CopyDownloads($prodId, 0, $GLOBALS['ProductHash']);
             $arrData['prodname'] = GetLang('CopyOf') . $arrData['prodname'];
         }
         // Does this user have permission to edit this product?
         if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId() && $arrData['prodvendorid'] != $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId()) {
             FlashMessage(GetLang('Unauthorized'), MSG_ERROR, 'index.php?ToDo=viewProducts');
         }
         $arrImages = $this->_GetImageData(0, $GLOBALS['ProductHash']);
         if (isset($_POST['currentTab'])) {
             $GLOBALS['CurrentTab'] = (int) $_POST['currentTab'];
         } else {
             $GLOBALS['CurrentTab'] = 0;
         }
         $GLOBALS['FormAction'] = 'copyProduct2';
         $GLOBALS['Title'] = GetLang('CopyProductTitle');
         $GLOBALS['Intro'] = GetLang('CopyProductIntro');
         $GLOBALS["ProdType_" . $arrData['prodtype']] = 'checked="checked"';
         $GLOBALS['ProdType'] = $arrData['prodtype'] - 1;
         $GLOBALS['ProdCode'] = isc_html_escape($arrData['prodcode']);
         $GLOBALS['ProdName'] = isc_html_escape($arrData['prodname']);
         $GLOBALS['OriginalProductId'] = $OriginalProductID;
         $visibleCategories = array();
         if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId()) {
             $vendorData = $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendor();
             if ($vendorData['vendoraccesscats']) {
                 $visibleCategories = explode(',', $vendorData['vendoraccesscats']);
             }
         }
         //				$GLOBALS['CategoryOptions'] = $GLOBALS['ISC_CLASS_ADMIN_CATEGORY']->GetCategoryOptions($arrData['prodcats'], "<option %s value='%d'>%s</option>", "selected='selected'", "", false, '', $visibleCategories);
         $GLOBALS['CategoryOptions'] = $GLOBALS['ISC_CLASS_ADMIN_CATEGORY']->GetCategoryOptionsProduct($arrData['prodcats'], "<option %s value='%d' id='category_old%d'>%s</option>", "selected='selected'", "", false, '', $visibleCategories);
         $GLOBALS['RelatedCategoryOptions'] = $GLOBALS['ISC_CLASS_ADMIN_CATEGORY']->GetCategoryOptions(0, "<option %s value='%d'>%s</option>", "selected='selected'", "- ", false);
         //blessen
         $wysiwygOptions = array('id' => 'wysiwyg', 'width' => '60%', 'height' => '350px', 'value' => $arrData['proddesc']);
         $wysiwygOptions1 = array('id' => 'wysiwyg1', 'width' => '60%', 'height' => '350px', 'value' => $arrData['prodmfg']);
         $wysiwygOptions2 = array('id' => 'wysiwyg2', 'width' => '60%', 'height' => '350px', 'value' => $arrData['prodwarranty']);
         $GLOBALS['WYSIWYG'] = GetClass('ISC_ADMIN_EDITOR')->GetWysiwygEditor($wysiwygOptions);
         $GLOBALS['WYSIWYG1'] = GetClass('ISC_ADMIN_EDITOR')->GetWysiwygEditor1($wysiwygOptions1);
         $GLOBALS['WYSIWYG2'] = GetClass('ISC_ADMIN_EDITOR')->GetWysiwygEditor1($wysiwygOptions2);
         $GLOBALS['ProdSearchKeywords'] = isc_html_escape($arrData['prodsearchkeywords']);
         $GLOBALS['ProdAvailability'] = isc_html_escape($arrData['prodavailability']);
         $GLOBALS['ProdPrice'] = number_format($arrData['prodprice'], GetConfig('DecimalPlaces'), GetConfig('DecimalToken'), "");
         if (CFloat($arrData['prodcostprice']) > 0) {
             $GLOBALS['ProdCostPrice'] = number_format($arrData['prodcostprice'], GetConfig('DecimalPlaces'), GetConfig('DecimalToken'), "");
         }
         if (CFloat($arrData['prodretailprice']) > 0) {
             $GLOBALS['ProdRetailPrice'] = number_format($arrData['prodretailprice'], GetConfig('DecimalPlaces'), GetConfig('DecimalToken'), "");
         }
         if (CFloat($arrData['prodsaleprice']) > 0) {
             $GLOBALS['ProdSalePrice'] = number_format($arrData['prodsaleprice'], GetConfig('DecimalPlaces'), GetConfig('DecimalToken'), "");
         }
         $GLOBALS['ProdSortOrder'] = $arrData['prodsortorder'];
         if ($arrData['prodvisible'] == 1) {
             $GLOBALS['ProdVisible'] = "checked";
         }
         if ($arrData['prodfeatured'] == 1) {
             $GLOBALS['ProdFeatured'] = "checked";
         }
         if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId()) {
             $GLOBALS['HideStoreFeatured'] = 'display: none';
         } else {
             if (!gzte11(ISC_HUGEPRINT) || !$arrData['prodvendorid']) {
                 $GLOBALS['HideVendorFeatured'] = 'display: none';
             }
         }
         if ($arrData['prodvendorfeatured'] == 1) {
             $GLOBALS['ProdVendorFeatured'] = 'checked="checked"';
         }
         if ($arrData['prodistaxable'] == 1) {
             $GLOBALS['ProdIsTaxable'] = 'checked';
         }
         if ($arrData['prodallowpurchases'] == 1) {
             $GLOBALS['ProdAllowPurchases'] = 'checked="checked"';
         } else {
             if ($arrData['prodhideprice'] == 1) {
                 $GLOBALS['ProdHidePrice'] = 'checked="checked"';
             }
             $GLOBALS['ProdCallForPricingLabel'] = isc_html_escape($arrData['prodcallforpricinglabel']);
         }
         $GLOBALS['MoreImages'] = "MoreImages();";
         for ($i = 1; $i <= $arrImages['numImages']; $i++) {
             $image = sprintf("../%s/%s", GetConfig('ImageDirectory'), $arrImages["image" . $i]);
             if ($i == 1) {
                 $GLOBALS["ImageMessage" . $i] = sprintf(GetLang('EditImageDesc'), $image, $arrImages["image" . $i]);
             } else {
                 $GLOBALS["ImageMessage" . $i] = sprintf(GetLang('EditImageDesc2'), $arrImages["id" . $i], $arrImages["id" . $i], $arrImages["id" . $i], $image, $arrImages["image" . $i], $arrImages["id" . $i]);
             }
         }
         if (isset($arrImages['thumb'])) {
             $thumb = sprintf("../%s/%s", GetConfig('ImageDirectory'), $arrImages['thumb']);
             $GLOBALS['ThumbMessage'] = sprintf(GetLang('EditImageDesc'), $thumb, $arrImages['thumb']);
         }
         //blessen
         //$GLOBALS['ProdWarranty'] = $arrData['prodwarranty'];
         //$GLOBALS['prod_instruction'] = $arrData['prod_instruction'];
         //$GLOBALS['prod_article'] = $arrData['prod_article'];
         $GLOBALS['ProdWeight'] = number_format($arrData['prodweight'], GetConfig('DecimalPlaces'), GetConfig('DecimalToken'), "");
         if (CFloat($arrData['prodwidth']) > 0) {
             $GLOBALS['ProdWidth'] = number_format($arrData['prodwidth'], GetConfig('DecimalPlaces'), GetConfig('DecimalToken'), "");
         }
         if (CFloat($arrData['prodheight']) > 0) {
             $GLOBALS['ProdHeight'] = number_format($arrData['prodheight'], GetConfig('DecimalPlaces'), GetConfig('DecimalToken'), "");
         }
         if (CFloat($arrData['proddepth']) > 0) {
             $GLOBALS['ProdDepth'] = number_format($arrData['proddepth'], GetConfig('DecimalPlaces'), GetConfig('DecimalToken'), "");
         }
         if (CFloat($arrData['prodfixedshippingcost']) > 0) {
             $GLOBALS['ProdFixedShippingCost'] = number_format($arrData['prodfixedshippingcost'], GetConfig('DecimalPlaces'), GetConfig('DecimalToken'), "");
         }
         if ($arrData['prodfreeshipping'] == 1) {
             $GLOBALS['FreeShipping'] = 'checked="checked"';
         }
         if ($arrData['prodrelatedproducts'] == -1) {
             $GLOBALS['IsProdRelatedAuto'] = 'checked="checked"';
         } else {
             if (isset($arrData['prodrelated'])) {
                 $GLOBALS['RelatedProductOptions'] = "";
                 foreach ($arrData['prodrelated'] as $r) {
                     $GLOBALS['RelatedProductOptions'] .= sprintf("<option value='%d'>%s</option>", (int) $r[0], isc_html_escape($r[1]));
                 }
             }
         }
         $GLOBALS['ProdTags'] = $arrData['prodtags'];
         $GLOBALS['CurrentStockLevel'] = $arrData['prodcurrentinv'];
         $GLOBALS['LowStockLevel'] = $arrData['prodlowinv'];
         $GLOBALS["InvTrack_" . $arrData['prodinvtrack']] = 'checked="checked"';
         $GLOBALS['WrappingOptions'] = $this->BuildGiftWrappingSelect(explode(',', $arrData['prodwrapoptions']));
         $GLOBALS['HideGiftWrappingOptions'] = 'display: none';
         if ($arrData['prodwrapoptions'] == 0) {
             $GLOBALS['WrappingOptionsDefaultChecked'] = 'checked="checked"';
         } else {
             if ($arrData['prodwrapoptions'] == -1) {
                 $GLOBALS['WrappingOptionsNoneChecked'] = 'checked="checked"';
             } else {
                 $GLOBALS['HideGiftWrappingOptions'] = '';
                 $GLOBALS['WrappingOptionsCustomChecked'] = 'checked="checked"';
             }
         }
         if ($arrData['prodinvtrack'] == 1) {
             $GLOBALS['OptionButtons'] = "ToggleProductInventoryOptions(true);";
         } else {
             $GLOBALS['OptionButtons'] = "ToggleProductInventoryOptions(false);";
         }
         if ($arrData['prodoptionsrequired'] == 1) {
             $GLOBALS['OptionsRequired'] = 'checked="checked"';
         }
         if ($arrData['prodtype'] == 1) {
             $GLOBALS['HideProductInventoryOptions'] = "none";
         }
         $GLOBALS['EnterOptionPrice'] = sprintf(GetLang('EnterOptionPrice'), GetConfig('CurrencyToken'), GetConfig('CurrencyToken'));
         $GLOBALS['EnterOptionWeight'] = sprintf(GetLang('EnterOptionWeight'), GetConfig('WeightMeasurement'));
         $GLOBALS['HideCustomFieldLink'] = "none";
         if (GetConfig('PricesIncludeTax')) {
             $GLOBALS['PriceMsg'] = GetLang('IncTax');
         } else {
             $GLOBALS['PriceMsg'] = GetLang('ExTax');
         }
         $GLOBALS['CustomFields'] = '';
         $GLOBALS['CustomFieldKey'] = 0;
         if (!empty($arrCustomFields)) {
             foreach ($arrCustomFields as $f) {
                 $GLOBALS['CustomFieldName'] = isc_html_escape($f['name']);
                 $GLOBALS['CustomFieldValue'] = isc_html_escape($f['value']);
                 $GLOBALS['CustomFieldLabel'] = $this->GetFieldLabel($GLOBALS['CustomFieldKey'] + 1, GetLang('CustomField'));
                 if (!$GLOBALS['CustomFieldKey']) {
                     $GLOBALS['HideCustomFieldDelete'] = 'none';
                 } else {
                     $GLOBALS['HideCustomFieldDelete'] = '';
                 }
                 $GLOBALS['CustomFields'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet('CustomFields');
                 $GLOBALS['CustomFieldKey']++;
             }
         }
         // Add one more custom field
         $GLOBALS['CustomFieldName'] = '';
         $GLOBALS['CustomFieldValue'] = '';
         $GLOBALS['CustomFieldLabel'] = $this->GetFieldLabel($GLOBALS['CustomFieldKey'] + 1, GetLang('CustomField'));
         if (!$GLOBALS['CustomFieldKey']) {
             $GLOBALS['HideCustomFieldDelete'] = 'none';
         } else {
             $GLOBALS['HideCustomFieldDelete'] = '';
         }
         $GLOBALS['CustomFields'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet('CustomFields');
         if ($this->HasGD()) {
             $GLOBALS['ShowGDThumb'] = "";
             $GLOBALS['ShowNoGDThumb'] = "none";
         } else {
             $GLOBALS['ShowGDThumb'] = "none";
             $GLOBALS['ShowNoGDThumb'] = "";
         }
         // Get a list of any downloads associated with this product
         $GLOBALS['DownloadsGrid'] = $this->GetDownloadsGrid(0, $GLOBALS['ProductHash']);
         $GLOBALS['ISC_LANG']['MaxUploadSize'] = sprintf(GetLang('MaxUploadSize'), GetMaxUploadSize());
         if ($GLOBALS['DownloadsGrid'] == '') {
             $GLOBALS['DisplayDownloaadGrid'] = "none";
         }
         // Get the brands as select options
         $GLOBALS['ISC_CLASS_ADMIN_BRANDS'] = GetClass('ISC_ADMIN_BRANDS');
         $GLOBALS['BrandNameOptions'] = $GLOBALS['ISC_CLASS_ADMIN_BRANDS']->GetBrandsAsOptions($arrData['prodbrandid']);
         $GLOBALS['SaveAndAddAnother'] = GetLang('SaveAndAddAnother');
         // Get a list of all layout files
         $layoutFile = 'product.html';
         if ($arrData['prodlayoutfile'] != '') {
             $layoutFile = $arrData['prodlayoutfile'];
         }
         $GLOBALS['LayoutFiles'] = GetCustomLayoutFilesAsOptions("product.html", $layoutFile);
         $GLOBALS['ProdPageTitle'] = isc_html_escape($arrData['prodpagetitle']);
         $GLOBALS['ProdMetaKeywords'] = isc_html_escape($arrData['prodmetakeywords']);
         $GLOBALS['ProdMetaDesc'] = isc_html_escape($arrData['prodmetadesc']);
         $GLOBALS['SaveAndAddAnother'] = GetLang('SaveAndAddAnother');
         if (!gzte11(ISC_MEDIUMPRINT)) {
             $GLOBALS['HideInventoryOptions'] = "none";
         } else {
             $GLOBALS['HideInventoryOptions'] = '';
         }
         // Does this product have a variation assigned to it?
         $GLOBALS['ProductVariationExisting'] = $arrData['prodvariationid'];
         if ($arrData['prodvariationid'] > 0) {
             $GLOBALS['IsYesVariation'] = 'checked="checked"';
         } else {
             $GLOBALS['IsNoVariation'] = 'checked="checked"';
             $GLOBALS['HideVariationList'] = "none";
             $GLOBALS['HideVariationCombinationList'] = "none";
         }
         // If there are no variations then disable the option to choose one
         $numVariations = 0;
         $GLOBALS['VariationOptions'] = $this->GetVariationsAsOptions($numVariations, $arrData['prodvariationid']);
         if ($numVariations == 0) {
             $GLOBALS['VariationDisabled'] = "DISABLED";
             $GLOBALS['VariationColor'] = "#CACACA";
             $GLOBALS['IsNoVariation'] = 'checked="checked"';
             $GLOBALS['IsYesVariation'] = "";
             $GLOBALS['HideVariationCombinationList'] = "none";
         } else {
             // Load the variation combinations
             if ($arrData['prodinvtrack'] == 2) {
                 $show_inv_fields = true;
             } else {
                 $show_inv_fields = false;
             }
             /**
              * We'll need to duplicate the variation combinations here if we are NOT preserving the post
              */
             if (!$PreservePost) {
                 $this->_CopyVariationData($arrData['productid'], 0, $GLOBALS['ProductHash']);
             }
             $GLOBALS['VariationCombinationList'] = $this->_LoadVariationCombinationsTable($arrData['prodvariationid'], $show_inv_fields, 0, $GLOBALS['ProductHash']);
         }
         if (!gzte11(ISC_HUGEPRINT)) {
             $GLOBALS['HideVendorOption'] = 'display: none';
         } else {
             $vendorData = $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendor();
             if (isset($vendorData['vendorid'])) {
                 $GLOBALS['HideVendorSelect'] = 'display: none';
                 $GLOBALS['CurrentVendor'] = isc_html_escape($vendorData['vendorname']);
             } else {
                 $GLOBALS['HideVendorLabel'] = 'display: none';
                 $GLOBALS['VendorList'] = $this->BuildVendorSelect($arrData['prodvendorid']);
             }
         }
         // Display the discount rules
         if ($PreservePost == true) {
             $GLOBALS['DiscountRules'] = $this->GetDiscountRules($prodId);
         } else {
             $GLOBALS['DiscountRules'] = $this->GetDiscountRules(0);
         }
         // Hide if we are not enabled
         if (!GetConfig('BulkDiscountEnabled')) {
             $GLOBALS['HideDiscountRulesWarningBox'] = '';
             $GLOBALS['DiscountRulesWarningText'] = GetLang('DiscountRulesNotEnabledWarning');
             $GLOBALS['DiscountRulesWithWarning'] = 'none';
             // Also hide it if this product has variations
         } else {
             if (isset($arrData['prodvariationid']) && isId($arrData['prodvariationid'])) {
                 $GLOBALS['HideDiscountRulesWarningBox'] = '';
                 $GLOBALS['DiscountRulesWarningText'] = GetLang('DiscountRulesVariationWarning');
                 $GLOBALS['DiscountRulesWithWarning'] = 'none';
             } else {
                 $GLOBALS['HideDiscountRulesWarningBox'] = 'none';
                 $GLOBALS['DiscountRulesWithWarning'] = '';
             }
         }
         $GLOBALS['DiscountRulesEnabled'] = (int) GetConfig('BulkDiscountEnabled');
         $GLOBALS['EventDateFieldName'] = $arrData['prodeventdatefieldname'];
         if ($GLOBALS['EventDateFieldName'] == null) {
             $GLOBALS['EventDateFieldName'] = GetLang('EventDateDefault');
         }
         if ($arrData['prodeventdaterequired'] == 1) {
             $GLOBALS['EventDateRequired'] = 'checked="checked"';
             $from_stamp = $arrData['prodeventdatelimitedstartdate'];
             $to_stamp = $arrData['prodeventdatelimitedenddate'];
         } else {
             $from_stamp = isc_gmmktime(0, 0, 0, isc_date("m"), isc_date("d"), isc_date("Y"));
             $to_stamp = isc_gmmktime(0, 0, 0, isc_date("m") + 1, isc_date("d"), isc_date("Y"));
         }
         if ($arrData['prodeventdatelimited'] == 1) {
             $GLOBALS['LimitDates'] = 'checked="checked"';
         }
         $GLOBALS['LimitDateOption1'] = '';
         $GLOBALS['LimitDateOption2'] = '';
         $GLOBALS['LimitDateOption3'] = '';
         switch ($arrData['prodeventdatelimitedtype']) {
             case 1:
                 $GLOBALS['LimitDateOption1'] = 'selected="selected"';
                 break;
             case 2:
                 $GLOBALS['LimitDateOption2'] = 'selected="selected"';
                 break;
             case 3:
                 $GLOBALS['LimitDateOption3'] = 'selected="selected"';
                 break;
         }
         // Set the global variables for the select boxes
         $from_day = isc_date("d", $from_stamp);
         $from_month = isc_date("m", $from_stamp);
         $from_year = isc_date("Y", $from_stamp);
         $to_day = isc_date("d", $to_stamp);
         $to_month = isc_date("m", $to_stamp);
         $to_year = isc_date("Y", $to_stamp);
         $GLOBALS['OverviewFromDays'] = $this->_GetDayOptions($from_day);
         $GLOBALS['OverviewFromMonths'] = $this->_GetMonthOptions($from_month);
         $GLOBALS['OverviewFromYears'] = $this->_GetYearOptions($from_year);
         $GLOBALS['OverviewToDays'] = $this->_GetDayOptions($to_day);
         $GLOBALS['OverviewToMonths'] = $this->_GetMonthOptions($to_month);
         $GLOBALS['OverviewToYears'] = $this->_GetYearOptions($to_year);
         if (!$GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Create_Category)) {
             $GLOBALS['HideCategoryCreation'] = 'display: none';
         }
         $GLOBALS['SaveAndAddAnother'] = GetLang('SaveAndAddAnother');
         $GLOBALS["ISC_CLASS_TEMPLATE"]->SetTemplate("product.form");
         $GLOBALS["ISC_CLASS_TEMPLATE"]->ParseTemplate();
     } else {
         // The product doesn't exist
         if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Manage_Products)) {
             $this->ManageProducts(GetLang('ProductDoesntExist'), MSG_ERROR);
         } else {
             $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR);
         }
     }
 }
Example #19
0
		/**
		 * Return the customer address grid
		 *
		 * Method will return the customer address HTML grid
		 *
		 * @access public
		 * @param int $formFieldFormId The optional form ID to display. Default is FORMFIELDS_FORM_ACCOUNT (account form)
		 * @return string The customer address HTML grid
		 */
		public function ManageFormFieldsGrid($formFieldFormId=FORMFIELDS_FORM_ACCOUNT)
		{
			if (!isId($formFieldFormId)) {
				return '';
			}

			$grid = '<ul class="SortableList" style="padding-top: 1px; padding-bottom: 1px; background-color: #f9f9f9;">';

			if (!isId($formFieldFormId)) {
				return '';
			}

			$fields = $GLOBALS['ISC_CLASS_FORM']->getFormFields($formFieldFormId);

			if (!$fields || empty($fields)) {
				return '';
			}

			foreach (array_keys($fields) as $fieldId) {

				$field =& $fields[$fieldId];
				$details = call_user_func(array(get_class($field), 'getDetails'));

				$GLOBALS['FormFieldId'] = $fieldId;
				$GLOBALS['FormFieldData'] = isc_html_escape($details['name']);
				$GLOBALS['FormFieldLastModified'] = date('M jS Y', $field->record['formfieldlastmodified']);

				if ($field->record['formfieldisimmutable']) {
					$GLOBALS['FormFieldType'] = GetLang('FormFieldsBuiltIn');
					$GLOBALS['DeleteStatus'] = 'disabled="disabled"';
				} else {
					$GLOBALS['FormFieldType'] = GetLang('FormFieldsUserDefined');
					$GLOBALS['DeleteStatus'] = '';
				}

				$GLOBALS['FormFieldName'] = isc_html_escape($field->record['formfieldlabel']);

				if (!$GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Edit_FormFields)) {
					$disabled = 'disabled="disabled" style="color: gray;"';
					$onclick = 'alert(\'' . GetLang('FormFieldsEditNotAllowedNoPermission') . '\'); return false;';
				} else {
					$disabled = '';
					$onclick = 'EditFormField(' . (int)$fieldId . ', ' . (int)$formFieldFormId . '); return false;';
				}

				$GLOBALS['FormFieldAction'] = '<a href="#" class="Action" onclick="' . $onclick . '" ' . $disabled . '>' . GetLang('Edit') . '</a>';

				if (!$GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Edit_FormFields) || isc_strtolower($field->record['formfieldtype']) == 'selectortext' || !gzte11(ISC_MEDIUMPRINT)) {
					$disabled = 'disabled="disabled" style="color: gray;"';

					if (!$GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Edit_FormFields)) {
						$msg = GetLang('FormFieldsCopyNotAllowedNoPermission');
					} else {
						$msg = sprintf(GetLang('FormFieldsCopyNotAllowed'), $field->record['formfieldlabel']);
					}

					$onclick = 'alert(\'' . $msg . '\'); return false;';
				} else {
					$disabled = '';
					$onclick = 'CopyFormField(' . (int)$fieldId . ', ' . (int)$formFieldFormId . ');return false;';
				}

				$GLOBALS['FormFieldAction'] .= ' <a href="#" class="Action" onclick="' . $onclick . '" ' . $disabled . '>' . GetLang('Copy') . '</a>';

				if (!$GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Delete_FormFields) || $field->record['formfieldisimmutable'] || !gzte11(ISC_MEDIUMPRINT)) {
					$disabled = 'disabled="disabled" style="color: gray;"';

					if (!$GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Delete_FormFields)) {
						$msg = GetLang('FormFieldsDeleteNotAllowedNoPermission');
					} else {
						$msg = sprintf(GetLang('FormFieldsDeleteNotAllowed'), $field->record['formfieldlabel']);
					}

					$onclick = 'alert(\'' . $msg . '\'); return false;';
				} else {
					$disabled = '';
					$onclick = 'DeleteFormField(' . (int)$fieldId . ', ' . (int)$formFieldFormId . '); return false;';
				}

				$GLOBALS['FormFieldAction'] .= ' <a href="#" class="Action" onclick="' . $onclick . '" ' . $disabled . '>' . GetLang('Delete') . '</a>';

				/**
				 * Special case to stop customers from putting fields above the
				 * email and password fields
				 */
				if ($formFieldFormId == FORMFIELDS_FORM_ACCOUNT) {
					if (trim($field->record['formfieldprivateid']) !== '') {
						$privateSet = true;
					} else if ($privateSet) {
						$grid .= '</ul><ul class="SortableList" style="padding-top: 1px; padding-bottom: 1px; background-color: #f9f9f9;">';
						$privateSet = false;
					}
				}

				if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Manage_FormFields)) {
					$GLOBALS['FormFieldSortRow'] = 'DragMouseDown sort-handle';
				} else {
					$GLOBALS['FormFieldSortRow'] = 'HideOnDrag';
				}

				$grid .= $this->template->render('Snippets/FormFields.html');
			}

			$grid .= '</ul>';
			return $grid;
		}
 /**
  * Retrieves a template record from the database
  *
  * @param int $templateid The template to get
  * @return array The template record
  */
 public function GetTemplate($templateid)
 {
     $where = "";
     if (gzte11(ISC_HUGEPRINT)) {
         $GLOBALS['VendorLabel'] = GetLang("VendorLabel");
         $vendorData = $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendor();
         if (isset($vendorData['vendorid'])) {
             $where = "AND (et.vendorid = '" . $vendorData['vendorid'] . "' OR builtin = 1)";
         }
     }
     // retrieve the template
     $query = "\n\t\t\tSELECT\n\t\t\t\tet.*\n\t\t\tFROM\n\t\t\t\t[|PREFIX|]import_templates et\n\t\t\tWHERE\n\t\t\t\timporttemplateid = '" . $GLOBALS['ISC_CLASS_DB']->Quote($templateid) . "'";
     $query .= $where;
     $result = $GLOBALS['ISC_CLASS_DB']->Query($query);
     if (!($template = $GLOBALS['ISC_CLASS_DB']->Fetch($result))) {
         // template not found
         throw new Exception(GetLang("TemplateNotFound"));
     }
     return $template;
 }
 public function __construct()
 {
     $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->LoadLangFile('batch.importer');
     /**
      * @var array Array of importable fields and their friendly names.
      */
     $this->_ImportFields = array("prodname" => GetLang('ProductName'), "category" => GetLang('ImportProductsCategory'), "category2" => "SUBCATEGORY", "category3" => "Ignore", "brandname" => GetLang('BrandName'), "prodcode" => "PARTNUMBER", "proddesc" => "DESCRIPTION", "prodmake" => GetLang('prodmake'), "prodmodel" => GetLang('prodmodel'), "prodsubmodel" => "SUBMODEL", "prodstartyear" => GetLang('prodstartyear'), "prodendyear" => GetLang('prodendyear'), "prodavailability" => GetLang('Availability'), "prodprice" => GetLang('Price'), "prodcostprice" => GetLang('CostPrice'), "prodsaleprice" => GetLang('SalePrice'), "prodretailprice" => GetLang('RetailPrice'), "prodcurrentinv" => GetLang('CurrentStockLevel'), "prodistaxable" => GetLang('ProdIsTaxable'), "prodlowinv" => GetLang('LowStockLevel'), "prodwarranty" => GetLang('ProductWarranty'), "prodfixedshippingcost" => GetLang('FixedShippingCost'), "prodweight" => GetLang('ProductWeight'), "prodwidth" => GetLang('ProductWidth'), "prodheight" => GetLang('ProductHeight'), "proddepth" => GetLang('ProductDepth'), "prodpagetitle" => GetLang('PageTitle'), "prodsearchkeywords" => GetLang('SearchKeywords'), "prodmetakeywords" => GetLang('MetaKeywords'), "prodmetadesc" => GetLang('MetaDescription'), "prodimagefile" => "PRODUCT IMAGES", "prodinstallimagefile" => "INSTALL IMAGES", "prodinstallvideo" => "INSTALL VIDEO", "prodvideo" => "PRODUCT VIDEO", "prodfile" => GetLang('ProductFile'), "prodvendorprefix" => "VENDORPREFIX", "proddescfeature" => "FEATURE POINTS", "prodmfg" => GetLang('prodmfg'), "jobberprice" => GetLang('jobberprice'), "mapprice" => GetLang('mapprice'), "alternativecategory" => GetLang('alternativecategory'), "complementaryitems" => 'COMPLEMENTARY ITEMS', "complementaryupcharge" => 'COMPLEMENTARY UPCHARGE', "ourcost" => 'Our Cost', "package_length" => 'Package Length', "package_height" => 'Package Height', "package_weight" => 'Package Weight', "package_width" => 'Package Width', "product_series" => 'Series', "future_retail_price" => 'Future Retail Price', "future_jobber_price" => 'Future Jobber Price', "prod_instruction" => 'INSTRUCTION', "instruction_file" => 'Instruction File', "prod_article" => 'Product Article', "article_file" => 'Article File', "audio_clip" => 'AUDIO CLIP', "install_time" => 'INSTALL TIME', "skubarcode" => 'SKUBARCODE');
     if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId() == 0 && gzte11(ISC_HUGEPRINT)) {
         $this->_ImportFields['prodvendorid'] = GetLang('Vendor');
     }
     parent::__construct();
 }
 private function ManageSettings($messages = array())
 {
     if (!gzte11(ISC_HUGEPRINT)) {
         $GLOBALS['HideVendorOptions'] = 'display: none';
     }
     $GLOBALS['Message'] = GetFlashMessageBoxes();
     if (GetConfig('UseWYSIWYG')) {
         $GLOBALS['IsWYSIWYGEnabled'] = 'checked="checked"';
     }
     if (GetConfig('ShowThumbsInControlPanel')) {
         $GLOBALS['IsProductThumbnailsEnabled'] = 'checked="checked"';
     }
     if (GetConfig('DesignMode')) {
         $GLOBALS['IsDesignMode'] = 'checked="checked"';
     }
     if (GetConfig('UseSSL')) {
         $GLOBALS['IsSSLEnabled'] = 'checked="checked"';
     }
     if (GetConfig('AllowPurchasing')) {
         $GLOBALS['IsPurchasingEnabled'] = 'checked="checked"';
     }
     switch (GetConfig('WeightMeasurement')) {
         case 'LBS':
             $GLOBALS['IsPounds'] = 'selected="selected"';
             break;
         case 'Ounces':
             $GLOBALS['IsOunces'] = 'selected="selected"';
             break;
         case 'KGS':
             $GLOBALS['IsKilos'] = 'selected="selected"';
             break;
         case 'Grams':
             $GLOBALS['IsGrams'] = 'selected="selected"';
             break;
         case 'Tonnes':
             $GLOBLAS['IsTonnes'] = 'selected="selected"';
     }
     if (GetConfig('LengthMeasurement') == "Inches") {
         $GLOBALS['IsInches'] = 'selected="selected"';
     } else {
         $GLOBALS['IsCentimeters'] = 'selected="selected"';
     }
     $GLOBALS['ShippingFactoringDimensionDepthSelected'] = '';
     $GLOBALS['ShippingFactoringDimensionHeightSelected'] = '';
     $GLOBALS['ShippingFactoringDimensionWidthSelected'] = '';
     switch (GetConfig('ShippingFactoringDimension')) {
         case 'height':
             $GLOBALS['ShippingFactoringDimensionHeightSelected'] = 'selected="selected"';
             break;
         case 'width':
             $GLOBALS['ShippingFactoringDimensionWidthSelected'] = 'selected="selected"';
             break;
         case 'depth':
         default:
             $GLOBALS['ShippingFactoringDimensionDepthSelected'] = 'selected="selected"';
             break;
     }
     if (GetConfig('TagCartQuantityBoxes') == "dropdown") {
         $GLOBALS['IsDropdown'] = 'selected="selected"';
     } else {
         $GLOBALS['IsTextbox'] = 'selected="selected"';
     }
     if (GetConfig('AddToCartButtonPosition') == "middle") {
         $GLOBALS['IsMiddle'] = 'selected="selected"';
     } else {
         $GLOBALS['IsSide'] = 'selected="selected"';
     }
     if (GetConfig('TagCloudsEnabled')) {
         $GLOBALS['IsTagCloudsEnabled'] = 'checked="checked"';
     }
     if (GetConfig('BulkDiscountEnabled')) {
         $GLOBALS['IsBulkDiscountEnabled'] = 'checked="checked"';
     }
     if (GetConfig('EnableProductTabs')) {
         $GLOBALS['IsProductTabsEnabled'] = 'checked="checked"';
     }
     if (GetConfig('ShowAddToCartQtyBox')) {
         $GLOBALS['IsShownAddToCartQtyBox'] = 'checked="checked"';
     }
     if (GetConfig('CaptchaEnabled')) {
         $GLOBALS['IsCaptchaEnabled'] = 'checked="checked"';
     }
     if (GetConfig('StoreDSTCorrection')) {
         $GLOBALS['IsDSTCorrectionEnabled'] = "checked=\"checked\"";
     }
     if (GetConfig('ShowCartSuggestions')) {
         $GLOBALS['IsShowCartSuggestions'] = 'checked="checked"';
     }
     if (GetConfig('ShowThumbsInCart')) {
         $GLOBALS['IsShowThumbsInCart'] = 'checked="checked"';
     }
     if (GetConfig('TagCloudsEnabled')) {
         $GLOBALS['IsTagCloudsEnabled'] = 'checked="checked"';
     }
     if (GetConfig('ShowAddToCartQtyBox')) {
         $GLOBALS['IsShownAddToCartQtyBox'] = 'checked="checked"';
     }
     if (GetConfig('AutoApproveReviews')) {
         $GLOBALS['IsAutoApproveReviews'] = 'checked="checked"';
     }
     if (GetConfig('SearchSuggest')) {
         $GLOBALS['IsSearchSuggest'] = 'checked="checked"';
     }
     if (GetConfig('QuickSearch')) {
         $GLOBALS['IsQuickSearch'] = 'checked="checked"';
     }
     if (GetConfig('ShowInventory')) {
         $GLOBALS['IsShowInventory'] = 'checked="checked"';
     }
     // Bulk Discount Settings
     if (GetConfig('BulkDiscountEnabled')) {
         $GLOBALS['IsBulkDiscountEnabled'] = 'checked="checked"';
     }
     if (GetConfig('EnableProductTabs')) {
         $GLOBALS['IsProductTabsEnabled'] = 'checked="checked"';
     }
     // RSS Settings
     if (GetConfig('RSSNewProducts')) {
         $GLOBALS['IsRSSNewProductsEnabled'] = 'checked="checked"';
     }
     if (GetConfig('RSSPopularProducts')) {
         $GLOBALS['IsRSSPopularProductsEnabled'] = 'checked="checked"';
     }
     if (GetConfig('RSSCategories')) {
         $GLOBALS['IsRSSCategoriesEnabled'] = 'checked="checked"';
     }
     if (GetConfig('RSSProductSearches')) {
         $GLOBALS['IsRSSProductSearchesEnabled'] = 'checked="checked"';
     }
     if (GetConfig('RSSLatestBlogEntries')) {
         $GLOBALS['IsRSSLatestBlogEntriesEnabled'] = 'checked="checked"';
     }
     if (GetConfig('RSSSyndicationIcons')) {
         $GLOBALS['IsRSSSyndicationIconsEnabled'] = 'checked="checked"';
     }
     // Backup Settings
     if (GetConfig('BackupsLocal')) {
         $GLOBALS['IsBackupsLocalEnabled'] = 'checked="checked"';
     }
     if (GetConfig('BackupsRemoteFTP')) {
         $GLOBALS['IsBackupsRemoteFTPEnabled'] = 'checked="checked"';
     }
     if (GetConfig('BackupsAutomatic')) {
         $GLOBALS['IsBackupsAutomaticEnabled'] = 'checked="checked"';
     }
     if (GetConfig('HTTPSSLVerifyPeer')) {
         $GLOBALS['IsHTTPSSLVerifyPeerEnabled'] = 'checked="checked"';
     }
     if (GetConfig('ShowMailingListInvite')) {
         $GLOBALS['IsShowMailingListInvite'] = 'checked="checked"';
     }
     if (strpos(strtolower(PHP_OS), 'win') === 0) {
         $binary = 'php.exe';
         $path_to_php = Which($binary);
     } else {
         // Check if there is a separate PHP 5 binary first
         foreach (array('php5', 'php') as $phpBin) {
             $path_to_php = Which($phpBin);
             if ($path_to_php !== '') {
                 break;
             }
         }
     }
     if ($path_to_php === '' && strpos(strtolower(PHP_OS), 'win') === 0) {
         $path_to_php = 'php.exe';
     } elseif ($path_to_php === '') {
         $path_to_php = 'php';
     }
     $GLOBALS['BackupsAutomaticPath'] = $path_to_php . ' -f ' . realpath(ISC_BASE_PATH . "/admin") . "/cron-backup.php";
     if (GetConfig('BackupsAutomaticMethod') == "ftp") {
         $GLOBALS['IsBackupsAutomaticMethodFTP'] = 'selected="selected"';
     } else {
         $GLOBALS['IsBackupsAutomaticMethodLocal'] = 'selected="selected"';
     }
     if (GetConfig('BackupsAutomaticDatabase')) {
         $GLOBALS['IsBackupsAutomaticDatabaseEnabled'] = 'checked="checked"';
     }
     if (GetConfig('BackupsAutomaticImages')) {
         $GLOBALS['IsBackupsAutomaticImagesEnabled'] = 'checked="checked"';
     }
     if (GetConfig('BackupsAutomaticDownloads')) {
         $GLOBALS['IsBackupsAutomaticDownloadsEnabled'] = 'checked="checked"';
     }
     $GLOBALS['LanguageOptions'] = $this->GetLanguageOptions(GetConfig('Language'));
     if (!function_exists('ftp_connect')) {
         $GLOBALS['FTPBackupsHide'] = "none";
     }
     $GLOBALS['TimeZoneOptions'] = $this->GetTimeZoneOptions(GetConfig('StoreTimeZone'));
     $query = sprintf("select version() as version");
     $result = $GLOBALS['ISC_CLASS_DB']->Query($query);
     $row = $GLOBALS['ISC_CLASS_DB']->Fetch($result);
     $GLOBALS['dbVersion'] = $row['version'];
     // Hide the special offers tickbox if Interspire Email Marketer isn't integrated
     if (!(GetConfig('MailXMLAPIValid') && GetConfig('UseMailerForOrders') && GetConfig('MailOrderList') > 0)) {
         $GLOBALS['HideSpecialOffersBox'] = "none";
     }
     if (GetConfig('MailAutomaticallyTickNewsletterBox')) {
         $GLOBALS['IsNewsletterBoxTicked'] = 'checked="checked"';
     }
     if (GetConfig('MailAutomaticallyTickOrderBox')) {
         $GLOBALS['IsOrderBoxTicked'] = 'checked="checked"';
     }
     // Logging Settings
     if (GetConfig('SystemLogging')) {
         $GLOBALS['IsSystemLoggingEnabled'] = "checked=\"checked\"";
     }
     if (GetConfig('DebugMode')) {
         $GLOBALS['IsDebugModeEnabled'] = "checked=\"checked\"";
     }
     if (GetConfig('SystemLogTypes')) {
         $types = explode(",", GetConfig('SystemLogTypes'));
         if (in_array('general', $types)) {
             $GLOBALS['IsGeneralLoggingEnabled'] = "selected=\"selected\"";
         }
         if (in_array('payment', $types)) {
             $GLOBALS['IsPaymentLoggingEnabled'] = "selected=\"selected\"";
         }
         if (in_array('shipping', $types)) {
             $GLOBALS['IsShippingLoggingEnabled'] = "selected=\"selected\"";
         }
         if (in_array('notification', $types)) {
             $GLOBALS['IsNotificationLoggingEnabled'] = "selected=\"selected\"";
         }
         if (in_array('ssnx', $types)) {
             $GLOBALS['IsSendStudioLoggingEnabled'] = "selected=\"selected\"";
         }
         if (in_array('sql', $types)) {
             $GLOBALS['IsSQLLoggingEnabled'] = "selected=\"selected\"";
         }
         if (in_array('php', $types)) {
             $GLOBALS['IsPHPLoggingEnabled'] = "selected=\"selected\"";
         }
     }
     if (GetConfig('SystemLogSeverity')) {
         $severities = explode(",", GetConfig('SystemLogSeverity'));
         if (in_array('errors', $severities)) {
             $GLOBALS['IsLoggingSeverityErrors'] = "selected=\"selected\"";
         }
         if (in_array('warnings', $severities)) {
             $GLOBALS['IsLoggingSeverityWarnings'] = "selected=\"selected\"";
         }
         if (in_array('notices', $severities)) {
             $GLOBALS['IsLoggingSeverityNotices'] = "selected=\"selected\"";
         }
         if (in_array('success', $severities)) {
             $GLOBALS['IsLoggingSeveritySuccesses'] = "selected=\"selected\"";
         }
         if (in_array('debug', $severities)) {
             $GLOBALS['IsLoggingSeverityDebug'] = "selected=\"selected\"";
         }
     }
     if (GetConfig('EnableSEOUrls') == 2) {
         $GLOBALS['IsEnableSEOUrlsAuto'] = "selected=\"selected\"";
     } else {
         if (GetConfig('EnableSEOUrls') == 1) {
             $GLOBALS['IsEnableSEOUrlsEnabled'] = "selected=\"selected\"";
         } else {
             $GLOBALS['IsEnableSEOUrlsDisabled'] = "selected=\"selected\"";
         }
     }
     if (!gzte11(ISC_MEDIUMPRINT)) {
         $GLOBALS['HideBackupSettings'] = "none";
     }
     if (GetConfig('AdministratorLogging')) {
         $GLOBALS['IsAdministratorLoggingEnabled'] = "checked=\"checked\"";
     }
     if (GetConfig('HidePHPErrors')) {
         $GLOBALS['IsHidePHPErrorsEnabled'] = "checked=\"checked\"";
     }
     if (GetConfig('EnableWishlist')) {
         $GLOBALS['IsWishlistEnabled'] = "checked=\"checked\"";
     }
     if (GetConfig('EnableAccountCreation')) {
         $GLOBALS['IsEnableAccountCreation'] = "checked=\"checked\"";
     }
     if (GetConfig('EnableProductReviews')) {
         $GLOBALS['IsEnableProductReviews'] = "checked=\"checked\"";
     }
     if (GetConfig('EnableProductComparisons')) {
         $GLOBALS['IsEnableProductComparisons'] = "checked=\"checked\"";
     }
     // Product display settings
     if (GetConfig('ShowProductPrice')) {
         $GLOBALS['IsProductPriceShown'] = 'CHECKED';
     }
     if (GetConfig('ShowProductSKU')) {
         $GLOBALS['IsProductSKUShown'] = 'CHECKED';
     }
     if (GetConfig('ShowProductWeight')) {
         $GLOBALS['IsProductWeightShown'] = 'CHECKED';
     }
     if (GetConfig('ShowProductBrand')) {
         $GLOBALS['IsProductBrandShown'] = 'CHECKED';
     }
     if (GetConfig('ShowProductShipping')) {
         $GLOBALS['IsProductShippingShown'] = 'CHECKED';
     }
     if (GetConfig('ShowProductRating')) {
         $GLOBALS['IsProductRatingShown'] = 'CHECKED';
     }
     if (GetConfig('ShowAddToCartLink')) {
         $GLOBALS['IsAddToCartLinkShown'] = 'CHECKED';
     }
     if (GetConfig('LowInventoryNotificationAddress') != '') {
         $GLOBALS['LowInventoryEmailsEnabledCheck'] = "checked=\"checked\"";
     } else {
         $GLOBALS['HideLowInventoryNotification'] = "none";
     }
     if (GetConfig('ForwardInvoiceEmails') != '') {
         $GLOBALS['ForwardInvoiceEmailsCheck'] = "checked=\"checked\"";
     } else {
         $GLOBALS['HideForwardInvoiceEmails'] = 'none';
     }
     if (GetConfig('MailUseSMTP')) {
         $GLOBALS['HideMailSMTPSettings'] = '';
         $GLOBALS['MailUseSMTPChecked'] = "checked=\"checked\"";
     } else {
         $GLOBALS['HideMailSMTPSettings'] = 'none';
         $GLOBALS['MailUsePHPChecked'] = "checked=\"checked\"";
     }
     if (GetConfig('ProductImageMode') == "lightbox") {
         $GLOBALS['ProductImageModeLightbox'] = 'selected="selected"';
     } else {
         $GLOBALS['ProductImageModePopup'] = 'selected="selected"';
     }
     if (GetConfig('CategoryDisplayMode') == "grid") {
         $GLOBALS['CategoryDisplayModeGrid'] = 'selected="selected"';
     } else {
         $GLOBALS['CategoryDisplayModeList'] = 'selected="selected"';
     }
     if (GetConfig('CategoryDefaultImage') !== '') {
         $GLOBALS['CatImageDefaultSettingMessage'] = sprintf(GetLang('CatImageDefaultSettingDesc'), GetConfig('ShopPath') . '/' . GetConfig('CategoryDefaultImage'), GetConfig('CategoryDefaultImage'));
     } else {
         $GLOBALS['CatImageDefaultSettingMessage'] = sprintf(GetLang('BrandImageDefaultSettingNoDeleteDesc'), GetConfig('ShopPath') . '/templates/' . GetConfig('template') . '/images/CategoryDefault.gif', 'templates/' . GetConfig('template') . '/images/CategoryDefault.gif');
     }
     if (GetConfig('BrandDefaultImage') !== '') {
         $GLOBALS['BrandImageDefaultSettingMessage'] = sprintf(GetLang('BrandImageDefaultSettingDesc'), GetConfig('ShopPath') . '/' . GetConfig('BrandDefaultImage'), GetConfig('BrandDefaultImage'));
     } else {
         $GLOBALS['BrandImageDefaultSettingMessage'] = sprintf(GetLang('BrandImageDefaultSettingNoDeleteDesc'), GetConfig('ShopPath') . '/templates/' . GetConfig('template') . '/images/BrandDefault.gif', 'templates/' . GetConfig('template') . '/images/BrandDefault.gif');
     }
     $GLOBALS['HideCurrentDefaultProductImage'] = 'display: none';
     switch (GetConfig('DefaultProductImage')) {
         case 'template':
             $GLOBALS['DefaultProductImageTemplateChecked'] = 'checked="checked"';
             break;
         case '':
             $GLOBALS['DefaultProductImageNoneChecked'] = 'checked="checked"';
             break;
         default:
             $GLOBALS['DefaultProductImageCustomChecked'] = 'checked="checked"';
             $GLOBALS['HideCurrentDefaultProductImage'] = '';
             $GLOBALS['DefaultProductImage'] = GetConfig('DefaultProductImage');
     }
     if (GetConfig('CategoryListingMode') == 'children') {
         $GLOBALS['CategoryListModeChildren'] = "checked=\"checked\"";
     } else {
         if (GetConfig('CategoryListingMode') == 'emptychildren') {
             $GLOBALS['CategoryListModeEmptyChildren'] = "checked=\"checked\"";
         } else {
             $GLOBALS['CategoryListModeSingle'] = "checked=\"checked\"";
         }
     }
     // Get a list of the customer groups
     $query = 'SELECT * FROM [|PREFIX|]customer_groups ORDER BY groupname ASC';
     $result = $GLOBALS['ISC_CLASS_DB']->Query($query);
     $GLOBALS['CustomerGroupOptions'] = '';
     while ($group = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
         if (GetConfig('GuestCustomerGroup') == $group['customergroupid']) {
             $sel = 'selected="selected"';
         } else {
             $sel = '';
         }
         $GLOBALS['CustomerGroupOptions'] .= "<option value=\"" . $group['customergroupid'] . "\" " . $sel . ">" . isc_html_escape($group['groupname']) . "</option>";
     }
     // Workout the HTTPS URL
     $GLOBALS['CompleteStorePath'] = fix_url($_SERVER['PHP_SELF']);
     $GLOBALS['HTTPSUrl'] = str_replace("http://", "https://", isc_strtolower($GLOBALS['ShopPath']));
     $GLOBALS['HideVendorSettings'] = 'display: none';
     if (gzte11(ISC_HUGEPRINT)) {
         $GLOBALS['HideVendorSettings'] = '';
     }
     if (GetConfig('VendorLogoSize')) {
         $logoDimensions = explode('x', GetConfig('VendorLogoSize'));
         $GLOBALS['VendorLogoSizeW'] = (int) $logoDimensions[0];
         $GLOBALS['VendorLogoSizeH'] = (int) $logoDimensions[1];
         $GLOBALS['HideVendorLogoUploading'] = '';
         $GLOBALS['VendorLogoUploadingChecked'] = 'checked="checked"';
     } else {
         $GLOBALS['HideVendorLogoUploading'] = 'display: none';
     }
     if (GetConfig('VendorPhotoSize')) {
         $photoDimensions = explode('x', GetConfig('VendorPhotoSize'));
         $GLOBALS['VendorPhotoSizeW'] = (int) $photoDimensions[0];
         $GLOBALS['VendorPhotoSizeH'] = (int) $photoDimensions[1];
         $GLOBALS['HideVendorPhotoUploading'] = '';
         $GLOBALS['VendorPhotoUploadingChecked'] = 'checked="checked"';
     } else {
         $GLOBALS['HideVendorPhotoUploading'] = 'display: none';
     }
     foreach ($this->all_vars as $var) {
         if (is_string(GetConfig($var)) || is_numeric(GetConfig($var))) {
             $GLOBALS[$var] = isc_html_escape(GetConfig($var));
         }
     }
     if (GetConfig('DisableDatabaseDetailFields')) {
         $GLOBALS['dbType'] = '';
         $GLOBALS['dbServer'] = '';
         $GLOBALS['dbUser'] = '';
         $GLOBALS['dbPass'] = '';
         $GLOBALS['dbDatabase'] = '';
         $GLOBALS['tablePrefix'] = '';
         $GLOBALS['HideDatabaseDetails'] = 'display: none';
     }
     if (GetConfig('DisableLicenseKeyField')) {
         $GLOBALS['serverStamp'] = 'N/A';
         $GLOBALS['HideLicenseKey'] = 'display: none';
     }
     if (GetConfig('DisablePathFields')) {
         $GLOBALS['HidePathFields'] = 'display: none';
     }
     if (GetConfig('DisableStoreUrlField')) {
         $GLOBALS['HideStoreUrlField'] = 'display: none';
     }
     if (GetConfig('DisableLoggingSettingsTab')) {
         $GLOBALS['HideLoggingSettingsTab'] = 'display: none';
     }
     if (GetConfig('DisableProxyFields')) {
         $GLOBALS['HideProxyFields'] = 'display: none';
     }
     if (GetConfig('DisableBackupSettings')) {
         $GLOBALS['HideBackupSettings'] = 'none';
     }
     $GLOBALS['ShopPath'] = GetConfig('ShopPathNormal');
     $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("settings.manage");
     $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate();
 }
	public function SetPanelSettings()
	{
		if(!gzte11(ISC_HUGEPRINT) || $GLOBALS['ISC_CLASS_PRODUCT']->GetProductVendor() === false) {
			$this->DontDisplay = true;
			return false;
		}

		$vendor = $GLOBALS['ISC_CLASS_PRODUCT']->GetProductVendor();
		$GLOBALS['SNIPPETS']['VendorsOtherProducts'] = '';

		if(!getProductReviewsEnabled()) {
			$GLOBALS['HideProductRating'] = "display: none";
		}

		$query = $this->getProductQuery(
			'p.prodvendorid='.(int)$vendor['vendorid'].' AND p.productid!='.$GLOBALS['ISC_CLASS_PRODUCT']->getProductId(),
			'p.prodvendorfeatured DESC, RAND() DESC',
			10 // Select 1 more than will be shown to check if we need to show the "has more" link
		);
		$result = $GLOBALS['ISC_CLASS_DB']->Query($query);

		$productsDone = 0;
		$hasMore = false;
		$GLOBALS['AlternateClass'] = '';
		while($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
			++$productsDone;
			if($productsDone == 9) {
				$hasMore = true;
				break;
			}
			if($GLOBALS['AlternateClass'] == 'Odd') {
				$GLOBALS['AlternateClass'] = 'Even';
			}
			else {
				$GLOBALS['AlternateClass'] = 'Odd';
			}

			$GLOBALS['ProductCartQuantity'] = '';
			if(isset($GLOBALS['CartQuantity'.$row['productid']])) {
				$GLOBALS['ProductCartQuantity'] = (int)$GLOBALS['CartQuantity'.$row['productid']];
			}

			$GLOBALS['ProductId'] = (int) $row['productid'];
			$GLOBALS['ProductName'] = isc_html_escape($row['prodname']);
			$GLOBALS['ProductLink'] = ProdLink($row['prodname']);
			$GLOBALS['ProductRating'] = (int)$row['prodavgrating'];

			// Determine the price of this product
			$GLOBALS['ProductPrice'] = formatProductCatalogPrice($row);

			$GLOBALS['ProductThumb'] = ImageThumb($row, ProdLink($row['prodname']));

			if (isId($row['prodvariationid']) || trim($row['prodconfigfields'])!='' || $row['prodeventdaterequired'] == 1) {
				$GLOBALS['ProductURL'] = ProdLink($row['prodname']);
				$GLOBALS['ProductAddText'] = GetLang('ProductChooseOptionLink');
			} else {
				$GLOBALS['ProductURL'] = CartLink($row['productid']);
				$GLOBALS['ProductAddText'] = GetLang('ProductAddToCartLink');
			}

			if (CanAddToCart($row) && GetConfig('ShowAddToCartLink')) {
				$GLOBALS['HideActionAdd'] = '';
			} else {
				$GLOBALS['HideActionAdd'] = 'none';
			}

			$GLOBALS['SNIPPETS']['VendorsOtherProducts'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ProductVendorsOtherProductsItem");
		}

		if(!$GLOBALS['SNIPPETS']['VendorsOtherProducts']) {
			$this->DontDisplay = true;
		}

		$GLOBALS['VendorProductsLink'] = VendorProductsLink($vendor);
		if($hasMore == true) {
			$GLOBALS['HideViewAllLink'] = '';
		}
		else {
			$GLOBALS['HideViewAllLink'] = 'display: none';
		}
	}
Example #24
0
		/**
		*	Show the details of an order and allow them to print an invoice
		*/
		private function ViewOrderDetails()
		{
			$GLOBALS['SNIPPETS']['AccountOrderItemRow'] = "";
			$count = 0;

			if (!isset($_GET['order_id']) || !is_numeric($_GET['order_id'])) {
				redirect('account.php?action=view_orders');
			}

			$GLOBALS['FlassMessage'] = GetFlashMessageBoxes();

			// Retrieve the completed order that matches the customers user id
			$orderId = (int)$_GET['order_id'];
			$GLOBALS['OrderId'] = $orderId;

			$customerId = getClass('ISC_CUSTOMER')->getcustomerId();
			$query = "
				SELECT *, (
						SELECT CONCAT(custconfirstname, ' ', custconlastname)
						FROM [|PREFIX|]customers
						WHERE customerid=ordcustid
					) AS custname, (
						SELECT statusdesc
						FROM [|PREFIX|]order_status
						WHERE statusid=ordstatus
					) AS ordstatustext
				FROM [|PREFIX|]orders
				WHERE ordcustid='".(int)$customerId."' AND orderid='".(int)$orderId."' AND deleted = 0
			";
			$result = $GLOBALS['ISC_CLASS_DB']->query($query);
			$row = $GLOBALS['ISC_CLASS_DB']->fetch($result);
			if(!$row) {
				redirect('account.php?action=view_orders');
			}

			$GLOBALS['DisableReturnButton'] = "";
			if (!gzte11(ISC_LARGEPRINT)) {
				$GLBOALS['DisableReturnButton'] = "none";
			}

			$order = $row;

			// Fetch the shipping addresses for this order
			$addresses = array();
			$query = "
				SELECT *
				FROM [|PREFIX|]order_addresses
				WHERE order_id='".$order['orderid']."'
			";
			$result = $GLOBALS['ISC_CLASS_DB']->query($query);
			while($address = $GLOBALS['ISC_CLASS_DB']->fetch($result)) {
				$addresses[$address['id']] = $address;
			}

			// Fetch the shipping details for the order
			$query = "
				SELECT *
				FROM [|PREFIX|]order_shipping
				WHERE order_id=".$order['orderid'];
			$result = $GLOBALS['ISC_CLASS_DB']->query($query);
			while($shipping = $GLOBALS['ISC_CLASS_DB']->fetch($result)) {
				$addresses[$shipping['order_address_id']]['shipping'] = $shipping;
			}

			$GLOBALS['OrderComments'] = '';
			if($row['ordcustmessage'] != '') {
				$GLOBALS['OrderComments'] = nl2br(isc_html_escape($row['ordcustmessage']));
			}
			else {
				$GLOBALS['HideOrderComments'] = 'display: none';
			}

			if(OrderIsComplete($row['ordstatus'])) {
				if (!gzte11(ISC_LARGEPRINT)) {
					$GLOBALS['DisableReturnButton'] = "none";
				}

				if ($row['ordstatus'] == 4 || GetConfig('EnableReturns') == 0) {
					$GLOBALS['DisableReturnButton'] = "none";
				}

				$GLOBALS['HideOrderStatus'] = "none";
				$orderComplete = true;
			}
			else {
				$GLOBALS['HideOrderStatus'] = '';
				$GLOBALS['OrderStatus'] = $row['ordstatustext'];
				$GLOBALS['DisableReturnButton'] = "none";
				$orderComplete = false;
			}

			// Hide print order invoive if it's a incomplete order
			$GLOBALS['ShowOrderActions'] = '';
			if(!$row['ordstatus']) {
				$GLOBALS['ShowOrderActions'] = 'display:none';
			}

			$GLOBALS['OrderDate'] = isc_date(GetConfig('ExtendedDisplayDateFormat'), $row['orddate']);

			$GLOBALS['OrderTotal'] = CurrencyConvertFormatPrice($row['total_inc_tax'], $row['ordcurrencyid'], $row['ordcurrencyexchangerate'], true);

			// Format the billing address
			$GLOBALS['ShipFullName'] = isc_html_escape($row['ordbillfirstname'].' '.$row['ordbilllastname']);
			$GLOBALS['ShipCompany'] = '';
			if($row['ordbillcompany']) {
				$GLOBALS['ShipCompany'] = '<br />'.isc_html_escape($row['ordbillcompany']);
			}

			$GLOBALS['ShipAddressLines'] = isc_html_escape($row['ordbillstreet1']);

			if ($row['ordbillstreet2'] != "") {
				$GLOBALS['ShipAddressLines'] .= '<br />' . isc_html_escape($row['ordbillstreet2']);
			}

			$GLOBALS['ShipSuburb'] = isc_html_escape($row['ordbillsuburb']);
			$GLOBALS['ShipState'] = isc_html_escape($row['ordbillstate']);
			$GLOBALS['ShipZip'] = isc_html_escape($row['ordbillzip']);
			$GLOBALS['ShipCountry'] = isc_html_escape($row['ordbillcountry']);
			$GLOBALS['ShipPhone'] = "";
			$GLOBALS['BillingAddress'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("AddressLabel");

			// Is there a shipping address, or is it a digital download?
			if ($order['ordisdigital']) {
				$GLOBALS['HideSingleShippingAddress'] = 'display: none';
			}
			else if ($order['shipping_address_count'] > 1) {
				$GLOBALS['ShippingAddress'] = GetLang('OrderWillBeShippedToMultipleAddresses');
				$GLOBALS['HideItemDetailsHeader'] = 'display:none;';
			}
			else {
				$shippingAddress = current($addresses);
				$GLOBALS['ShipFullName'] = isc_html_escape($shippingAddress['first_name'].' '.$shippingAddress['last_name']);

				$GLOBALS['ShipCompany'] = '';
				if($shippingAddress['company']) {
					$GLOBALS['ShipCompany'] = '<br />'.isc_html_escape($shippingAddress['company']);
				}

				$GLOBALS['ShipAddressLines'] = isc_html_escape($shippingAddress['address_1']);

				if ($shippingAddress['address_2'] != "") {
					$GLOBALS['ShipAddressLines'] .= '<br />' . isc_html_escape($shippingAddress['address_2']);
				}

				$GLOBALS['ShipSuburb'] = isc_html_escape($shippingAddress['city']);
				$GLOBALS['ShipState'] = isc_html_escape($shippingAddress['state']);
				$GLOBALS['ShipZip'] = isc_html_escape($shippingAddress['zip']);
				$GLOBALS['ShipCountry'] = isc_html_escape($shippingAddress['country']);

				$GLOBALS['ShipPhone'] = "";
				$GLOBALS['ShippingAddress'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("AddressLabel");
			}

			$itemTotalColumn = 'total_ex_tax';
			if(getConfig('taxDefaultTaxDisplayOrders') == TAX_PRICES_DISPLAY_INCLUSIVE) {
				$itemTotalColumn = 'total_inc_tax';
			}

			$GLOBALS['OrderTotalRows'] = '';
			$totalRows = getOrderTotalRows($order);
			foreach($totalRows as $id => $totalRow) {
				$GLOBALS['ISC_CLASS_TEMPLATE']->assign('label', $totalRow['label']);
				$GLOBALS['ISC_CLASS_TEMPLATE']->assign('classNameAppend', ucfirst($id));
				$value = currencyConvertFormatPrice(
					$totalRow['value'],
					$row['ordcurrencyid'],
					$row['ordcurrencyexchangerate']
				);
				$GLOBALS['ISC_CLASS_TEMPLATE']->assign('value', $value);
				$GLOBALS['OrderTotalRows'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->getSnippet('AccountOrderTotalRow');
			}

			$OrderProducts = array();
			$ProductIds = array();
			// Load up the items in this order
			$query = "
				SELECT
					o.*,
					op.*,
					oa.address_1,
					oa.address_2,
					oa.city,
					oa.zip,
					oa.country,
					oa.state,
					p.productid,
					p.prodpreorder,
					p.prodreleasedate,
					p.prodpreordermessage
				FROM
					[|PREFIX|]orders o
					LEFT JOIN [|PREFIX|]order_products op ON op.orderorderid
					LEFT JOIN [|PREFIX|]products p ON p.productid = op.ordprodid
					LEFT JOIN [|PREFIX|]order_addresses oa ON oa.`id` = op.order_address_id
				WHERE
					orderorderid = " . (int)$order['orderid'] ."
				ORDER BY
					op.order_address_id";
			$result = $GLOBALS['ISC_CLASS_DB']->Query($query);

			//check if products are reorderable
			while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
				$OrderProducts[$row['orderprodid']] = $row;
				$ProductIds[] = $row['ordprodid'];
			}

			$UnreorderableProducts = $this->GetUnreorderableProducts($OrderProducts, $ProductIds);

			// for grouping of shipping addresses in template output
			$previousAddressId = null;
			$destinationCounter = 0;

			foreach ($OrderProducts as $row) {
				if ($count++ % 2 != 0) {
					$GLOBALS['ItemClass'] = "OrderItem2";
				} else {
					$GLOBALS['ItemClass'] = "OrderItem1";
				}

				$GLOBALS['OrderProductId'] = $row['orderprodid'];
				$GLOBALS['DisableReorder'] = '';

				$GLOBALS['ReorderMessage'] = "";
				$GLOBALS['HideItemMessage'] = 'display:none;';
				if(isset($UnreorderableProducts[$row['orderprodid']])) {
					$GLOBALS['DisableReorder'] = 'Disabled';
					$GLOBALS['ReorderMessage'] = $UnreorderableProducts[$row['orderprodid']];
					if(isset($_REQUEST['reorder']) && $_REQUEST['reorder']==1) {
						$GLOBALS['HideItemMessage'] = '';
					}
				}

				$GLOBALS['Qty'] = (int) $row['ordprodqty'];
				$GLOBALS['Name'] = isc_html_escape($row['ordprodname']);
				$GLOBALS['EventDate'] = '';

				if ($row['ordprodeventdate'] != 0) {
					$GLOBALS['EventDate'] = $row['ordprodeventname'] . ': '. isc_date('M jS Y', $row['ordprodeventdate']);
				}

				// Does the product still exist or has it been deleted?
				$prod_name = GetProdNameById($row['ordprodid']);

				if ($prod_name == "" && $row['ordprodtype'] == 'giftcertificate') {
					$GLOBALS['Link'] = "javascript:product_giftcertificate()";
					$GLOBALS['Target'] = "";
				}else if ($prod_name == "") {
					$GLOBALS['Link'] = "javascript:product_removed()";
					$GLOBALS['Target'] = "";
				}
				else {
					$GLOBALS['Link'] = ProdLink(GetProdNameById($row['ordprodid']));
					$GLOBALS['Target'] = "_blank";
				}

				$GLOBALS['DownloadsLink'] = '';
				if ($row['ordprodtype'] == "digital" && $orderComplete) {
					$GLOBALS['DownloadItemEncrypted'] = $this->EncryptDownloadKey($row['orderprodid'], $row['ordprodid'], $row['orderorderid'], $row['ordtoken']);
					$GLOBALS['DownloadsLink'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("AccountOrderItemDownloadLink");
				}

				$GLOBALS['Refunded'] = '';
				$GLOBALS['StrikeEnd'] = '';
				$GLOBALS['StrikeStart'] = '';

				if ($row['ordprodrefunded'] > 0) {
					if ($row['ordprodrefunded'] == $row['ordprodqty']) {
						$GLOBALS['StrikeStart'] = "<s>";
						$GLOBALS['StrikeEnd'] = "</s>";
						$GLOBALS['Refunded'] = '<span class="Refunded">'.GetLang('OrderProductRefunded').'</span>';
					}
					else {
						$GLOBALS['Refunded'] = '<span class="Refunded">'.sprintf(GetLang('OrderProductsRefundedX'), $row['ordprodrefunded']).'</span>';
					}
				}

				$GLOBALS['Price'] = CurrencyConvertFormatPrice(
					$row[$itemTotalColumn],
					$order['ordcurrencyid'],
					$order['ordcurrencyexchangerate']
				);

				// Were there one or more options selected?
				$GLOBALS['ProductOptions'] = '';
				if($row['ordprodoptions'] != '') {
					$options = @unserialize($row['ordprodoptions']);
					if(!empty($options)) {
						$GLOBALS['ProductOptions'] = "<br /><small class='OrderItemOptions'>(";
						$comma = '';
						foreach($options as $name => $value) {
							$GLOBALS['ProductOptions'] .= $comma.isc_html_escape($name).": ".isc_html_escape($value);
							$comma = ', ';
						}
						$GLOBALS['ProductOptions'] .= ")</small>";
					}
				}

				if($row['ordprodwrapname']) {
					$GLOBALS['GiftWrappingName'] = isc_html_escape($row['ordprodwrapname']);
					$GLOBALS['HideWrappingOptions'] = '';
				}
				else {
					$GLOBALS['GiftWrappingName'] = '';
					$GLOBALS['HideWrappingOptions'] = 'display: none';
				}

				$GLOBALS['HideExpectedReleaseDate'] = 'display:none;';
				$GLOBALS['ExpectedReleaseDate'] = '';

				if ($row['prodpreorder']) {
					if ($row['prodreleasedate']) {
						$message = $row['prodpreordermessage'];
						if (!$message) {
							$message = GetConfig('DefaultPreOrderMessage');
						}
						$GLOBALS['ExpectedReleaseDate'] = '(' . str_replace('%%DATE%%', isc_date(GetConfig('DisplayDateFormat'), $row['prodreleasedate']), $message) . ')';
					} else {
						$GLOBALS['ExpectedReleaseDate'] = '(' . GetLang('PreOrderProduct') . ')';
					}
					$GLOBALS['HideExpectedReleaseDate'] = '';
				}

				$GLOBALS['ItemShippingRow'] = '';
				if ($order['shipping_address_count'] > 1 && ($previousAddressId != $row['order_address_id'])) {
					$destinationCounter++;

					$GLOBALS['Destination_Number'] = GetLang('Destination_Number', array('number' => $destinationCounter));

					$addressLine = array_filter(array(
						$row['address_1'],
						$row['address_2'],
						$row['city'],
						$row['state'],
						$row['zip'],
						$row['country'],
					));

					$GLOBALS['ItemShippingRow_AddressLine'] = Store_String::rightTruncate(implode(', ', $addressLine), 60);

					$GLOBALS['ItemShippingRow'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet('AccountOrderItemShippingRow');
				}

				$GLOBALS['SNIPPETS']['AccountOrderItemRow'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("AccountOrderItemRow");
				$previousAddressId = $row['order_address_id'];
			}

			$GLOBALS['ISC_CLASS_TEMPLATE']->SetPageTitle(sprintf("%s - %s%d", GetConfig('StoreName'), GetLang('OrderIdHash'), $orderId));
			$GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("account_order");
			$GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate();
		}
Example #25
0
 public function SetPanelSettings()
 {
     $_SESSION['you_save'] = 0;
     //blessen
     $GLOBALS['SNIPPETS']['CartItems'] = "";
     $count = 0;
     $subtotal = 0;
     $_SESSION['CHECKOUT'] = array();
     // Get a list of all products in the cart
     $GLOBALS['ISC_CLASS_CART'] = GetClass('ISC_CART');
     $product_array = $GLOBALS['ISC_CLASS_CART']->api->GetProductsInCart();
     /* $cprint = print_r($product_array, true);     
        $q      = "INSERT INTO isc_orderlogs (`ordervalue`) VALUES ('$cprint')";
        $r      = $GLOBALS["ISC_CLASS_DB"]->Query($q); */
     $GLOBALS['AdditionalCheckoutButtons'] = '';
     // Go through all the checkout modules looking for one with a GetSidePanelCheckoutButton function defined
     $ShowCheckoutButton = false;
     if (!empty($product_array)) {
         foreach (GetAvailableModules('checkout', true, true) as $module) {
             if (isset($module['object']->_showBothButtons) && $module['object']->_showBothButtons) {
                 $ShowCheckoutButton = true;
                 $GLOBALS['AdditionalCheckoutButtons'] .= $module['object']->GetCheckoutButton();
             } elseif (method_exists($module['object'], 'GetCheckoutButton')) {
                 $GLOBALS['AdditionalCheckoutButtons'] .= $module['object']->GetCheckoutButton();
             } else {
                 $ShowCheckoutButton = true;
             }
         }
     }
     $GLOBALS['HideMultipleAddressShipping'] = 'display: none';
     if (gzte11(ISC_MEDIUMPRINT) && $GLOBALS['ISC_CLASS_CART']->api->GetNumPhysicalProducts() > 1 && $ShowCheckoutButton && GetConfig("MultipleShippingAddresses")) {
         $GLOBALS['HideMultipleAddressShipping'] = '';
     }
     $GLOBALS['HideCheckoutButton'] = '';
     if (!$ShowCheckoutButton) {
         $GLOBALS['HideCheckoutButton'] = 'display: none';
         $GLOBALS['HideMultipleAddressShippingOr'] = 'display: none';
     }
     $wrappingOptions = $GLOBALS['ISC_CLASS_DATA_STORE']->Read('GiftWrapping');
     if (empty($wrappingOptions)) {
         $publicWrappingOptions = false;
     } else {
         $publicWrappingOptions = true;
     }
     if (!GetConfig('ShowThumbsInCart')) {
         $GLOBALS['HideThumbColumn'] = 'display: none';
         $GLOBALS['ProductNameSpan'] = 2;
     } else {
         $GLOBALS['HideThumbColumn'] = '';
         $GLOBALS['ProductNameSpan'] = 1;
     }
     $wrappingAdjustment = 0;
     $itemTotal = 0;
     $comptotal = 0;
     # To get all the complementary product total -- Baskaran
     $compprice = 0;
     foreach ($product_array as $k => $product) {
         $GLOBALS['CartItemId'] = (int) $product['cartitemid'];
         // 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['GiftCertificateAmount'] = CurrencyConvertFormatPrice($product['giftamount']);
             $GLOBALS['GiftCertificateTo'] = isc_html_escape($product['certificate']['to_name']);
             $GLOBALS["Quantity" . $product['quantity']] = 'selected="selected"';
             $GLOBALS['ProductPrice'] = CurrencyConvertFormatPrice($product['giftamount']);
             $GLOBALS['ProductTotal'] = CurrencyConvertFormatPrice($product['giftamount'] * $product['quantity']);
             $itemTotal += $product['giftamount'] * $product['quantity'];
             $GLOBALS['SNIPPETS']['CartItems'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CartItemGiftCertificate");
         } else {
             $GLOBALS['ProductLink'] = ProdLink($product['data']['prodname']);
             $GLOBALS['ProductAvailability'] = isc_html_escape($product['data']['prodavailability']);
             $GLOBALS['ItemId'] = (int) $product['data']['productid'];
             $GLOBALS['VariationId'] = (int) $product['variation_id'];
             $GLOBALS['ProductQuantity'] = (int) $product['quantity'];
             //blessen
             $GLOBALS['prodretailprice'] = CurrencyConvertFormatPrice($product['data']['prodretailprice']);
             if ($product['data']['prodretailprice'] > $product['data']['prodcalculatedprice']) {
                 $_SESSION['you_save'] += ($product['data']['prodretailprice'] - $product['data']['prodcalculatedprice']) * $product['quantity'];
             }
             //$GLOBALS['saveprice'] =  CurrencyConvertFormatPrice($product['data']['prodretailprice'] - $product['data']['prodcalculatedprice']);
             //blessen
             // Should we show thumbnails in the cart?
             if (GetConfig('ShowThumbsInCart')) {
                 $GLOBALS['ProductImage'] = ImageThumb($product['data']['imagefile'], ProdLink($product['data']['prodname']));
             }
             $GLOBALS['UpdateCartQtyJs'] = "Cart.UpdateQuantity(this.options[this.selectedIndex].value);";
             $GLOBALS['HideCartProductFields'] = 'display:none;';
             $GLOBALS['CartProductFields'] = '';
             $this->GetProductFieldDetails($product['product_fields'], $k);
             $GLOBALS['EventDate'] = '';
             if (isset($product['event_date'])) {
                 $GLOBALS['EventDate'] = '<div style="font-style: italic; font-size:10px; color:gray">(' . $product['event_name'] . ': ' . isc_date('M jS Y', $product['event_date']) . ')</div>';
             }
             // Can this product be wrapped?
             $GLOBALS['GiftWrappingName'] = '';
             $GLOBALS['HideGiftWrappingAdd'] = '';
             $GLOBALS['HideGiftWrappingEdit'] = 'display: none';
             $GLOBALS['HideGiftWrappingPrice'] = 'display: none';
             $GLOBALS['GiftWrappingPrice'] = '';
             $GLOBALS['GiftMessagePreview'] = '';
             $GLOBALS['HideGiftMessagePreview'] = 'display: none';
             $GLOBALS['HideWrappingOptions'] = 'display: none';
             if ($product['data']['prodtype'] == PT_PHYSICAL && $product['data']['prodwrapoptions'] != -1 && $publicWrappingOptions == true) {
                 $GLOBALS['HideWrappingOptions'] = '';
                 if (isset($product['wrapping'])) {
                     $GLOBALS['GiftWrappingName'] = isc_html_escape($product['wrapping']['wrapname']);
                     $GLOBALS['HideGiftWrappingAdd'] = 'display: none';
                     $GLOBALS['HideGiftWrappingEdit'] = '';
                     $GLOBALS['HideGiftWrappingPrice'] = '';
                     $wrappingAdjustment += $product['wrapping']['wrapprice'] * $product['quantity'];
                     $GLOBALS['GiftWrappingPrice'] = CurrencyConvertFormatPrice($product['wrapping']['wrapprice']);
                     if (isset($product['wrapping']['wrapmessage'])) {
                         if (isc_strlen($product['wrapping']['wrapmessage']) > 30) {
                             $product['wrapping']['wrapmessage'] = substr($product['wrapping']['wrapmessage'], 0, 27) . '...';
                         }
                         $GLOBALS['GiftMessagePreview'] = isc_html_escape($product['wrapping']['wrapmessage']);
                         if ($product['wrapping']['wrapmessage']) {
                             $GLOBALS['HideGiftMessagePreview'] = '';
                         }
                     }
                 }
             }
             $subtotalPrice = 0;
             if (isset($product['discount_price'])) {
                 $subtotalPrice = $product['discount_price'];
             } else {
                 $subtotalPrice = $product['product_price'];
             }
             $GLOBALS['ShowOnSaleImage'] = '';
             if (isset($product['discount_price']) && $product['discount_price'] != $product['original_price'] && GetConfig('ShowOnSale')) {
                 $GLOBALS['ProductPrice'] = sprintf("<s class='CartStrike'>%s</s> %s", CurrencyConvertFormatPrice($product['original_price']), CurrencyConvertFormatPrice($subtotalPrice));
                 if (isset($product['discount']) && isset($product['couponcode'])) {
                     $GLOBALS['ShowOnSaleImage'] = "Coupon Applied";
                 } else {
                     $GLOBALS['ShowOnSaleImage'] = '<img id="OnSale" src="' . GetConfig('ShopPath') . '/templates/default/images/onsale.gif" alt="">';
                 }
             } else {
                 $GLOBALS['ProductPrice'] = CurrencyConvertFormatPrice($subtotalPrice);
             }
             $GLOBALS['ProductTotal'] = CurrencyConvertFormatPrice($subtotalPrice * $product['quantity']);
             $itemTotal += $subtotalPrice * $product['quantity'];
             // If we're using a cart quantity drop down, load that
             if (GetConfig('TagCartQuantityBoxes') == 'dropdown') {
                 $GLOBALS["Quantity" . $product['quantity']] = "selected=\"selected\"";
                 if (isset($GLOBALS["Quantity0"])) {
                     $GLOBALS['QtyOptionZero'] = "<option " . $GLOBALS["Quantity0"] . " value='0'>0</option>";
                 } else {
                     $GLOBALS['QtyOptionZero'] = "<option value='0'>0</option>";
                 }
                 // Fixes products being displayed with '0' quantity when the quantity is greater than 30 (hard coded limit in snippet)
                 if ($product['quantity'] > 30) {
                     $GLOBALS["QtyOptionSelected"] = "<option " . $GLOBALS["Quantity" . $product['quantity']] . " value='" . $product['quantity'] . "'>" . $product['quantity'] . "</option>";
                 }
                 $GLOBALS['CartItemQty'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CartItemQtySelect");
             } else {
                 $GLOBALS['CartItemQty'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CartItemQtyText");
             }
             // 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>";
             }
             //temp script to shortern the product name
             $pid = $product['data']['productid'];
             $pcode = $product['data']['prodcode'];
             $querytemp = "SELECT prodbrandid FROM  [|PREFIX|]products where productid = " . $pid . "  ";
             $resulttemp = $GLOBALS['ISC_CLASS_DB']->Query($querytemp);
             $brand = $GLOBALS['ISC_CLASS_DB']->Fetch($resulttemp);
             if ($brand['prodbrandid'] == 37) {
                 $querytemp1 = "SELECT c.catname, c.catcombine FROM [|PREFIX|]categories \tc left join [|PREFIX|]categoryassociations ca on c.categoryid = ca.categoryid  left join [|PREFIX|]products p on ca.productid = p.productid where p.productid =  '" . $pid . "' ";
                 $resulttemp1 = $GLOBALS['ISC_CLASS_DB']->Query($querytemp1);
                 $cat = $GLOBALS['ISC_CLASS_DB']->Fetch($resulttemp1);
                 if ($cat['catcombine'] != "") {
                     $GLOBALS['ProductName'] = $cat['catcombine'] . " Part Number " . $pcode;
                 } else {
                     $GLOBALS['ProductName'] = $cat['catname'] . " Part Number " . $pcode;
                 }
             } else {
                 $GLOBALS['ProductName'] = isc_html_escape($product['data']['prodname']);
             }
             //temp script to shortern the product name
             //temp script to shortern the product name
             $GLOBALS['complementaryrow'] = '';
             $compitem = $product['compitem'];
             if ($compitem == 1) {
                 for ($y = 0; $y < count($product['complementary']); $y++) {
                     /* Added for to display the complementary product in the cart -- Baskaran */
                     $compproductid = $product['complementary'][$y]['comp_productid'];
                     $compmainproductid = $product['complementary'][$y]['comp_mainproductid'];
                     $mainproductid = $product['product_id'];
                     $GLOBALS['CompCartItemId'] = $y;
                     if ($mainproductid == $compmainproductid) {
                         $GLOBALS['CompProdName'] = $compprodname = isc_html_escape($product['complementary'][$y]['comp_product_name']);
                         $compsku = isc_html_escape($product['complementary'][$y]['comp_product_code']);
                         $compprice = $product['complementary'][$y]['comp_original_price'];
                         $GLOBALS['CompProductPrice'] = $comppriceformat = CurrencyConvertFormatPrice($product['complementary'][$y]['comp_original_price']);
                         $query = $GLOBALS["ISC_CLASS_DB"]->Query("SELECT imagefile FROM [|PREFIX|]products p LEFT JOIN [|PREFIX|]product_images i ON p.productid = i.imageprodid AND i.imageisthumb = '1' where p.productid = '{$compproductid}' AND p.prodvisible = '1' ");
                         $path = '';
                         if ($row = $GLOBALS["ISC_CLASS_DB"]->Fetch($query)) {
                             $path = $row['imagefile'];
                         }
                         if ($path != '') {
                             $GLOBALS['ProdImage'] = GetConfig('ShopPath') . "/product_images/{$path}";
                         } else {
                             $GLOBALS['ProdImage'] = GetConfig('ShopPath') . "/templates/CongoWorld/images/ProductDefault.gif";
                         }
                         //Added for complementary products - By Simha..
                         // If we're using a cart quantity drop down, load that
                         if (GetConfig('TagCartQuantityBoxes') == 'dropdown') {
                             $GLOBALS["CompQuantity" . $product['complementary'][$y]['quantity']] = "selected=\"selected\"";
                             if (isset($GLOBALS["Quantity0"])) {
                                 $GLOBALS['CompCartQtyOptionZero'] = "<option " . $GLOBALS["Quantity0"] . " value='0'>0</option>";
                             } else {
                                 $GLOBALS['CompCartQtyOptionZero'] = "<option value='0'>0</option>";
                             }
                             // Fixes products being displayed with '0' quantity when the quantity is greater than 30 (hard coded limit in snippet)
                             if ($product['quantity'] > 30) {
                                 //Needed to be changed for the complementary
                                 $GLOBALS["CompCartQtyOptionSelected"] = "<option " . $GLOBALS["Quantity" . $product['complementary'][$y]['quantity']] . " value='" . $product['complementary'][$y]['quantity'] . "'>" . $product['complementary'][$y]['quantity'] . "</option>";
                             }
                             $GLOBALS['CompCartItemQty'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CompItemQtySelect");
                         } else {
                             $GLOBALS['CompCartItemQty'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CompItemQtyText");
                         }
                         //Added for complementary products Ends - By Simha..
                         $GLOBALS['CompProductTotal'] = CurrencyConvertFormatPrice($compprice * $product['complementary'][$y]['quantity']);
                         $GLOBALS['complementaryrow'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ComplementaryItem");
                         $comptotal += $compprice * $product['complementary'][$y]['quantity'];
                     }
                     $GLOBALS["CompQuantity" . $product['complementary'][$y]['quantity']] = "";
                 }
             }
             /* Code Ends */
             //$GLOBALS['ProductName'] = isc_html_escape($product['data']['prodname']);
             //blessen
             $withoutdollar = str_replace("\$", "", $GLOBALS['prodretailprice']);
             if (intval($withoutdollar) <= 0) {
                 $GLOBALS['SNIPPETS']['CartItems'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CartItem");
             } else {
                 $GLOBALS['SNIPPETS']['CartItems'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CartItem1");
             }
             //blessen
             // original $GLOBALS['SNIPPETS']['CartItems'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CartItem");
         }
         $GLOBALS["Quantity" . $product['quantity']] = "";
     }
     if ($wrappingAdjustment > 0) {
         $GLOBALS['GiftWrappingTotal'] = CurrencyConvertFormatPrice($wrappingAdjustment);
     } else {
         $GLOBALS['HideGiftWrappingTotal'] = 'display: none';
     }
     $GLOBALS['HideAdjustedTotal'] = "none";
     $GLOBALS['AdjustedCartSubTotal'] = $GLOBALS['CartSubTotal'] - $GLOBALS['CartSubTotalDiscount'];
     $itemTotal += $comptotal;
     # Baskaran
     $GLOBALS['CartItemTotal'] = CurrencyConvertFormatPrice($itemTotal);
     $GLOBALS['SNIPPETS']['Coupons'] = '';
     $coupons = $GLOBALS['ISC_CLASS_CART']->api->GetAppliedCouponCodes();
     if (count($coupons)) {
         foreach ($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("CartCoupon");
         }
     }
     $GLOBALS['SNIPPETS']['GiftCertificates'] = '';
     // Has the customer chosen one or more gift certificates to apply to this order? We need to show them
     if (isset($_SESSION['CART']['GIFTCERTIFICATES']) && is_array($_SESSION['CART']['GIFTCERTIFICATES'])) {
         $certificates = $_SESSION['CART']['GIFTCERTIFICATES'];
         uasort($certificates, "GiftCertificateSort");
         foreach ($certificates as $certificate) {
             $GLOBALS['GiftCertificateCode'] = isc_html_escape($certificate['giftcertcode']);
             $GLOBALS['GiftCertificateId'] = $certificate['giftcertid'];
             $GLOBALS['GiftCertificateBalance'] = $certificate['giftcertbalance'];
             if ($GLOBALS['GiftCertificateBalance'] > $GLOBALS['AdjustedCartSubTotal']) {
                 $GLOBALS['GiftCertificateRemaining'] = $certificate['giftcertbalance'] - $GLOBALS['AdjustedCartSubTotal'];
                 $GLOBALS['CertificateAmountUsed'] = $certificate['giftcertbalance'] - $GLOBALS['GiftCertificateRemaining'];
             } else {
                 $GLOBALS['CertificateAmountUsed'] = $certificate['giftcertbalance'];
                 $GLOBALS['GiftCertificateRemaining'] = 0;
             }
             // Subtract this amount from the adjusted total
             $GLOBALS['AdjustedCartSubTotal'] -= $GLOBALS['GiftCertificateBalance'];
             if ($GLOBALS['AdjustedCartSubTotal'] <= 0) {
                 $GLOBALS['AdjustedCartSubTotal'] = 0;
             }
             $GLOBALS['GiftCertificateBalance'] = CurrencyConvertFormatPrice($GLOBALS['GiftCertificateBalance']);
             $GLOBALS['GiftCertificateRemaining'] = CurrencyConvertFormatPrice($GLOBALS['GiftCertificateRemaining']);
             $GLOBALS['CertificateAmountUsed'] = CurrencyConvertFormatPrice($GLOBALS['CertificateAmountUsed']);
             $GLOBALS['SNIPPETS']['GiftCertificates'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CartGiftCertificate");
         }
         if ($GLOBALS['SNIPPETS']['GiftCertificates']) {
             $GLOBALS['HideAdjustedTotal'] = '';
             if ($GLOBALS['AdjustedCartSubTotal'] == 0) {
                 $GLOBALS['HidePanels'][] = "SideGiftCertificateCodeBox";
             }
         }
     }
     if ($GLOBALS['AdjustedCartSubTotal'] != $GLOBALS['CartSubTotal']) {
         $GLOBALS['HideAdjustedTotal'] = "";
         $GLOBALS['AdjustedCartSubTotal'] = CurrencyConvertFormatPrice($GLOBALS['AdjustedCartSubTotal']);
     }
     //            $GLOBALS['CartSubTotal'] = CurrencyConvertFormatPrice($GLOBALS['CartSubTotal']);
     $GLOBALS['CartSubTotal'] = CurrencyConvertFormatPrice($GLOBALS['CartSubTotal'] + $comptotal);
     # To add the subtotal in the cart -- Baskaran
     $GLOBALS['CartSaveTotal'] = CurrencyConvertFormatPrice($_SESSION['you_save']);
     //blessen
     if (!gzte11(ISC_LARGEPRINT)) {
         $GLOBALS['HidePanels'][] = "SideGiftCertificateCodeBox";
     }
     // Are there any products in the cart?
     if ($GLOBALS['ISC_CLASS_CART']->api->GetNumProductsInCart() == 0) {
         $GLOBALS['HideShoppingCartGrid'] = "none";
     } else {
         $GLOBALS['HideShoppingCartEmptyMessage'] = "none";
     }
 }
 /**
  * _BuildTabMenu
  * Build the menu of tabs that appears at the top of the control panel
  *
  * @return String
  */
 private function _BuildTabMenu()
 {
     $menu = "";
     // Get an array of permissions for the selected user
     $arrPermissions = $GLOBALS["ISC_CLASS_ADMIN_AUTH"]->GetPermissions();
     $show_manage_products = in_array(AUTH_Manage_Products, $arrPermissions) || in_array(AUTH_Manage_Reviews, $arrPermissions) || in_array(AUTH_Create_Product, $arrPermissions) || in_array(AUTH_Import_Products, $arrPermissions);
     $show_manage_categories = in_array(AUTH_Manage_Categories, $arrPermissions) || in_array(AUTH_Create_Category, $arrPermissions);
     $show_manage_orders = in_array(AUTH_Manage_Orders, $arrPermissions) || in_array(AUTH_Add_Orders, $arrPermissions) || in_array(AUTH_Export_Orders, $arrPermissions) || in_array(AUTH_Manage_Returns, $arrPermissions);
     $show_import_tracking_number = in_array(AUTH_Manage_Orders, $arrPermissions) && in_array(AUTH_Import_Order_Tracking_Numbers, $arrPermissions) && gzte11(ISC_MEDIUMPRINT);
     $show_manage_customers = in_array(AUTH_Manage_Customers, $arrPermissions) || in_array(AUTH_Add_Customer, $arrPermissions) || in_array(AUTH_Import_Customers, $arrPermissions);
     // If Interspire Email Marketer is integrated and setup to handle newsletter subscribers then we'll take them
     // to the login page. If not we'll just export from the subscribers table in CSV format
     if (GetConfig('MailXMLAPIValid') && GetConfig('UseMailerForNewsletter') && GetConfig('MailNewsletterList') > 0) {
         $mailer_link = str_replace("xml.php", "admin", GetConfig('MailXMLPath'));
         $subscriber_link = sprintf("javascript:LaunchMailer('%s')", $mailer_link);
         $subscriber_class = '';
     } else {
         $subscriber_link = "index.php?ToDo=exportSubscribersIntro&height=260&width=400";
         $subscriber_class = 'thickbox';
     }
     $menuItems = array('mnuOrders' => array('match' => array('order', 'shipment'), 'items' => array(array('text' => GetLang('ViewOrders'), 'help' => GetLang('ViewOrdersMenuHelp'), 'icon' => 'order.gif', 'link' => 'index.php?ToDo=viewOrders', 'show' => $show_manage_orders), array('text' => GetLang('AddAnOrder'), 'help' => GetLang('AddOrderMenuHelp'), 'icon' => 'order_add.gif', 'link' => 'index.php?ToDo=addOrder', 'show' => in_array(AUTH_Add_Orders, $arrPermissions)), array('text' => GetLang('SearchOrders'), 'help' => GetLang('SearchOrdersMenuHelp'), 'icon' => 'find.gif', 'link' => 'index.php?ToDo=searchOrders', 'show' => $show_manage_orders), array('text' => GetLang('ExportOrdersMenu'), 'help' => GetLang('ExportOrdersMenuHelp'), 'icon' => 'export.gif', 'link' => 'index.php?ToDo=startExport&t=orders', 'show' => in_array(AUTH_Export_Orders, $arrPermissions) && gzte11(ISC_MEDIUMPRINT)), array('text' => GetLang('ViewShipments'), 'help' => GetLang('ViewShipmentsHelp'), 'icon' => 'shipments.gif', 'link' => 'index.php?ToDo=viewShipments', 'show' => $show_manage_orders), array('text' => GetLang('ViewReturns'), 'help' => GetLang('ViewReturnsMenuHelp'), 'icon' => 'return.gif', 'link' => 'index.php?ToDo=viewReturns', 'show' => in_array(AUTH_Manage_Returns, $arrPermissions) && GetConfig('EnableReturns') && gzte11(ISC_LARGEPRINT)), array('text' => GetLang('ImportOrdertrackingnumbers'), 'help' => GetLang('ImportOrdertrackingnumbersMenuHelp'), 'icon' => 'import.gif', 'link' => 'index.php?ToDo=importOrdertrackingnumbers', 'show' => $show_import_tracking_number))), 'mnuCustomers' => array('match' => 'customer', 'items' => array(array('text' => GetLang('ViewCustomers'), 'help' => GetLang('ViewCustomersMenuHelp'), 'icon' => 'customer.gif', 'link' => 'index.php?ToDo=viewCustomers', 'show' => $show_manage_customers), array('text' => GetLang('AddCustomers'), 'help' => GetLang('AddCustomersMenuHelp'), 'icon' => 'customers_add.gif', 'link' => 'index.php?ToDo=addCustomer', 'show' => in_array(AUTH_Add_Customer, $arrPermissions)), array('text' => GetLang('CustomerGroups'), 'help' => GetLang('CustomerGroupsMenuHelp'), 'icon' => 'customer_group.gif', 'link' => 'index.php?ToDo=viewCustomerGroups', 'show' => in_array(AUTH_Customer_Groups, $arrPermissions) && gzte11(ISC_MEDIUMPRINT)), array('text' => GetLang('SearchCustomers'), 'help' => GetLang('SearchCustomersMenuHelp'), 'icon' => 'find.gif', 'link' => 'index.php?ToDo=searchCustomers', 'show' => $show_manage_customers), array('text' => GetLang('ImportCustomers'), 'help' => GetLang('ImportCustomersMenuHelp'), 'icon' => 'import.gif', 'link' => 'index.php?ToDo=importCustomers', 'show' => in_array(AUTH_Import_Customers, $arrPermissions)), array('text' => GetLang('ExportCustomersMenu'), 'help' => GetLang('ExportCustomersMenuHelp'), 'icon' => 'export.gif', 'link' => 'index.php?ToDo=startExport&t=customers', 'show' => in_array(AUTH_Export_Customers, $arrPermissions) && gzte11(ISC_MEDIUMPRINT)), array('text' => GetLang('WishListCustomers'), 'help' => GetLang('WishListCustomersMenuHelp'), 'icon' => 'customers_add.gif', 'link' => 'index.php?ToDo=wishlist', 'show' => in_array(AUTH_Add_Customer, $arrPermissions)))), 'mnuProducts' => array('match' => array('product', 'review', 'categor'), 'items' => array(array('text' => GetLang('ViewProducts'), 'help' => GetLang('ViewProductsMenuHelp'), 'icon' => 'product.gif', 'link' => 'index.php?ToDo=viewProducts', 'show' => $show_manage_products), array('text' => GetLang('AddProduct'), 'help' => GetLang('AddProductMenuHelp'), 'icon' => 'product_add.gif', 'link' => 'index.php?ToDo=addProduct', 'show' => in_array(AUTH_Create_Product, $arrPermissions)), array('text' => GetLang('ViewCategories'), 'help' => GetLang('ViewCategoriesMenuHelp'), 'icon' => 'category.gif', 'link' => 'index.php?ToDo=viewCategories', 'show' => $show_manage_categories), array('text' => GetLang('ProductVariations'), 'help' => GetLang('ProductVariationsMenuHelp'), 'icon' => 'product_variation.gif', 'link' => 'index.php?ToDo=viewProductVariations', 'show' => in_array(AUTH_Manage_Variations, $arrPermissions)), array('text' => GetLang('SearchProducts'), 'help' => GetLang('SearchProductsMenuHelp'), 'icon' => 'find.gif', 'link' => 'index.php?ToDo=searchProducts', 'show' => $show_manage_products), array('text' => GetLang('ImportProducts'), 'help' => GetLang('ImportProductsMenuHelp'), 'icon' => 'import.gif', 'link' => 'index.php?ToDo=importProducts', 'show' => in_array(AUTH_Import_Products, $arrPermissions)), array('text' => GetLang('ExportProductsMenu'), 'help' => GetLang('ExportProductsMenuHelp'), 'icon' => 'export.gif', 'link' => 'index.php?ToDo=startExport&t=products', 'show' => in_array(AUTH_Export_Products, $arrPermissions) && gzte11(ISC_MEDIUMPRINT)), array('text' => GetLang('ManageReviews'), 'help' => GetLang('ViewReviewsMenuHelp'), 'icon' => 'comment_view.gif', 'link' => 'index.php?ToDo=viewReviews', 'show' => in_array(AUTH_Manage_Reviews, $arrPermissions)), array('text' => GetLang('SettingsNew'), 'help' => GetLang('SettingsHelp'), 'icon' => 'product_add.gif', 'link' => '#', 'show' => in_array(AUTH_Manage_Brands, $arrPermissions), 'items' => array(array('text' => GetLang('ValidMMY'), 'help' => GetLang('ViewMMYHelp'), 'icon' => 'brand_menu.gif', 'link' => 'index.php?ToDo=viewMMY', 'show' => in_array(AUTH_Manage_Brands, $arrPermissions)), array('text' => GetLang('QualifierAssociations'), 'help' => GetLang('QualifierAssociationsHelp'), 'icon' => 'category.gif', 'link' => 'index.php?ToDo=viewQualifierAssociations', 'show' => in_array(AUTH_Qualifier_Associations, $arrPermissions)), array('text' => GetLang('QValueAssociations'), 'help' => GetLang('QValueAssociationsHelp'), 'icon' => 'category.gif', 'link' => 'index.php?ToDo=viewQValueAssociations', 'show' => in_array(AUTH_QValue_Associations, $arrPermissions)))), array('text' => GetLang('ViewBrands'), 'help' => GetLang('ViewBrandsHelp'), 'icon' => 'brand_menu.gif', 'link' => 'index.php?ToDo=viewBrands', 'show' => in_array(AUTH_Manage_Brands, $arrPermissions)), array('text' => GetLang('ImportLog'), 'help' => GetLang('ImportLogHelp'), 'icon' => 'import.gif', 'link' => 'index.php?ToDo=viewImportlog', 'show' => in_array(AUTH_Import_Products, $arrPermissions)), array('text' => GetLang('FileManagement'), 'help' => GetLang('FileManagementHelp'), 'icon' => 'category.gif', 'link' => 'index.php?ToDo=viewFileManagement', 'show' => in_array(AUTH_QValue_Associations, $arrPermissions)), array('text' => GetLang('ChangesReport'), 'help' => GetLang('ChangesReportHelp'), 'icon' => 'category.gif', 'link' => 'index.php?ToDo=viewChangesReport', 'show' => in_array(AUTH_Changes_Report, $arrPermissions)))), 'mnuContent' => array('match' => array('news', 'page'), 'ignore' => array('vendor'), 'items' => array(array('text' => GetLang('ViewNews'), 'help' => GetLang('ViewNewsMenuHelp'), 'icon' => 'news.gif', 'link' => 'index.php?ToDo=viewNews', 'show' => in_array(AUTH_Manage_News, $arrPermissions)), array('text' => GetLang('AddNews'), 'help' => GetLang('AddNewsMenuHelp'), 'icon' => 'news_add.gif', 'link' => 'index.php?ToDo=addNews', 'show' => in_array(AUTH_Manage_News, $arrPermissions)), array('text' => GetLang('ViewWebPages'), 'help' => GetLang('ViewWebPagesMenuHelp'), 'icon' => 'page.gif', 'link' => 'index.php?ToDo=viewPages', 'show' => in_array(AUTH_Manage_Pages, $arrPermissions)), array('text' => GetLang('CreateAWebPage'), 'help' => GetLang('CreateWebPageMenuHelp'), 'icon' => 'page_add.gif', 'link' => 'index.php?ToDo=createPage', 'show' => in_array(AUTH_Manage_Pages, $arrPermissions)))), 'mnuPromotions' => array('match' => array('coupon', 'banner', 'discount', 'giftcertificates'), 'items' => array(array('text' => GetLang('ViewBanners'), 'help' => GetLang('ViewBannersMenuHelp'), 'icon' => 'banner.gif', 'link' => 'index.php?ToDo=viewBanners', 'show' => in_array(AUTH_Manage_Banners, $arrPermissions)), array('text' => GetLang('ViewCoupons'), 'help' => GetLang('ViewCouponsMenuHelp'), 'icon' => 'coupon.gif', 'link' => 'index.php?ToDo=viewCoupons', 'show' => in_array(AUTH_Manage_Coupons, $arrPermissions)), array('text' => GetLang('CouponsSettings'), 'help' => GetLang('CouponsSettingsMenuHelp'), 'icon' => 'coupon.gif', 'link' => 'index.php?ToDo=Couponssettings', 'show' => in_array(AUTH_Manage_Coupons, $arrPermissions)), array('text' => GetLang('ViewDiscounts'), 'help' => GetLang('ViewDiscountsMenuHelp'), 'icon' => 'discountrule.gif', 'link' => 'index.php?ToDo=viewDiscounts', 'show' => in_array(AUTH_Manage_Discounts, $arrPermissions) && gzte11(ISC_MEDIUMPRINT)), array('text' => GetLang('ViewGiftCertificates'), 'help' => GetLang('ViewGiftCertificatesMenuHelp'), 'icon' => 'giftcertificate.gif', 'link' => 'index.php?ToDo=viewGiftCertificates', 'show' => in_array(AUTH_Manage_GiftCertificates, $arrPermissions) && gzte11(ISC_LARGEPRINT)), array('text' => GetLang('NewsletterSubscribers'), 'help' => GetLang('ViewSubscribersMenuHelp'), 'icon' => 'subscriber.gif', 'link' => $subscriber_link, 'class' => $subscriber_class, 'show' => in_array(AUTH_Newsletter_Subscribers, $arrPermissions)), array('text' => GetLang('CreateFroogleFeed'), 'help' => GetLang('GoogleProductsFeedMenuHelp'), 'icon' => 'google.gif', 'link' => 'index.php?ToDo=exportFroogleIntro&height=260&width=400', 'class' => 'thickbox', 'show' => in_array(AUTH_Export_Froogle, $arrPermissions)))), 'mnuStatistics' => array('match' => 'stats', 'items' => array(array('text' => GetLang('StoreOverview'), 'help' => GetLang('StoreOverviewMenuHelp'), 'icon' => 'stats_overview.gif', 'link' => 'index.php?ToDo=viewStats', 'show' => in_array(AUTH_Statistics_Overview, $arrPermissions)), array('text' => GetLang('OrderStatistics'), 'help' => GetLang('OrderStatsMenuHelp'), 'icon' => 'stats_orders.gif', 'link' => 'index.php?ToDo=viewOrdStats', 'show' => in_array(AUTH_Statistics_Orders, $arrPermissions)), array('text' => GetLang('ProductStatistics'), 'help' => GetLang('ProductStatsMenuHelp'), 'icon' => 'stats_products.gif', 'link' => 'index.php?ToDo=viewProdStats', 'show' => in_array(AUTH_Statistics_Products, $arrPermissions)), array('text' => GetLang('CustomerStatistics'), 'help' => GetLang('CustomerStatsMenuHelp'), 'icon' => 'stats_customers.gif', 'link' => 'index.php?ToDo=viewCustStats', 'show' => in_array(AUTH_Statistics_Customers, $arrPermissions)), array('text' => GetLang('SearchStatistics'), 'help' => GetLang('SearchStatsHelp'), 'icon' => 'stats_search.gif', 'link' => 'index.php?ToDo=viewSearchStats', 'show' => in_array(AUTH_Statistics_Search, $arrPermissions)))));
     // Now that we've loaded the default menu, let's check if there are any addons we need to load
     $this->_LoadAddons($menuItems);
     $imagesDir = dirname(__FILE__) . '/../../images';
     $menu = "\n" . '<div id="headerMenu">' . "\n" . '<ul>' . "\n";
     foreach ($menuItems as $image => $link) {
         // By default we wont highlight this tab
         $highlight_tab = false;
         if ($link['match'] && isset($_REQUEST['ToDo'])) {
             // If the URI matches the "match" index, we'll highlight the tab
             $page = @isc_strtolower($_REQUEST['ToDo']);
             if (isset($GLOBALS['HighlightedMenuItem']) && $GLOBALS['HighlightedMenuItem'] == $image) {
                 $highlight_tab = true;
             }
             // Does it need to match mutiple words?
             if (is_array($link['match'])) {
                 foreach ($link['match'] as $match_it) {
                     if ($match_it == "") {
                         continue;
                     }
                     if (is_numeric(isc_strpos($page, isc_strtolower($match_it)))) {
                         $highlight_tab = true;
                     }
                 }
             } else {
                 if (is_numeric(isc_strpos($page, $link['match']))) {
                     $highlight_tab = true;
                 }
             }
             if (isset($link['ignore']) && is_array($link['ignore'])) {
                 foreach ($link['ignore'] as $ignore) {
                     if (isc_strpos($page, strtolower($ignore)) !== false) {
                         $highlight_tab = false;
                     }
                 }
             }
         }
         // If the menu has sub menus, display them
         if (is_array($link['items'])) {
             $first = true;
             $shown = false;
             foreach ($link['items'] as $id => $sub) {
                 if (is_numeric($id)) {
                     // If the child is forbidden by law, hide it
                     if (@(!$sub['show'])) {
                         continue;
                     } else {
                         $shown = true;
                     }
                     // If its the first born, give it an image
                     if ($first) {
                         $menu .= '<li class="dropdown';
                         if ($highlight_tab) {
                             $menu .= ' dropselected';
                         }
                         $menu .= '"><a href="' . $sub['link'] . '">';
                         $class = $image;
                         if ($highlight_tab) {
                             $image .= "On";
                         }
                         $filename = $imagesDir . DIRECTORY_SEPARATOR . $image . '.gif';
                         if (file_exists($filename)) {
                             list($width, $height, $type, $attr) = getimagesize($filename);
                             $menu .= '<img ' . $attr . ' src="images/' . $image . '.gif" border="0" style="padding-right:2px" />';
                         } else {
                             $menu .= $image;
                         }
                         $menu .= '</a>' . "\n";
                         if (count($link) > 1) {
                             $menu .= '<ul>' . "\n";
                         }
                         $first = false;
                     }
                     // If it's not an only child, don't show the first item as a child
                     if (count($link) > 1) {
                         $extraclass = '';
                         if (isset($sub['class'])) {
                             $extraclass = $sub['class'];
                         }
                         // Is there help text set for this item?
                         if (isset($sub['help'])) {
                             if (isset($sub['is_addon'])) {
                                 $icon = $sub['icon'];
                             } else {
                                 $icon = "images/" . $sub['icon'];
                             }
                             if (@is_array($sub['items'])) {
                                 $subsub = $this->GetSubSub($sub);
                             } else {
                                 $subsub = '';
                             }
                             $menu .= '<li><a style="background-image: url(' . $icon . ');" class="menu_' . $class . ' ' . $extraclass . '" href="' . $sub['link'] . '" onclick="closeMenu()"><strong>' . $sub['text'] . '</strong><span>' . $sub['help'] . '</span></a>' . $subsub . '</li>' . "\n";
                         } else {
                             $menu .= '<li><a class="menu_' . $class . ' ' . $extraclass . '" href="' . $sub['link'] . '">' . $sub['text'] . '</a></li>' . "\n";
                         }
                     }
                 }
             }
             if ($shown) {
                 if (count($link) > 1) {
                     $menu .= '</ul>' . "\n";
                 }
                 $menu .= '</li>' . "\n";
             }
         }
     }
     $menu .= '</ul></div>' . "\n";
     return $menu;
 }
Example #27
0
		/**
		 * Validate the submitted shipping address form data
		 *
		 * Method will validate all the shipping address data
		 *
		 * @access private
		 * @param array $fields The form fields to save
		 * @param string &$errmsg The referenced string to store the error message in
		 * @return bool TRUE if the validation was successful, FALSE if not
		 */
		private function vaidateAddressFields($fields, &$errmsg)
		{
			if (!is_array($fields)) {
				return false;
			}

			$phoneNo = '';
			$validateCustomFields = true;

			if (!gzte11(ISC_MEDIUMPRINT)) {
				$validateCustomFields = false;
			}

			foreach (array_keys($fields) as $fieldId) {

				/**
				 * Only validate the customer fields (non private) if we are allowed to
				 */
				if ($fields[$fieldId]->record['formfieldprivateid'] == '' && !$validateCustomFields) {
					continue;
				}

				if (!$fields[$fieldId]->runValidation($errmsg)) {
					return false;
				}

				if (strtolower($fields[$fieldId]->record['formfieldprivateid']) == 'phone') {
					$phoneNo = $fields[$fieldId]->getValue();
				}
			}

			if ($phoneNo !== '') {
				$GLOBALS['ISC_CLASS_CUSTOMER'] = GetClass('ISC_CUSTOMER');
				if (!$GLOBALS['ISC_CLASS_CUSTOMER']->ValidatePhoneNumber($phoneNo)) {
					$errmsg = stripslashes(GetLang('CustomerAddressPhoneInvalid'));
					return false;
				}
			}

			return true;
		}
Example #28
0
 public function SetPanelSettings()
 {
     $GLOBALS['ISC_CLASS_CUSTOMER'] = GetClass('ISC_CUSTOMER');
     $customerid = $GLOBALS['ISC_CLASS_CUSTOMER']->GetCustomerId();
     if ($GLOBALS['EnableSEOUrls'] == 1) {
         $GLOBALS['account_inbox'] = "account/inbox";
         $GLOBALS['account_order_status'] = "account/order_status";
         $GLOBALS['account_view_orders'] = "account/view_orders";
         $GLOBALS['account_view_returns'] = "account/view_returns";
         $GLOBALS['account_address_book'] = "account/address_book";
         $GLOBALS['wishlist'] = "wishlist";
         $GLOBALS['account_account_details'] = "account/account_details";
         $GLOBALS['account_recent_items'] = "account/recent_items";
         $GLOBALS['account_reports'] = "account/reports";
         $GLOBALS['account_uploadimage'] = "account/uploadimage";
         $GLOBALS['account_uploadimages'] = "account/uploadimages";
         $GLOBALS['account_showimage'] = "account/showimage";
         $GLOBALS['account_logout'] = "logout";
     } else {
         $GLOBALS['account_inbox'] = "account.php?action=inbox";
         $GLOBALS['account_order_status'] = "account.php?action=order_status";
         $GLOBALS['account_view_orders'] = "account.php?action=view_orders";
         $GLOBALS['account-view_returns'] = "account.php?action=view_returns";
         $GLOBALS['account_address_book'] = "account.php?action=address_book";
         $GLOBALS['wishlist'] = "wishlist.php";
         $GLOBALS['account_account_details'] = "account.php?action=account_details";
         $GLOBALS['account_recent_items'] = "account.php?action=recent_items";
         $GLOBALS['account_reports'] = "account.php?action=reports";
         $GLOBALS['account_uploadimage'] = "account.php?action=uploadimage";
         $GLOBALS['account_uploadimages'] = "account.php?action=uploadimages";
         $GLOBALS['account_showimage'] = "account.php?action=showimage";
         $GLOBALS['account_logout'] = "account.php?action=logout";
     }
     if (gzte11(ISC_LARGEPRINT)) {
         // Get the number of new messages for this customer
         $order_ids = "";
         $query = sprintf("select orderid from [|PREFIX|]orders where ordcustid='%d'", $GLOBALS['ISC_CLASS_DB']->Quote($customerid));
         $result = $GLOBALS['ISC_CLASS_DB']->Query($query);
         while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
             $order_ids .= sprintf("%s,", $row['orderid']);
         }
         $order_ids = rtrim($order_ids, ",");
         if ($order_ids != "") {
             $query = sprintf("select count(messageid) as num from [|PREFIX|]order_messages where messageorderid in (%s) and messagefrom='admin' and messagestatus='unread'", $GLOBALS['ISC_CLASS_DB']->Quote($order_ids));
             $GLOBALS['NumNewMessages'] = $GLOBALS['ISC_CLASS_DB']->FetchOne($query);
         } else {
             $GLOBALS['NumNewMessages'] = 0;
         }
     } else {
         $GLOBALS['HideMessagesMenu'] = "none";
     }
     // Do we want to show or hide the return requests menu item?
     if (gzte11(ISC_LARGEPRINT) && GetConfig('EnableReturns') == 1) {
         $query = sprintf("SELECT returnid FROM [|PREFIX|]returns WHERE retcustomerid='%d'", $GLOBALS['ISC_CLASS_DB']->Quote($customerid));
         if (!$GLOBALS['ISC_CLASS_DB']->FetchOne($query)) {
             $GLOBALS['HideReturnRequestsMenu'] = "none";
         }
     } else {
         $GLOBALS['HideReturnRequestsMenu'] = 'none';
     }
     // How many products are in their wish list?
     $query = sprintf("select count(wishlistid) as num from [|PREFIX|]wishlists where customerid='%d'", $GLOBALS['ISC_CLASS_DB']->Quote($customerid));
     $GLOBALS['NumWishListItems'] = $GLOBALS['ISC_CLASS_DB']->FetchOne($query);
 }
 public function HandleSTSToDo($ToDo)
 {
     $do = isc_strtolower($ToDo);
     // NI cloud 2010-06-08 export search statistic to csv file
     if ($do === 'exsearchstats') {
         $GLOBALS['ISC_CLASS_ADMIN_EXPORT_SEARCH_STATISTIC'] = GetClass('ISC_ADMIN_EXPORT_SEARCH_STATISTIC');
         $GLOBALS['ISC_CLASS_ADMIN_EXPORT_SEARCH_STATISTIC']->HandleToDo();
         return;
     }
     if (is_numeric(isc_strpos($do, "vendorpayment"))) {
         $GLOBALS['ISC_CLASS_ADMIN_VENDOR_PAYMENTS'] = GetClass('ISC_ADMIN_VENDOR_PAYMENTS');
         $GLOBALS['ISC_CLASS_ADMIN_VENDOR_PAYMENTS']->HandleToDo($ToDo);
     } else {
         if (is_numeric(isc_strpos($do, "vendor"))) {
             $GLOBALS['ISC_CLASS_ADMIN_VENDORS'] = GetClass('ISC_ADMIN_VENDORS');
             $GLOBALS['ISC_CLASS_ADMIN_VENDORS']->HandleToDo($ToDo);
         } else {
             if (is_numeric(isc_strpos($do, "page"))) {
                 $GLOBALS['ISC_CLASS_ADMIN_PAGES'] = GetClass('ISC_ADMIN_PAGES');
                 $GLOBALS['ISC_CLASS_ADMIN_PAGES']->HandleToDo($ToDo);
             } else {
                 if (is_numeric(isc_strpos($do, "product"))) {
                     $GLOBALS['ISC_CLASS_ADMIN_PRODUCT'] = GetClass('ISC_ADMIN_PRODUCT');
                     $GLOBALS['ISC_CLASS_ADMIN_PRODUCT']->HandleToDo($ToDo);
                 } else {
                     if (is_numeric(isc_strpos($do, "qualifierassociation"))) {
                         $GLOBALS['ISC_CLASS_ADMIN_QUALIFIER_ASSOCIATIONS'] = GetClass('ISC_ADMIN_QUALIFIER_ASSOCIATIONS');
                         $GLOBALS['ISC_CLASS_ADMIN_QUALIFIER_ASSOCIATIONS']->HandleToDo($ToDo);
                     } else {
                         if (is_numeric(isc_strpos($do, "qvalueassociation"))) {
                             $GLOBALS['ISC_CLASS_ADMIN_QVALUE_ASSOCIATIONS'] = GetClass('ISC_ADMIN_QVALUE_ASSOCIATIONS');
                             $GLOBALS['ISC_CLASS_ADMIN_QVALUE_ASSOCIATIONS']->HandleToDo($ToDo);
                         } else {
                             if (is_numeric(isc_strpos($do, "filemanagement"))) {
                                 $GLOBALS['ISC_CLASS_ADMIN_FILE_MANAGEMENT'] = GetClass('ISC_ADMIN_FILE_MANAGEMENT');
                                 $GLOBALS['ISC_CLASS_ADMIN_FILE_MANAGEMENT']->HandleToDo($ToDo);
                             } else {
                                 if (is_numeric(isc_strpos($do, "changesreport"))) {
                                     $GLOBALS['ISC_CLASS_ADMIN_CHANGES_REPORT'] = GetClass('ISC_ADMIN_CHANGES_REPORT');
                                     $GLOBALS['ISC_CLASS_ADMIN_CHANGES_REPORT']->HandleToDo($ToDo);
                                 } else {
                                     if (is_numeric(isc_strpos($do, "review"))) {
                                         $GLOBALS['ISC_CLASS_ADMIN_REVIEW'] = GetClass('ISC_ADMIN_REVIEW');
                                         $GLOBALS['ISC_CLASS_ADMIN_REVIEW']->HandleToDo($ToDo);
                                     } else {
                                         if (is_numeric(isc_strpos($do, "categ"))) {
                                             $GLOBALS['ISC_CLASS_ADMIN_CATEGORY'] = GetClass('ISC_ADMIN_CATEGORY');
                                             $GLOBALS["ISC_CLASS_ADMIN_CATEGORY"]->HandleToDo($ToDo);
                                         } else {
                                             if (is_numeric(isc_strpos($do, "shipment")) || is_numeric(isc_strpos($do, "packingslip"))) {
                                                 $GLOBALS['ISC_CLASS_ADMIN_SHIPMENTS'] = GetClass('ISC_ADMIN_SHIPMENTS');
                                                 $GLOBALS['ISC_CLASS_ADMIN_SHIPMENTS']->HandleToDo($ToDo);
                                             } else {
                                                 if (is_numeric(isc_strpos($do, "order"))) {
                                                     $GLOBALS['ISC_CLASS_ADMIN_ORDERS'] = GetClass('ISC_ADMIN_ORDERS');
                                                     $GLOBALS['ISC_CLASS_ADMIN_ORDERS']->HandleToDo($ToDo);
                                                 } else {
                                                     if (is_numeric(isc_strpos($do, "offer"))) {
                                                         $GLOBALS['ISC_CLASS_ADMIN_OFFERS'] = GetClass('ISC_ADMIN_OFFERS');
                                                         $GLOBALS['ISC_CLASS_ADMIN_OFFERS']->HandleToDo($ToDo);
                                                     } else {
                                                         if (is_numeric(isc_strpos($do, "giftwrap"))) {
                                                             $GLOBALS['ISC_CLASS_ADMIN_SETTINGS_GIFTWRAPPING'] = GetClass('ISC_ADMIN_SETTINGS_GIFTWRAPPING');
                                                             $GLOBALS['ISC_CLASS_ADMIN_SETTINGS_GIFTWRAPPING']->HandleToDo($ToDo);
                                                         } else {
                                                             if (is_numeric(isc_strpos($do, "customer"))) {
                                                                 $GLOBALS['ISC_CLASS_ADMIN_CUSTOMERS'] = GetClass('ISC_ADMIN_CUSTOMERS');
                                                                 $GLOBALS['ISC_CLASS_ADMIN_CUSTOMERS']->HandleToDo($ToDo);
                                                             } else {
                                                                 if (is_numeric(isc_strpos($do, "shippingsettings")) || is_numeric(isc_strpos($do, "shippingzone")) || is_numeric(isc_strpos($do, "testshipping"))) {
                                                                     $GLOBALS['ISC_CLASS_ADMIN_SETTINGS_SHIPPING'] = GetClass('ISC_ADMIN_SETTINGS_SHIPPING');
                                                                     $GLOBALS['ISC_CLASS_ADMIN_SETTINGS_SHIPPING']->HandleToDo($ToDo);
                                                                 } else {
                                                                     if (is_numeric(isc_strpos($do, "accountingsettings"))) {
                                                                         $GLOBALS['ISC_CLASS_ADMIN_SETTINGS_ACCOUNTING'] = GetClass('ISC_ADMIN_SETTINGS_ACCOUNTING');
                                                                         $GLOBALS['ISC_CLASS_ADMIN_SETTINGS_ACCOUNTING']->HandleToDo($ToDo);
                                                                     } else {
                                                                         if (is_numeric(isc_strpos($do, "scriptsettings"))) {
                                                                             $GLOBALS['ISC_CLASS_ADMIN_SETTINGS_ORDER'] = GetClass('ISC_ADMIN_SETTINGS_ORDER');
                                                                             $GLOBALS['ISC_CLASS_ADMIN_SETTINGS_ORDER']->HandleToDo($ToDo);
                                                                         } else {
                                                                             if (is_numeric(isc_strpos($do, "checkoutsettings"))) {
                                                                                 $GLOBALS['ISC_CLASS_ADMIN_SETTINGS_CHECKOUT'] = GetClass('ISC_ADMIN_SETTINGS_CHECKOUT');
                                                                                 $GLOBALS['ISC_CLASS_ADMIN_SETTINGS_CHECKOUT']->HandleToDo($ToDo);
                                                                             } else {
                                                                                 if (is_numeric(isc_strpos($do, "news"))) {
                                                                                     $GLOBALS['ISC_CLASS_ADMIN_NEWS'] = GetClass('ISC_ADMIN_NEWS');
                                                                                     $GLOBALS['ISC_CLASS_ADMIN_NEWS']->HandleToDo($ToDo);
                                                                                 } else {
                                                                                     if (is_numeric(isc_strpos($do, "coupon"))) {
                                                                                         $GLOBALS['ISC_CLASS_ADMIN_COUPONS'] = GetClass('ISC_ADMIN_COUPONS');
                                                                                         $GLOBALS['ISC_CLASS_ADMIN_COUPONS']->HandleToDo($ToDo);
                                                                                     } else {
                                                                                         if (is_numeric(isc_strpos($do, "discount"))) {
                                                                                             $GLOBALS['ISC_CLASS_ADMIN_COUPONS'] = GetClass('ISC_ADMIN_DISCOUNTS');
                                                                                             $GLOBALS['ISC_CLASS_ADMIN_COUPONS']->HandleToDo($ToDo);
                                                                                         } else {
                                                                                             if (is_numeric(isc_strpos($do, "subscribers"))) {
                                                                                                 $GLOBALS['ISC_CLASS_ADMIN_SUBSCRIBERS'] = GetClass('ISC_ADMIN_SUBSCRIBERS');
                                                                                                 $GLOBALS['ISC_CLASS_ADMIN_SUBSCRIBERS']->HandleToDo($ToDo);
                                                                                             } else {
                                                                                                 if (is_numeric(isc_strpos($do, "froogle"))) {
                                                                                                     $GLOBALS['ISC_CLASS_ADMIN_FROOGLE'] = GetClass('ISC_ADMIN_FROOGLE');
                                                                                                     $GLOBALS['ISC_CLASS_ADMIN_FROOGLE']->HandleToDo($ToDo);
                                                                                                 } else {
                                                                                                     if (is_numeric(isc_strpos($do, "exporttemplate"))) {
                                                                                                         $GLOBALS['ISC_CLASS_ADMIN_EXPORTTEMPLATES'] = GetClass('ISC_ADMIN_EXPORTTEMPLATES');
                                                                                                         $GLOBALS['ISC_CLASS_ADMIN_EXPORTTEMPLATES']->HandleToDo($ToDo);
                                                                                                     } else {
                                                                                                         if (is_numeric(isc_strpos($do, "importtemplate"))) {
                                                                                                             $GLOBALS['ISC_CLASS_ADMIN_IMPORTTEMPLATES'] = GetClass('ISC_ADMIN_IMPORTTEMPLATES');
                                                                                                             $GLOBALS['ISC_CLASS_ADMIN_IMPORTTEMPLATES']->HandleToDo($ToDo);
                                                                                                         } else {
                                                                                                             if (is_numeric(isc_strpos($do, "export"))) {
                                                                                                                 $GLOBALS['ISC_CLASS_ADMIN_EXPORT'] = GetClass('ISC_ADMIN_EXPORT');
                                                                                                                 $GLOBALS['ISC_CLASS_ADMIN_EXPORT']->HandleToDo($ToDo);
                                                                                                             } else {
                                                                                                                 if (is_numeric(isc_strpos($do, "template"))) {
                                                                                                                     $GLOBALS['ISC_CLASS_ADMIN_LAYOUT'] = GetClass('ISC_ADMIN_LAYOUT');
                                                                                                                     $GLOBALS['ISC_CLASS_ADMIN_LAYOUT']->HandleToDo($ToDo);
                                                                                                                 } else {
                                                                                                                     if (is_numeric(isc_strpos($do, "user"))) {
                                                                                                                         $GLOBALS['ISC_CLASS_ADMIN_USER'] = GetClass('ISC_ADMIN_USER');
                                                                                                                         $GLOBALS['ISC_CLASS_ADMIN_USER']->HandleToDo($ToDo);
                                                                                                                     } else {
                                                                                                                         if (is_numeric(isc_strpos($do, "banner"))) {
                                                                                                                             $GLOBALS['ISC_CLASS_ADMIN_BANNERS'] = GetClass('ISC_ADMIN_BANNERS');
                                                                                                                             $GLOBALS["ISC_CLASS_ADMIN_BANNERS"]->HandleToDo($ToDo);
                                                                                                                         } else {
                                                                                                                             if (is_numeric(isc_strpos($do, "brand"))) {
                                                                                                                                 $GLOBALS['ISC_CLASS_ADMIN_BRANDS'] = GetClass('ISC_ADMIN_BRANDS');
                                                                                                                                 $GLOBALS["ISC_CLASS_ADMIN_BRANDS"]->HandleToDo($ToDo);
                                                                                                                             } else {
                                                                                                                                 if (is_numeric(isc_strpos($do, "livechatsettings"))) {
                                                                                                                                     $GLOBALS['ISC_CLASS_ADMIN_SETTINGS_LIVECHAT'] = GetClass('ISC_ADMIN_SETTINGS_LIVECHAT');
                                                                                                                                     $GLOBALS['ISC_CLASS_ADMIN_SETTINGS_LIVECHAT']->HandleToDo($ToDo);
                                                                                                                                 } else {
                                                                                                                                     if (is_numeric(isc_strpos($do, "importlog"))) {
                                                                                                                                         $GLOBALS['ISC_CLASS_ADMIN_IMPORT_LOG'] = GetClass('ISC_ADMIN_IMPORTLOG');
                                                                                                                                         $GLOBALS["ISC_CLASS_ADMIN_IMPORT_LOG"]->HandleToDo($ToDo);
                                                                                                                                     } else {
                                                                                                                                         if (is_numeric(isc_strpos($do, "series"))) {
                                                                                                                                             $GLOBALS['ISC_CLASS_ADMIN_SERIES'] = GetClass('ISC_ADMIN_SERIES');
                                                                                                                                             $GLOBALS["ISC_CLASS_ADMIN_SERIES"]->HandleToDo($ToDo);
                                                                                                                                         } else {
                                                                                                                                             if (is_numeric(isc_strpos($do, "defect"))) {
                                                                                                                                                 $GLOBALS['ISC_CLASS_ADMIN_DEFECT'] = GetClass('ISC_ADMIN_DEFECT');
                                                                                                                                                 $GLOBALS["ISC_CLASS_ADMIN_DEFECT"]->HandleToDo($ToDo);
                                                                                                                                             } else {
                                                                                                                                                 if (is_numeric(isc_strpos($do, "mmy"))) {
                                                                                                                                                     $GLOBALS['ISC_CLASS_ADMIN_MMY'] = GetClass('ISC_ADMIN_MMY');
                                                                                                                                                     $GLOBALS["ISC_CLASS_ADMIN_MMY"]->HandleToDo($ToDo);
                                                                                                                                                 } else {
                                                                                                                                                     if (is_numeric(isc_strpos($do, "sweepstakes"))) {
                                                                                                                                                         $GLOBALS['ISC_CLASS_ADMIN_SWEEPSTAKES'] = GetClass('ISC_ADMIN_SWEEPSTAKES');
                                                                                                                                                         $GLOBALS["ISC_CLASS_ADMIN_SWEEPSTAKES"]->HandleToDo($ToDo);
                                                                                                                                                     } else {
                                                                                                                                                         if (is_numeric(isc_strpos($do, "wishlist"))) {
                                                                                                                                                             $GLOBALS['ISC_CLASS_ADMIN_MMY'] = GetClass('ISC_ADMIN_WISHLIST');
                                                                                                                                                             $GLOBALS["ISC_CLASS_ADMIN_MMY"]->HandleToDo($ToDo);
                                                                                                                                                         } else {
                                                                                                                                                             if (isc_strpos($do, 'settings') !== false && isc_strpos($do, 'tax') !== false) {
                                                                                                                                                                 $GLOBALS['ISC_CLASS_ADMIN_SETTINGS_TAX'] = GetClass('ISC_ADMIN_SETTINGS_TAX');
                                                                                                                                                                 $GLOBALS['ISC_CLASS_ADMIN_SETTINGS_TAX']->HandleToDo($ToDo);
                                                                                                                                                             } else {
                                                                                                                                                                 if (is_numeric(isc_strpos($do, "settings"))) {
                                                                                                                                                                     $GLOBALS['ISC_CLASS_ADMIN_SETTINGS'] = GetClass('ISC_ADMIN_SETTINGS');
                                                                                                                                                                     $GLOBALS['ISC_CLASS_ADMIN_SETTINGS']->HandleToDo($ToDo);
                                                                                                                                                                 } else {
                                                                                                                                                                     if (is_numeric(isc_strpos($do, "backup"))) {
                                                                                                                                                                         $GLOBALS['ISC_CLASS_ADMIN_BACKUP'] = GetClass('ISC_ADMIN_BACKUP');
                                                                                                                                                                         $GLOBALS["ISC_CLASS_ADMIN_BACKUP"]->HandleToDo($ToDo);
                                                                                                                                                                     } else {
                                                                                                                                                                         if (is_numeric(isc_strpos($do, "stats"))) {
                                                                                                                                                                             $GLOBALS['ISC_CLASS_ADMIN_STATITICS'] = GetClass('ISC_ADMIN_STATISTICS');
                                                                                                                                                                             $GLOBALS['ISC_CLASS_ADMIN_STATITICS']->HandleToDo($ToDo);
                                                                                                                                                                         } else {
                                                                                                                                                                             if (is_numeric(isc_strpos($do, "delinker"))) {
                                                                                                                                                                                 $GLOBALS['ISC_CLASS_ADMIN_DELINKER'] = GetClass('ISC_ADMIN_DELINKER');
                                                                                                                                                                             } else {
                                                                                                                                                                                 if (is_numeric(isc_strpos($do, "converter")) && is_dir(APP_ROOT . "/includes/converter")) {
                                                                                                                                                                                     include APP_ROOT . "/includes/converter/class.converter.php";
                                                                                                                                                                                     $GLOBALS["ISC_CLASS_ADMIN_CONVERTER"] = new ISC_ADMIN_CONVERTER();
                                                                                                                                                                                     $GLOBALS["ISC_CLASS_ADMIN_CONVERTER"]->HandleToDo($ToDo);
                                                                                                                                                                                 } else {
                                                                                                                                                                                     if (is_numeric(isc_strpos($do, "exporter")) && is_dir(APP_ROOT . "/includes/converter")) {
                                                                                                                                                                                         include APP_ROOT . "/includes/converter/class.exporter.php";
                                                                                                                                                                                         $GLOBALS["ISC_CLASS_ADMIN_CONVERTER"] = new ISC_ADMIN_EXPORTER();
                                                                                                                                                                                         $GLOBALS["ISC_CLASS_ADMIN_CONVERTER"]->HandleToDo($ToDo);
                                                                                                                                                                                     } else {
                                                                                                                                                                                         if (is_numeric(isc_strpos($do, "log"))) {
                                                                                                                                                                                             $GLOBALS['ISC_CLASS_ADMIN_LOGS'] = GetClass('ISC_ADMIN_LOGS');
                                                                                                                                                                                             $GLOBALS['ISC_CLASS_ADMIN_LOGS']->HandleToDo($ToDo);
                                                                                                                                                                                         } else {
                                                                                                                                                                                             if (is_numeric(strpos($do, "quicksearch"))) {
                                                                                                                                                                                                 $GLOBALS['ISC_CLASS_ADMIN_QUICKSEARCH'] = GetClass('ISC_ADMIN_QUICKSEARCH');
                                                                                                                                                                                                 $GLOBALS['ISC_CLASS_ADMIN_QUICKSEARCH']->HandleToDo($ToDo);
                                                                                                                                                                                             } else {
                                                                                                                                                                                                 if (is_numeric(isc_strpos($do, "return")) && GetConfig('EnableReturns') && gzte11(ISC_LARGEPRINT)) {
                                                                                                                                                                                                     $GLOBALS['ISC_CLASS_ADMIN_RETURNS'] = GetClass('ISC_ADMIN_RETURNS');
                                                                                                                                                                                                     $GLOBALS['ISC_CLASS_ADMIN_RETURNS']->HandleToDo($ToDo);
                                                                                                                                                                                                 } else {
                                                                                                                                                                                                     if (is_numeric(isc_strpos($do, "companygiftcertificate")) && GetConfig('EnableCompanyGiftCertificates') && gzte11(ISC_LARGEPRINT)) {
                                                                                                                                                                                                         $GLOBALS['ISC_CLASS_ADMIN_COMPANY_GIFTCERTIFICATES'] = GetClass('ISC_ADMIN_COMPANY_GIFTCERTIFICATES');
                                                                                                                                                                                                         $GLOBALS['ISC_CLASS_ADMIN_COMPANY_GIFTCERTIFICATES']->HandleToDo($ToDo);
                                                                                                                                                                                                     } else {
                                                                                                                                                                                                         if (is_numeric(isc_strpos($do, "giftcertificate")) && GetConfig('EnableGiftCertificates') && gzte11(ISC_LARGEPRINT)) {
                                                                                                                                                                                                             $GLOBALS['ISC_CLASS_ADMIN_GIFTCERTIFICATES'] = GetClass('ISC_ADMIN_GIFTCERTIFICATES');
                                                                                                                                                                                                             $GLOBALS['ISC_CLASS_ADMIN_GIFTCERTIFICATES']->HandleToDo($ToDo);
                                                                                                                                                                                                         } else {
                                                                                                                                                                                                             if (is_numeric(isc_strpos($do, "systeminfo"))) {
                                                                                                                                                                                                                 $GLOBALS['ISC_CLASS_ADMIN_SYSINFO'] = GetClass('ISC_ADMIN_SYSINFO');
                                                                                                                                                                                                                 $GLOBALS['ISC_CLASS_ADMIN_SYSINFO']->HandleToDo($ToDo);
                                                                                                                                                                                                             } else {
                                                                                                                                                                                                                 if (is_numeric(isc_strpos($do, "runaddon"))) {
                                                                                                                                                                                                                     $GLOBALS['ISC_CLASS_ADMIN_ADDON'] = GetClass('ISC_ADMIN_ADDON');
                                                                                                                                                                                                                     $GLOBALS["ISC_CLASS_ADMIN_ADDON"]->HandleToDo($ToDo);
                                                                                                                                                                                                                 } else {
                                                                                                                                                                                                                     if (is_numeric(isc_strpos($do, "downloadaddons"))) {
                                                                                                                                                                                                                         $GLOBALS['ISC_CLASS_ADMIN_DOWNLOADADDONS'] = GetClass('ISC_ADMIN_DOWNLOADADDONS');
                                                                                                                                                                                                                         $GLOBALS['ISC_CLASS_ADMIN_DOWNLOADADDONS']->HandleToDo($ToDo);
                                                                                                                                                                                                                     } else {
                                                                                                                                                                                                                         if (is_numeric(isc_strpos($do, "formfields"))) {
                                                                                                                                                                                                                             $GLOBALS['ISC_CLASS_ADMIN_FORMFIELDS'] = GetClass('ISC_ADMIN_FORMFIELDS');
                                                                                                                                                                                                                             $GLOBALS['ISC_CLASS_ADMIN_FORMFIELDS']->HandleToDo($ToDo);
                                                                                                                                                                                                                         }
                                                                                                                                                                                                                     }
                                                                                                                                                                                                                 }
                                                                                                                                                                                                             }
                                                                                                                                                                                                         }
                                                                                                                                                                                                     }
                                                                                                                                                                                                 }
                                                                                                                                                                                             }
                                                                                                                                                                                         }
                                                                                                                                                                                     }
                                                                                                                                                                                 }
                                                                                                                                                                             }
                                                                                                                                                                         }
                                                                                                                                                                     }
                                                                                                                                                                 }
                                                                                                                                                             }
                                                                                                                                                         }
                                                                                                                                                     }
                                                                                                                                                 }
                                                                                                                                             }
                                                                                                                                         }
                                                                                                                                     }
                                                                                                                                 }
                                                                                                                             }
                                                                                                                         }
                                                                                                                     }
                                                                                                                 }
                                                                                                             }
                                                                                                         }
                                                                                                     }
                                                                                                 }
                                                                                             }
                                                                                         }
                                                                                     }
                                                                                 }
                                                                             }
                                                                         }
                                                                     }
                                                                 }
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
Example #30
0
	/**
	 * Setup the list of gift certificates that have been applied to the
	 * shopping cart.
	 */
	public function setUpAppliedGiftCertificates()
	{
		if (!gzte11(ISC_LARGEPRINT)) {
			$GLOBALS['HidePanels'][] = "SideGiftCertificateCodeBox";
			return;
		}

		$GLOBALS['SNIPPETS']['GiftCertificates'] = '';

		$giftCertificates = $this->quote->getAppliedGiftCertificates();
		if(empty($giftCertificates)) {
			return;
		}

		foreach ($giftCertificates as $certificate) {
			$GLOBALS['GiftCertificateCode'] = isc_html_escape($certificate['code']);
			$GLOBALS['GiftCertificateId'] = $certificate['id'];
			$GLOBALS['GiftCertificateRemaining'] = CurrencyConvertFormatPrice($certificate['remaining']);
			$GLOBALS['CertificateAmountUsed'] = CurrencyConvertFormatPrice($certificate['used'] * -1);
			$GLOBALS['SNIPPETS']['GiftCertificates'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CartGiftCertificate");
		}

		if ($GLOBALS['SNIPPETS']['GiftCertificates']) {
			if($this->quote->getGrandTotal() == 0) {
				$GLOBALS['HidePanels'][] = "SideGiftCertificateCodeBox";
			}
		}
	}