Esempio n. 1
0
	/**
	* Display the store-wide GWO tests list
	*
	*/
	private function manageOptimizer()
	{
		$Tests = GetAvailableModules('optimizer');
		$Output = "";
		$EnabledModules = array();

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

		$EnabledModules = GetConfig('OptimizerMethods');

		$GLOBALS['OptimizerRow'] = '';
		foreach ($Tests as $Test) {
			$GLOBALS['ModuleName'] = isc_html_escape($Test['name']);
			$GLOBALS['ModuleId'] = $Test['id'];
			$GLOBALS['ConfiguredIcon'] = 'cross';
			$GLOBALS['ConfiguredDate'] = 'N/A';
			$GLOBALS['ActiveReset'] = 'inactive';

			if($Test['enabled']) {
				$GLOBALS['ActiveReset'] = 'active';
				$GLOBALS['ConfiguredIcon'] = 'tick';
				if(isset($EnabledModules[$Test['id']]) && $EnabledModules[$Test['id']] != '') {
					$GLOBALS['ConfiguredDate'] = isc_date('jS M Y',$EnabledModules[$Test['id']]);
				}
			}
			$GLOBALS['OptimizerRow'] .= $this->template->render('Snippets/OptimizerRow.html');

		}

		$this->template->display('optimizer.manage.tpl');
	}
	private function manageCommentSystemSettings()
	{
		$GLOBALS['BreadcrumEntries'][GetLang('CommentSettingsTitle')] = '';
		$this->template->assign('Message', GetFlashMessageBoxes());

		$tabs = array('general' => GetLang('GeneralSettings'));
		$moduleTabContent = '';

		$systemModules = GetAvailableModules('comments');
		$commentSystems = array();
		foreach ($systemModules as $module) {
			$commentSystems[] = array('label' => $module['name'], 'value' => $module['id'], 'selected' => $module['enabled']);

			// add the module to the list of tabs so it can be configured
			if ($module['enabled']) {
				$tabs[$module['id']] = $module['name'];
				$moduleTabContent .= sprintf('<div id="%s" style="padding-top: 10px;" class="tabContent">%s</div>', $module['id'], $module['object']->GetPropertiesSheet($module['id']));
			}
		}

		$currentTab = 0;
		if (isset($_GET['tab'])) {
			$currentTab = $_GET['tab'];
		}
		$this->template->assign('currentTab', $currentTab);
		$this->template->assign('tabs', $tabs);
		$this->template->assign('commentSystems', $commentSystems);
		$this->template->assign('moduleTabContent', $moduleTabContent);

		$this->engine->PrintHeader();
		$this->template->display('settings.comments.manage.tpl');
		$this->engine->PrintFooter();
	}
 /**
  * List page
  *
  * @return Void
  */
 private function ManageImageUploaderSettings($messages = array())
 {
     $GLOBALS['Message'] = GetFlashMessageBoxes();
     $GLOBALS['LimitCustomerUploadImageSize'] = GetConfig("LimitCustomerUploadImageSize");
     $GLOBALS['LimitCustomerUploadImageNum'] = GetConfig("LimitCustomerUploadImageNum");
     //zcs=the max uploading number of total
     $GLOBALS['LimitCustomerUploadImagePerNum'] = GetConfig("LimitCustomerUploadImagePerNum");
     //zcs the number of per uploading
     //zcs the type of file for uploading
     $GLOBALS['LimitCustomerUploadImageFileType'] = '';
     $map_filetypes = array(IMAGETYPE_GIF => 'Gif', IMAGETYPE_JPEG => 'Jpeg', IMAGETYPE_PNG => 'Png', IMAGETYPE_SWF => 'Swf', IMAGETYPE_BMP => 'Bmp');
     $accept_filetypes = explode(',', GetConfig("LimitCustomerUploadImageFileType"));
     foreach ($map_filetypes as $filetype => $description) {
         $GLOBALS['LimitCustomerUploadImageFileType'] .= '<input type="checkbox" name="LimitCustomerUploadImageFileType[]" value="' . $filetype . '" ' . (in_array($filetype, $accept_filetypes) ? 'checked="checked"' : '') . ' /> ' . $description . ' ';
     }
     $GLOBALS['ImageUploaderSettingsNotifyEmail'] = trim(GetConfig("ImageUploaderSettingsNotifyEmail"));
     //zcs=instructions
     $instructionsOptions = array('id' => 'ImageUploaderSettingsInstructions', 'width' => '', 'height' => '350px', 'value' => base64_decode(GetConfig("ImageUploaderSettingsInstructions")));
     $GLOBALS['ImageUploaderSettingsInstructions'] = GetClass('ISC_ADMIN_EDITOR')->GetWysiwygEditor($instructionsOptions);
     //zcs=copyright assignment
     $assignmentOptions = array('id' => 'ImageUploaderSettingsAssignment', 'width' => '60%', 'height' => '350px', 'value' => base64_decode(GetConfig("ImageUploaderSettingsAssignment")));
     $GLOBALS['ImageUploaderSettingsAssignment'] = GetClass('ISC_ADMIN_EDITOR')->GetWysiwygEditor1($assignmentOptions);
     $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("settings.imageuploader.manage");
     $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate();
 }
Esempio n. 4
0
 public function ClearanceList($MsgDesc = "", $MsgStatus = "")
 {
     $GLOBALS['Message'] = GetFlashMessageBoxes();
     $GLOBALS['HideErrorMessage'] = 'none';
     if ($MsgDesc != "") {
         $GLOBALS['Message'] = MessageBox($MsgDesc, $MsgStatus);
     }
     $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("clearance");
     $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate();
 }
 public function ManageOrderSettings($messages = array())
 {
     $GLOBALS['Message'] = GetFlashMessageBoxes();
     //get current field ids from data base
     $result = $GLOBALS['ISC_CLASS_DB']->Query("SELECT * FROM [|PREFIX|]order_scripts");
     while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
         if ($row['scripttype'] == 'orderscript') {
             $GLOBALS['CampaignCode'] = $row['scriptvalue'];
         } elseif ($row['scripttype'] == 'ordermsg') {
             $GLOBALS['OrderCompleteMsg'] = $row['scriptvalue'];
         }
     }
     $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("settings.order.manage");
     $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate();
 }
 public function ManageOrderSettings($messages = array())
 {
     $GLOBALS['Message'] = GetFlashMessageBoxes();
     //get current field ids from data base
     $result = $GLOBALS['ISC_CLASS_DB']->Query("SELECT * FROM [|PREFIX|]order_scripts");
     while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
         if ($row['scripttype'] == 'orderscript') {
             $GLOBALS['CampaignCode'] = $row['scriptvalue'];
         } elseif ($row['scripttype'] == 'ordermsg') {
             //$GLOBALS['OrderCompleteMsg'] = $row['scriptvalue'];
             $wysiwygOptions = array('id' => 'wysiwyg', 'width' => '720px', 'height' => '350px', 'value' => $row['scriptvalue']);
             $GLOBALS['WYSIWYG'] = GetClass('ISC_ADMIN_EDITOR')->GetWysiwygEditor($wysiwygOptions);
         }
     }
     $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("settings.order.manage");
     $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate();
 }
 public function ManageAccountingSettings($messages = array())
 {
     $GLOBALS['Message'] = GetFlashMessageBoxes();
     $GLOBALS['AccountingProviders'] = $this->_getAccountingPackagesAsOptions();
     // Which shipping modules are enabled?
     $accountings = GetAvailableModules('accounting', true, false, true);
     $GLOBALS['AccountingTabs'] = "";
     $GLOBALS['AccountingDivs'] = "";
     $GLOBALS['SSLIsConfigured'] = GetConfig('UseSSL');
     $count = 2;
     // Setup each shipping module with its own tab
     foreach ($accountings as $accounting) {
         $GLOBALS['AccountingTabs'] .= sprintf('<li><a href="#" id="tab%d" onclick="ShowTab(%d)">%s</a></li>', $count, $count, $accounting['name']);
         $GLOBALS['AccountingDivs'] .= sprintf('<div id="div%d" style="padding-top: 10px;">%s</div>', $count, $accounting['object']->getpropertiessheet($count));
         $count++;
     }
     $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("settings.accounting.manage");
     $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate();
 }
 private function ManageLiveChatSettings()
 {
     $GLOBALS['Message'] = GetFlashMessageBoxes();
     $GLOBALS['LiveChatJavascript'] = '';
     $GLOBALS['LiveChatServices'] = $this->GetLiveChatServicesAsOptions();
     // Which live chat services are currently enabled?
     $liveChatServices = GetClass('ISC_LIVECHAT');
     $enabledServices = $liveChatServices->GetEnabledModules();
     $GLOBALS['LiveChatTabs'] = $GLOBALS['LiveChatDivs'] = '';
     $count = 2;
     // Set up each service with it's own tab
     foreach ($enabledServices as $module) {
         $GLOBALS['LiveChatTabs'] .= '<li><a href="#" id="tab' . $count . '" onclick="ShowTab(' . $count . ');">' . $module['name'] . "</a></li>";
         $GLOBALS['LiveChatDivs'] .= '<div id="div' . $count . '" style="padding-top: 10px;">' . $module['object']->GetPropertiesSheet($count) . '</div>';
         ++$count;
     }
     $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("settings.livechat.manage");
     $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate();
 }
	/**
	 * Handle the action for this section.
	 *
	 * @param string The name of the action to do.
	 */
	public function HandleToDo($Do)
	{
		if (!$GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Manage_EmailMarketing)) {
			$GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR);
			return;
		}

		$this->template->assign('message', GetFlashMessageBoxes());
		$this->template->assign('javascript', '');

		$method = 'handle' . $_REQUEST['ToDo'];

		if ($method != 'handletodo' && is_callable(array($this, $method))) {
			$this->$method();
			return;
		}

		// default action
		$this->handleViewEmailIntegrationSettings();
	}
	private function manageShippingManagerSettings()
	{
		$GLOBALS['BreadcrumEntries'][GetLang('ShippingManagerSettings')] = '';
		$this->template->assign('Message', GetFlashMessageBoxes());

		$tabs = array('general' => GetLang('GeneralSettings'));
		$moduleTabContent = '';

		$managerModules = GetAvailableModules('shippingmanager');

		$shippingManagers = array();
		$enabledShippingManagers = array();

		foreach ($managerModules as $module) {
			$shippingManagers[$module['id']] = $module['name'];

			// add the module to the list of tabs so it can be configured
			if ($module['enabled']) {
				$tabs[$module['id'] ] = $module['name'];
				$moduleTabContent .= sprintf('<div id="%s" style="padding-top: 10px;" class="tabContent">%s</div>', $module['id'], $module['object']->GetPropertiesSheet($module['id']));
				$enabledShippingManagers[] = $module['id'];
			}
		}

		$currentTab = 'general';
		if (isset($_GET['tab'])) {
			$currentTab = $_GET['tab'];
		}
		$this->template->assign('currentTab', $currentTab);

		$this->template->assign('tabs', $tabs);
		$this->template->assign('shippingManagers', $shippingManagers);
		$this->template->assign('enabledShippingManagers', $enabledShippingManagers);
		$this->template->assign('moduleTabContent', $moduleTabContent);

		$this->engine->PrintHeader();
		$this->template->display('settings.shippingmanager.manage.tpl');
		$this->engine->PrintFooter();
	}
Esempio n. 11
0
 private function ListReports()
 {
     $GLOBALS['Message'] = GetFlashMessageBoxes();
     $GLOBALS['ISC_CLASS_CUSTOMER'] = GetClass('ISC_CUSTOMER');
     $userid = $GLOBALS['ISC_CLASS_CUSTOMER']->GetCustomerId();
     $GLOBALS['DefectGrid'] = '';
     //        if(CustomerIsSignedIn()) {
     $query = "SELECT * FROM [|PREFIX|]defect_report where userid = {$userid} ORDER BY submittime DESC";
     $result = $GLOBALS['ISC_CLASS_DB']->Query($query);
     $cnt = $GLOBALS['ISC_CLASS_DB']->CountResult($result);
     if ($cnt > 0) {
         while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
             $GLOBALS['url'] = wordwrap($row['url'], 40, '<br>', true);
             $GLOBALS['description'] = $row['description'];
             $GLOBALS['comment'] = $row['comment'];
             $status = '';
             /*
              * 1 - The report is posted and it is pending.
              * 2 - Will be fixed and admin enter comment.
              * 3 - Issue is fixed and admin add comment.
              * 4 - The issue can't be fixed.
              */
             if ($row['status'] == '1') {
                 $status = "Pending";
             } else {
                 if ($row['status'] == '2') {
                     $status = "To be fixed";
                 } else {
                     if ($row['status'] == '3') {
                         $status = "Fixed";
                     } else {
                         if ($row['status'] == '4') {
                             $status = "Not to be fixed";
                         } else {
                             $status = "No Status";
                         }
                     }
                 }
             }
             $GLOBALS['status'] = $status;
             $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("defect.row");
             if ($row['status'] == '1') {
                 $GLOBALS['displayaction'] = '';
                 $GLOBALS['displaynoaction'] = 'none';
                 $GLOBALS['EditDefectLink'] = sprintf("<a title='%s' class='Action' href='defectreport.php?action=editdefect&amp;Id=%d'>%s</a>", GetLang('DefectEdit'), $row['id'], GetLang('Edit'));
                 $GLOBALS['DeleteDefectLink'] = sprintf("<a title='%s' class='Action' href='#' onclick=deletedefectid(%d)>%s</a>", GetLang('DefectDelete'), $row['id'], GetLang('Delete'));
             } else {
                 $GLOBALS['displayaction'] = 'none';
                 $GLOBALS['displaynoaction'] = '';
                 $GLOBALS['noaction'] = GetLang('Noaction');
             }
             $GLOBALS['displayrecord'] = '';
             $GLOBALS['displaynorecord'] = 'none';
             $GLOBALS['DefectGrid'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true);
         }
     } else {
         $GLOBALS['norecords'] = GetLang('NoRecords');
         $GLOBALS['displayrecord'] = 'none';
         $GLOBALS['displaynorecord'] = '';
         $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("defect.row");
         $GLOBALS['DefectGrid'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true);
     }
     $GLOBALS['DefectReportTitle'] = GetLang('ListofReports');
     $GLOBALS['ISC_CLASS_TEMPLATE']->SetPageTitle(sprintf("%s - %s", GetConfig('StoreName'), GetLang('DefectReport')));
     $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("defectlist");
     $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate();
     /*}
       else {
                           echo "else";
       }     */
 }
 private function EditCategory()
 {
     $GLOBALS['Message'] = GetFlashMessageBoxes();
     if (isset($_GET['catId'])) {
         $catId = (int) $_GET['catId'];
         include_once ISC_BASE_PATH . '/lib/api/category.api.php';
         $category = new API_CATEGORY();
         $category->load($catId);
         //wirror_20100804: remove the cookie CustomContentId, and fetch current CustomContentId from table category
         if ($category->customcontentid != 0) {
             $contentId = isc_html_escape($category->customcontentid);
         } else {
             if (isset($_COOKIE['CustomContentId']) && is_numeric($_COOKIE['CustomContentId'])) {
                 $contentId = $_COOKIE['CustomContentId'];
             } else {
                 $customItem = array('contenttype' => 1, 'description' => "custom products content for category#{$catId}");
                 $contentId = GetClass('ISC_ADMIN_CUSTOMCONTENTS')->createCustomContens($customItem);
             }
         }
         setcookie("CustomContentId", $contentId, time() + 3600);
         //wirror_20100806: show the custom content options
         $GLOBALS['ContentOptions'] = $this->_GetContentTypeOptions($category->pagecontenttype);
         $GLOBALS['CustomPageAction'] = "listCateCustomcontents&customContentId={$contentId}&catId={$catId}";
         $GLOBALS['CategoryName'] = isc_html_escape($category->catname);
         $GLOBALS['CategoryOptions'] = $this->GetCategoryParentOptions($catId, array($category->catparentid));
         $GLOBALS['CategorySort'] = isc_html_escape($category->catsort);
         $GLOBALS['CategoryPageTitle'] = isc_html_escape($category->catpagetitle);
         $GLOBALS['CategoryMetaKeywords'] = isc_html_escape($category->catmetakeywords);
         $GLOBALS['CategoryMetaDesc'] = isc_html_escape($category->catmetadesc);
         $GLOBALS['CatDepartment'] = $this->getDepartment($category->catdeptid);
         $GLOBALS['AltKeyword'] = isc_html_escape($category->cataltkeyword);
         $GLOBALS['catcombine'] = isc_html_escape($category->catcombine);
         $GLOBALS['CatDeptid'] = isc_html_escape($category->catdeptid);
         $GLOBALS['StartPrice'] = isc_html_escape($category->StartPrice);
         $GLOBALS['EndPrice'] = isc_html_escape($category->EndPrice);
         $GLOBALS['CatImageAlt'] = isc_html_escape($category->catimagealt);
         if (strtolower($category->displayproducts) == 'on') {
             $GLOBALS['DisplayProducts'] = 'checked="checked"';
         }
         $GLOBALS['CategorySelect'] = '<input type="hidden" name="catparentid" id="catparentid" value="' . $category->catparentid . '">
             <select size="5" name="catparent_id" id="catparent_id" class="Field750" style="height:115" onchange="HandleRootCategory();SelectDept();" disabled="disabled">';
         # Added because when we disable the category list, id cant be get while saving, so hidden field is added and the id is changed to catparentid. -- Baskaran
         $temp = '';
         $pnamearray = array('Category Name', 'Sub Category Name', 'Brand Name', 'Series Name', 'Part Number', 'Product Code', 'Product color', 'Product Material', 'Product Style');
         $savedarray = explode(",", $category->Productname);
         foreach ($pnamearray as $key => $value) {
             if (in_array($key, $savedarray)) {
                 $temp .= "<option  value='" . $key . "' selected='selected' >" . $value . "</option>";
             } else {
                 $temp .= "<option  value='" . $key . "' >" . $value . "</option>";
             }
         }
         $GLOBALS['Productname'] = $temp;
         $congocatname = '';
         if ($category->catparentid == 0) {
             $space1 = str_replace(" ", "", isc_html_escape($category->catname));
             $hypen1 = str_replace("-", "", $space1);
             $amp1 = str_replace("&", "", $hypen1);
             $slash1 = str_replace("/", "", $amp1);
             $congocatname = str_replace(",", "", $slash1);
         } else {
             $query = "SELECT * from [|PREFIX|]categories where categoryid = {$category->catparentid}";
             $result = $GLOBALS["ISC_CLASS_DB"]->Query($query);
             $row = $GLOBALS["ISC_CLASS_DB"]->Fetch($result);
             $space2 = str_replace(" ", "", $row['catname']);
             $hypen2 = str_replace("-", "", $space2);
             $amp2 = str_replace("&", "", $hypen2);
             $slash2 = str_replace("/", "", $amp2);
             $congocatname = str_replace(",", "", $slash2);
         }
         $_SESSION['congocatname'] = $congocatname;
         $wysiwygOptions = array('id' => 'wysiwyg', 'width' => '750px', 'height' => '500px', 'value' => $category->catdesc);
         $wysiwygOptions1 = array('id' => 'wysiwyg1', 'width' => '60%', 'height' => '300px', 'value' => $category->categoryfooter);
         $wysiwygOptions2 = array('id' => 'wysiwyg2', 'width' => '60%', 'height' => '300px', 'value' => $category->featurepoints);
         $wysiwygOptions3 = array('id' => 'wysiwyg3', 'width' => '60%', 'height' => '300px', 'value' => $category->divdesc);
         $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['WYSIWYG3'] = GetClass('ISC_ADMIN_EDITOR')->GetWysiwygEditor1($wysiwygOptions3);
         $GLOBALS['ControlScript'] = $category->controlscript;
         $GLOBALS['TrackingScript'] = $category->trackingscript;
         $GLOBALS['FormAction'] = "saveUpdatedCategory";
         $GLOBALS['CatTitle'] = GetLang('EditCatTitle');
         $GLOBALS['CatIntro'] = GetLang('EditCatIntro');
         $GLOBALS['CancelMessage'] = GetLang('CancelEditCategory');
         $GLOBALS['hiddenFields'] = sprintf("<input type='hidden' name='categoryId' value='%d'>", $catId);
         #wirror_20100805: hide the custom content id
         $GLOBALS['hiddenFields'] .= sprintf("<input type='hidden' name='customContentId' value='%d'>", $contentId);
         if ($category->catparentid == '0') {
             //$GLOBALS['DisableFileUpload'] = 'disabled="disabled"';
             $GLOBALS['ShowFileUploadMessage'] = '';
             $GLOBALS['ShowHidecatCombine'] = 'none';
             $GLOBALS['disabledept'] = '';
         } else {
             //$GLOBALS['DisableFileUpload'] = '';
             $GLOBALS['ShowFileUploadMessage'] = 'none';
             $GLOBALS['ShowHidecatCombine'] = '';
             $GLOBALS['disabledept'] = 'disabled="disabled"';
         }
         // Get a list of all layout files
         $layoutFile = 'category.html';
         if ($category->catlayoutfile != '') {
             $layoutFile = $category->catlayoutfile;
         }
         $GLOBALS['LayoutFiles'] = GetCustomLayoutFilesAsOptions("category.html", $layoutFile);
         $GLOBALS["CatImageMessage"] = '';
         if ($category->catimagefile !== '') {
             $image = '../' . 'category_images' . '/' . $category->catimagefile;
             $GLOBALS["CatImageMessage"] = sprintf(GetLang('CatImageDesc'), $image, $category->catimagefile);
         }
         $GLOBALS["CatHoverImageMessage"] = '';
         if ($category->cathoverimagefile !== '') {
             $image = '../' . 'category_images' . '/' . $category->cathoverimagefile;
             $GLOBALS["CatHoverImageMessage"] = sprintf(GetLang('CatHoverImageDesc'), $image, $category->cathoverimagefile);
         }
         $SelectedQualifiers = $this->GetSelectedQualifiers($catId);
         $GLOBALS['QualifierOptions'] = $this->GetQualifierOptions($SelectedQualifiers, "<option %s value='%d'>%s</option>", "selected=\"selected\"", "", false);
         $GLOBALS['SaveAndAddAnother'] = GetLang('SaveAndContinueEditing');
         $GLOBALS["ISC_CLASS_TEMPLATE"]->SetTemplate("category.form");
         $GLOBALS["ISC_CLASS_TEMPLATE"]->ParseTemplate();
     } else {
         if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Manage_Categories)) {
             $this->ManageCategories();
         } else {
             $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR);
         }
     }
 }
 /**
  * Update a specific type of gift wrapping.
  */
 private function EditGiftWrap()
 {
     $GLOBALS['Message'] = GetFlashMessageBoxes();
     $wrap = $this->GetGiftWrapData($_REQUEST['wrapId']);
     // If the wrapping type doesn't exist, show an error message
     if (!isset($wrap['wrapid'])) {
         FlashMessage(GetLang('InvalidGiftWrap'), MSG_ERROR, 'index.php?ToDo=viewGiftWrapping');
     }
     // Set up the form title and action
     $GLOBALS['FormAction'] = 'SaveUpdatedGiftWrap';
     $GLOBALS['Title'] = GetLang('EditGiftWrap');
     $GLOBALS['Intro'] = GetLang('EditGiftWrapIntro');
     if (GetConfig('CurrencyLocation') == 'right') {
         $GLOBALS['RightCurrencyToken'] = GetConfig('CurrencyToken');
     } else {
         $GLOBALS['LeftCurrencyToken'] = GetConfig('CurrencyToken');
     }
     // Set the form values
     $GLOBALS['WrapId'] = (int) $wrap['wrapid'];
     $GLOBALS['WrapName'] = isc_html_escape($wrap['wrapname']);
     $GLOBALS['WrapImage'] = isc_html_escape($wrap['wrappreview']);
     if ($wrap['wrappreview'] == '') {
         $GLOBALS['HideCurrentWrapImage'] = 'display: none';
     }
     $GLOBALS['GiftWrapPrice'] = number_format($wrap['wrapprice'], GetConfig('DecimalPlaces'), GetConfig('DecimalToken'), "");
     $GLOBALS['GiftWrapAllowCommentsChecked'] = '';
     if ($wrap['wrapallowcomments']) {
         $GLOBALS['GiftWrapAllowCommentsChecked'] = 'checked="checked"';
     }
     $GLOBALS['GiftWrapVisibleChecked'] = '';
     if ($wrap['wrapvisible']) {
         $GLOBALS['GiftWrapVisibleChecked'] = 'checked="checked"';
     }
     $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate('giftwrapping.form');
     $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate();
 }
Esempio n. 14
0
 public function ConfirmOrder()
 {
     if (isset($_REQUEST['oid'])) {
         $orderId = $_REQUEST['oid'];
         $GLOBALS['ConversionCode'] = $this->GetGoogleAnalyticsScript($orderId);
     }
     if (isset($_REQUEST['continue'])) {
         $continueLocation = 'index.php?ToDo=' . $_REQUEST['continue'];
     } else {
         $continueLocation = 'index.php?ToDo=viewOrders';
     }
     $GLOBALS['Message'] = GetFlashMessageBoxes();
     $GLOBALS['ContinueLocation'] = $continueLocation;
     $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("order.confirmation");
     $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate();
 }
Esempio n. 15
0
		private function EditCategory()
		{
			$GLOBALS['Message'] = GetFlashMessageBoxes();

			if (isset($_GET['catId'])) {
				$catId = (int) $_GET['catId'];

				$this->categoryAPI->load($catId);

				$GLOBALS['CategoryName'] = isc_html_escape($this->categoryAPI->catname);
				$GLOBALS['CategoryOptions'] = $this->GetCategoryParentOptions($catId, array($this->categoryAPI->catparentid));
				$GLOBALS['CategorySort'] = isc_html_escape($this->categoryAPI->catsort);
				$GLOBALS['CategoryPageTitle'] = isc_html_escape($this->categoryAPI->catpagetitle);
				$GLOBALS['CategoryMetaKeywords'] = isc_html_escape($this->categoryAPI->catmetakeywords);
				$GLOBALS['CategoryMetaDesc'] = isc_html_escape($this->categoryAPI->catmetadesc);
				$GLOBALS['CategorySearchKeywords'] = isc_html_escape($this->categoryAPI->catsearchkeywords);

				$wysiwygOptions = array(
					'id'		=> 'wysiwyg',
					'width'		=> '656px',
					'height'	=> '250px',
					'value'		=> $this->categoryAPI->catdesc
				);
				$GLOBALS['WYSIWYG'] = GetClass('ISC_ADMIN_EDITOR')->GetWysiwygEditor($wysiwygOptions);

				$GLOBALS['FormAction'] = "saveUpdatedCategory";
				$GLOBALS['CatTitle'] = GetLang('EditCatTitle');
				$GLOBALS['CatIntro'] = GetLang('EditCatIntro');
				$GLOBALS['CancelMessage'] = GetLang('CancelEditCategory');
				$GLOBALS['hiddenFields'] = sprintf("<input type='hidden' name='categoryId' value='%d'>", $catId);

				if ($this->categoryAPI->catparentid == '0') {
					$GLOBALS['DisableFileUpload'] = 'disabled="disabled"';
					$GLOBALS['ShowFileUploadMessage'] = '';
				} else {
					$GLOBALS['DisableFileUpload'] = '';
					$GLOBALS['ShowFileUploadMessage'] = 'none';
				}

				// Get a list of all layout files
				$layoutFile = 'category.html';
				if($this->categoryAPI->catlayoutfile != '') {
					$layoutFile = $this->categoryAPI->catlayoutfile;
				}
				$GLOBALS['LayoutFiles'] = GetCustomLayoutFilesAsOptions("category.html", $layoutFile);

				$GLOBALS["CatImageMessage"] = '';
				$this->template->assign('ShowYesUseImageRow', 'none');
				if ($this->categoryAPI->catimagefile !== '') {
					$image = '../' . GetConfig('ImageDirectory') . '/' . $this->categoryAPI->catimagefile;
					$GLOBALS["CatImageMessage"] = sprintf(GetLang('CatImageDesc'), $image, $this->categoryAPI->catimagefile);
					$this->template->assign('CatImageFile', basename($this->categoryAPI->catimagefile));
					$this->template->assign('ShowYesUseImageRow', 'block');
					$this->template->assign('CatImageLink', $image);
				}


				//Google website optimizer
				$GLOBALS['GoogleWebsiteOptimizerIntro'] = GetLang('CatGoogleWebsiteOptimizerIntro');
				$GLOBALS['HideOptimizerConfigForm'] = 'display:none;';
				$GLOBALS['CheckEnableOptimizer'] = '';
				$GLOBALS['SkipOptimizerConfirmMsg'] = 'true';

				$enabledOptimizers = GetConfig('OptimizerMethods');
				if(!empty($enabledOptimizers)) {
					foreach ($enabledOptimizers as $id => $date) {
						GetModuleById('optimizer', $optimizerModule, $id);
						if ($optimizerModule->_testPage == 'categories' || $optimizerModule->_testPage == 'all') {
							$GLOBALS['SkipOptimizerConfirmMsg'] = 'false';
							break;
						}
					}
				}
				if($this->categoryAPI->cat_enable_optimizer == '1') {
					$GLOBALS['HideOptimizerConfigForm'] = '';
					$GLOBALS['CheckEnableOptimizer'] = 'Checked';
				}

				$optimizer = getClass('ISC_ADMIN_OPTIMIZER');
				$GLOBALS['OptimizerConfigForm'] = $optimizer->showPerItemConfigForm('category', $catId, CatLink($catId, $this->categoryAPI->catname));

				if(isset($_REQUEST['currentTab'])) {
					$GLOBALS['CurrentTab'] = $_REQUEST['currentTab'];
				}
				else {
					$GLOBALS['CurrentTab'] = 'details';
				}

				// Get shopping comparison options
				$shoppingComparisonModules = Isc_ShoppingComparison::getModulesWithTaxonomies();
				$GLOBALS['AlternateCategoriesCache'] = (array)json_decode($this->categoryAPI->cataltcategoriescache);
				$GLOBALS['ShoppingComparisonModules'] = $shoppingComparisonModules;

				$GLOBALS['SaveAndAddAnother'] = GetLang('SaveAndContinueEditing');

				$this->template->display('category.form.tpl');
			} else {
				if ($GLOBALS["ISC_CLASS_ADMIN_AUTH"]->HasPermission(AUTH_Manage_Categories)) {
					$this->ManageCategories();
				} else {
					$GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR);
				}
			}
		}
Esempio n. 16
0
 private function StartExport()
 {
     $GLOBALS['ExportIntro'] = sprintf(GetLang("ExportIntro"), isc_strtolower($this->type_title));
     $GLOBALS['hiddenFields'] = sprintf("<input type='hidden' name='type' value='%s'>", $this->type);
     if (!isset($_GET['results'])) {
         unset($_SESSION['searchresults']);
     }
     $templateid = 0;
     if (isset($_GET["tempId"])) {
         $templateid = (int) $_GET["tempId"];
     }
     $GLOBALS['TemplateTitle'] = $this->title;
     try {
         $GLOBALS['TemplatesList'] = $this->BuildTemplatesSelect($this->type, $templateid);
         $where = "";
         $details = $this->filetype->GetTypeDetails();
         // were specific records selected?
         if (isset($_POST[$this->type])) {
             $ids = $_POST[$this->type];
         } elseif (isset($_REQUEST["ids"])) {
             $ids = explode(",", urldecode($_REQUEST["ids"]));
         }
         if (isset($ids)) {
             // get the id field for this type
             $idfield = $details['idfield'];
             $where = $idfield . " IN (" . implode(', ', array_map(array($GLOBALS['ISC_CLASS_DB'], "Quote"), $ids)) . ")";
             $GLOBALS['hiddenFields'] .= sprintf("<input type='hidden' name='ids' value='%s'>", implode(",", $ids));
         } elseif (isset($_REQUEST['searchId']) && $_REQUEST['searchId']) {
             // was a custom view/search used?
             $searchId = $_REQUEST['searchId'];
             $GLOBALS['hiddenFields'] .= sprintf("<input type='hidden' name='searchId' value='%s'>", $_REQUEST['searchId']);
             // get the where statement for this search
             $ret = $this->filetype->GetWhereFromSearch($searchId);
             $where = $ret["where"];
             //$GLOBALS['TemplateTitle'] .= " - " . $ret['name'];
         } else {
             //$GLOBALS['TemplateTitle'] .= " - " . sprintf(GetLang("AllData"), ucfirst($this->type));
             $params = $this->GetParams();
             if (count($params)) {
                 $GLOBALS['hiddenFields'] .= sprintf("<input type='hidden' name='params' value='%s'>", http_build_query($params));
                 $where = $this->filetype->GetWhereFromParams($params);
             }
         }
         // Generate the grid
         $GLOBALS['GridData'] = $this->GetGrid($where);
         $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("export.grid");
         $GLOBALS['DataGrid'] = $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true);
         if (isset($_REQUEST['ajax'])) {
             echo $GLOBALS['DataGrid'];
             die;
         }
         // create a list of methods the user can choose from
         $methods = ISC_ADMIN_EXPORTMETHOD_FACTORY::GetExportMethodList();
         $method_list = "";
         $GLOBALS['MethodChecked'] = "checked=\"checked\"";
         foreach ($methods as $file => $method) {
             //$GLOBALS['MethodIcon'] = $method['icon'];
             $GLOBALS['MethodName'] = $method['name'];
             $GLOBALS['MethodTitle'] = $method['title'];
             $GLOBALS['MethodHelp'] = $method['help'];
             $GLOBALS["ISC_CLASS_TEMPLATE"]->SetTemplate("export.method");
             $method_list .= $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true);
             $GLOBALS['MethodChecked'] = "";
         }
         $GLOBALS['Methods'] = $method_list;
         $GLOBALS['ViewLink'] = $details['viewlink'];
     } catch (Exception $ex) {
         FlashMessage($ex->getMessage(), MSG_ERROR);
         $GLOBALS['HideForm'] = "display: none;";
     }
     $GLOBALS['Message'] = GetFlashMessageBoxes();
     $GLOBALS['FormAction'] = "runExport&t=" . $this->type;
     $GLOBALS["ISC_CLASS_TEMPLATE"]->SetTemplate("export.step1");
     $GLOBALS["ISC_CLASS_TEMPLATE"]->ParseTemplate();
 }
 private function CreateCabsize()
 {
     $GLOBALS['Message'] = GetFlashMessageBoxes();
     $GLOBALS['FormAction'] = "saveCabsizesettings";
     $GLOBALS["ISC_CLASS_TEMPLATE"]->SetTemplate("cabsize.form");
     $GLOBALS["ISC_CLASS_TEMPLATE"]->ParseTemplate();
 }
Esempio n. 18
0
		/**
		* Allow the user to enter their affiliate tracking code which will be placed on the finishorder.php page
		*
		* @return Void
		*/
		private function ManageAffiliateSettings($messages=array())
		{
			$GLOBALS['Message'] = GetFlashMessageBoxes();

			$GLOBALS['AffiliateConversionTrackingCode'] = GetConfig("AffiliateConversionTrackingCode");
			$this->template->display('settings.affiliates.manage.tpl');
		}
Esempio n. 19
0
 /**
  * Show the 'View Shipments' page.
  */
 private function ManageShipments()
 {
     $numViews = 0;
     // Fetch any shipments and place them in the data grid
     $GLOBALS['ShipmentDataGrid'] = $this->ManageShipmentsGrid();
     // Was this an ajax based sort? Return the table now
     if (isset($_REQUEST['ajax']) && $_REQUEST['ajax'] == 1) {
         echo $GLOBALS['ShipmentDataGrid'];
         return;
     }
     $GLOBALS['HideClearResults'] = 'display: none';
     if (isset($_REQUEST['searchQuery']) || isset($_GET['searchId'])) {
         $GLOBALS['HideClearResults'] = "";
     }
     if (isset($this->customSearch['searchname'])) {
         $GLOBALS['ViewName'] = isc_html_escape($this->customSearch['searchname']);
     } else {
         $GLOBALS['ViewName'] = GetLang('AllShipments');
         $GLOBALS['HideDeleteViewLink'] = 'display: none';
     }
     $GLOBALS['Message'] = GetFlashMessageBoxes();
     // Do we need to disable the delete button?
     if (!$GLOBALS['ShipmentDataGrid']) {
         $GLOBALS['DisableDelete'] = 'disabled="disabled"';
         $GLOBALS['DisableExport'] = 'disabled="disabled"';
     } else {
         if (!$GLOBALS['Message'] && count($_GET) > 1) {
             if ($this->numShipmentResults = 1) {
                 $message = GetLang('ShipmentSearchResultsBelow1');
             } else {
                 $message = sprintf(GetLang('ShipmentSearchResultsBelowX'), $this->numShipmentResults);
             }
             $GLOBALS['Message'] = MessageBox($message, MSG_SUCCESS);
         }
     }
     // Grab the custom views in a list
     if (!isset($_REQUEST['searchId'])) {
         $selectedSearch = 0;
         $GLOBALS['HideDeleteCustomView'] = 'display: none';
     } else {
         $selectedSearch = $_REQUEST['searchId'];
         $GLOBALS['HideDeleteCustomView'] = '';
         $GLOBALS['CustomViewId'] = (int) $_REQUEST['searchId'];
     }
     $GLOBALS['CustomViews'] = $GLOBALS['ISC_CLASS_ADMIN_CUSTOMSEARCH']->GetSearchesAsOptions($selectedSearch, $numViews, 'AllShipments', 'viewShipments', 'customShipmentSearch');
     // If we have nothing to show, show.. nothing?
     if (!$GLOBALS['ShipmentDataGrid']) {
         $GLOBALS['DisplayGrid'] = 'display: none';
         if (count($_GET) > 1) {
             $GLOBALS['Message'] = MessageBox(GetLang('NoShipmentResults'), MSG_ERROR);
         } else {
             $GLOBALS['Message'] = MessageBox(GetLang('NoShipments'), MSG_SUCCESS);
             $GLOBALS['DisplaySearch'] = 'display: none';
         }
     }
     $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintHeader();
     $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate('shipments.manage');
     $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate();
     $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintFooter();
 }
 public function AddUsersSweepstakes()
 {
     $GLOBALS['Message'] = GetFlashMessageBoxes();
     $GLOBALS['SweepstakesUsersTitle'] = GetLang('AddSweepstakesUsers');
     $GLOBALS['SweepstakesUsersIntro'] = GetLang('AddSweepstakesUsersIntro');
     $GLOBALS['UniversalCat'] = isset($params['catuniversal']) ? $params['catuniversal'] : 0;
     $GLOBALS['YearList'] = $this->getYMMOptions($params, 'year');
     $GLOBALS['MakeList'] = $this->getYMMOptions($params, 'make');
     $GLOBALS['ModelList'] = $this->getYMMOptions($params, 'model');
     $GLOBALS['FormAction'] = "SaveViewerSweepstakes";
     $GLOBALS['CancelMessageUsers'] = GetLang('CancelAddUsersSweepstakes');
     $GLOBALS["ISC_CLASS_TEMPLATE"]->SetTemplate("sweepstakes.users.add.form");
     $GLOBALS["ISC_CLASS_TEMPLATE"]->ParseTemplate();
 }
Esempio n. 21
0
		private function EditPageStep1($MsgDesc = "", $MsgStatus = "", $IsError = false)
		{
			$GLOBALS['Message'] = '';
			if($MsgDesc != "") {
				$GLOBALS['Message'] .= MessageBox($MsgDesc, $MsgStatus);
			}

			$GLOBALS['Message'] .= GetFlashMessageBoxes();

			$pageId = (int)$_REQUEST['pageId'];
			$arrData = array();

			if(PageExists($pageId)) {

				// Was the page submitted with a duplicate page name?
				if($IsError) {
					$this->_GetPageData(0, $arrData);
				}
				else {
					$this->_GetPageData($pageId, $arrData);
				}

				$GLOBALS['CurrentTab'] = '0';
				if(isset($_REQUEST['currentTab'])) {
					$GLOBALS['CurrentTab'] = $_REQUEST['currentTab'];
				}
				// Does this user have permission to edit this product?
				if($GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId() && $arrData['pagevendorid'] != $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId()) {
					FlashMessage(GetLang('Unauthorized'), MSG_ERROR, 'index.php?ToDo=viewPages');
				}

				$GLOBALS['PageId'] = (int) $pageId;
				$GLOBALS['SetupType'] = sprintf("SwitchType(%d);", $arrData['pagetype']);
				$GLOBALS['Title'] = GetLang('EditPage');
				$GLOBALS['FormAction'] = "editPage2";
				$GLOBALS['PageTitle'] = isc_html_escape($arrData['pagetitle']);

				$wysiwygOptions = array(
					'id'		=> 'wysiwyg',
					'value'		=> $arrData['pagecontent']
				);
				$GLOBALS['WYSIWYG'] = GetClass('ISC_ADMIN_EDITOR')->GetWysiwygEditor($wysiwygOptions);

				$GLOBALS['PageLink'] = isc_html_escape($arrData['pagelink']);
				$GLOBALS['PageFeed'] = isc_html_escape($arrData['pagefeed']);
				$GLOBALS['PageEmail'] = isc_html_escape($arrData['pageemail']);
				$GLOBALS['ParentPageOptions'] = $this->GetParentPageOptions($arrData['pageparentid'], $pageId, $arrData['pagevendorid']);
				$GLOBALS['PageKeywords'] = isc_html_escape($arrData['pagekeywords']);
				$GLOBALS['PageMetaTitle'] = isc_html_escape($arrData['pagemetatitle']);
				$GLOBALS['PageDesc'] = isc_html_escape($arrData['pagedesc']);
				$GLOBALS['PageSearchKeywords'] = isc_html_escape($arrData['pagesearchkeywords']);
				$GLOBALS['PageSort'] = (int) $arrData['pagesort'];

				if($arrData['pagestatus'] == 1) {
					$GLOBALS['Visible'] = 'checked="checked"';
				}

				if($arrData['pagecustomersonly'] == 1) {
					$GLOBALS['IsCustomersOnly'] = "checked=\"checked\"";
				}

				if(is_numeric(isc_strpos($arrData['pagecontactfields'], "fullname"))) {
					$GLOBALS['IsContactFullName'] = 'checked="checked"';
				}

				if(is_numeric(isc_strpos($arrData['pagecontactfields'], "companyname"))) {
					$GLOBALS['IsContactCompanyName'] = 'checked="checked"';
				}

				if(is_numeric(isc_strpos($arrData['pagecontactfields'], "phone"))) {
					$GLOBALS['IsContactPhone'] = 'checked="checked"';
				}

				if(is_numeric(isc_strpos($arrData['pagecontactfields'], "orderno"))) {
					$GLOBALS['IsContactOrderNo'] = 'checked="checked"';
				}

				if(is_numeric(isc_strpos($arrData['pagecontactfields'], "rma"))) {
					$GLOBALS['IsContactRMA'] = 'checked="checked"';
				}

				// Is this page the default home page?
				if($arrData['pageishomepage'] == 1) {
					$GLOBALS['IsHomePage'] = 'checked="checked"';
				}

				$GLOBALS['IsVendor'] = 'false';

				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['IsVendor'] = 'true';
						$GLOBALS['CurrentVendor'] = isc_html_escape($vendorData['vendorname']);
					}
					else {
						$GLOBALS['HideVendorLabel'] = 'display: none';
						$GLOBALS['VendorList'] = $this->BuildVendorSelect($arrData['pagevendorid']);
					}
				}

				// Get a list of all layout files
				$layoutFile = 'page.html';
				if($arrData['pagelayoutfile'] != '') {
					$layoutFile = $arrData['pagelayoutfile'];
				}
				$GLOBALS['LayoutFiles'] = GetCustomLayoutFilesAsOptions("page.html", $layoutFile);



				//Google website optimizer
				$GLOBALS['GoogleWebsiteOptimizerIntro'] = GetLang('PageGoogleWebsiteOptimizerIntro');

				$GLOBALS['HideOptimizerConfigForm'] = 'display:none;';
				$GLOBALS['CheckEnableOptimizer'] = '';
				$GLOBALS['SkipOptimizerConfirmMsg'] = 'true';

				$enabledOptimizers = GetConfig('OptimizerMethods');
				if(!empty($enabledOptimizers)) {
					foreach ($enabledOptimizers as $id => $date) {
						GetModuleById('optimizer', $optimizerModule, $id);
						if ($optimizerModule->_testPage == 'pages' || $optimizerModule->_testPage == 'all') {
							$GLOBALS['SkipOptimizerConfirmMsg'] = 'false';
							break;
						}
					}
				}

				if($arrData['page_enable_optimizer']) {
					$GLOBALS['HideOptimizerConfigForm'] = '';
					$GLOBALS['CheckEnableOptimizer'] = 'Checked';
				}

				$pageUrl = PageLink($pageId, $arrData['pagetitle']);
				$optimizer = getClass('ISC_ADMIN_OPTIMIZER');
				$GLOBALS['OptimizerConfigForm'] = $optimizer->showPerItemConfigForm('page', $pageId, $pageUrl);

				$GLOBALS['SaveAndAddAnother'] = GetLang('SaveAndContinueEditing');

				$this->template->display('page.form.tpl');
			}
			else {
				// The news page doesn't exist
				FlashMessage(GetLang('PageDoesntExist'), MSG_ERROR, 'index.php?ToDo=viewPages');
			}
		}
Esempio n. 22
0
 public function EditEngineMMY($MsgDesc = "", $MsgStatus = "")
 {
     $GLOBALS['Message'] = GetFlashMessageBoxes();
     if (isset($_GET['Id'])) {
         if ($MsgDesc != "") {
             $GLOBALS['Message'] = MessageBox($MsgDesc, $MsgStatus);
         }
         $Id = (int) $_GET['Id'];
         $eid = $_GET['eid'];
         $where = "";
         $where .= "WHERE p.id = '{$Id}'";
         if ($eid != "" and $eid != 0) {
             $where .= " AND e.id = '{$eid}'";
         } else {
             $where .= "";
         }
         $query = "SELECT p . * , e.engtype, e.liter,e.id AS eid FROM [|PREFIX|]product_mmy p LEFT JOIN [|PREFIX|]engine_table e ON p.id = e.ymm_id {$where}";
         $result = $GLOBALS["ISC_CLASS_DB"]->Query($query);
         if ($row = $GLOBALS["ISC_CLASS_DB"]->Fetch($result)) {
             $GLOBALS['Id'] = $row['id'];
             $GLOBALS['Year'] = isc_html_escape($row['year']);
             $GLOBALS['Make'] = isc_html_escape($row['make']);
             $GLOBALS['Model'] = isc_html_escape($row['model']);
             $GLOBALS['SubModel'] = isc_html_escape($row['submodel']);
             $GLOBALS['Eid'] = $_GET['eid'];
             $GLOBALS['EngineType'] = isc_html_escape($row['engtype']);
             $GLOBALS['Liter'] = isc_html_escape($row['liter']);
             $GLOBALS['EngineMMYTitle'] = GetLang('EditEngineMMY');
             $GLOBALS['EngineMMYIntro'] = GetLang('EditEngineMMYIntro');
             $GLOBALS['EngineCancelMessage'] = GetLang('CancelEditEngineMMY');
             $GLOBALS['FormAction'] = "SaveEditedEngineMMY";
             $GLOBALS["ISC_CLASS_TEMPLATE"]->SetTemplate("mmy.engine.edit.form");
             $GLOBALS["ISC_CLASS_TEMPLATE"]->ParseTemplate();
         } else {
             ob_end_clean();
             header("Location: index.php?ToDo=viewEngineMMY");
             die;
         }
     } else {
         ob_end_clean();
         header("Location: index.php?ToDo=viewEngineMMY");
         die;
     }
 }
Esempio n. 23
0
 public function SweepstakesForm($MsgDesc = "", $MsgStatus = "")
 {
     if (isset($_POST['sweepstakes_email']) && !empty($_POST['sweepstakes_email'])) {
         $_POST['email'] = $_POST['sweepstakes_email'];
     }
     $GLOBALS['urlreferrer'] = '';
     if (isset($_POST['sweepstakes_refurl']) && !empty($_POST['sweepstakes_refurl'])) {
         $GLOBALS['urlreferrer'] = $_POST['sweepstakes_refurl'];
         setcookie('tc_my_urlreferrer', $_POST['sweepstakes_refurl'], time() + 3600 * 24, '/');
     } else {
         if (isset($_COOKIE['tc_my_urlreferrer']) && !empty($_COOKIE['tc_my_urlreferrer'])) {
             $GLOBALS['urlreferrer'] = $_COOKIE['tc_my_urlreferrer'];
         }
     }
     $GLOBALS['Message'] = GetFlashMessageBoxes();
     $GLOBALS['HideErrorMessage'] = 'none';
     if ($MsgDesc != "") {
         $GLOBALS['Message'] = MessageBox($MsgDesc, $MsgStatus);
     }
     $cdate = date('Y-m-d');
     $query = $GLOBALS['ISC_CLASS_DB']->Query("SELECT * FROM [|PREFIX|]sweepstakes_master WHERE active = '1' AND startdate <= '{$cdate}' AND enddate >= '{$cdate}' LIMIT 0 , 1 ");
     $row = $GLOBALS['ISC_CLASS_DB']->Fetch($query);
     $sweepstakesId = $row['sweepstakesid'];
     $_SESSION['SweepstakesId'] = '';
     if ($sweepstakesId != '') {
         $_SESSION['SweepstakesId'] = $sweepstakesId;
         //            $query = $GLOBALS['ISC_CLASS_DB']->Query("SELECT * FROM [|PREFIX|]sweepstakes_master where sweepstakesid = '$sweepstakesId'");
         $params = array();
         $title = $row['title'];
         $browsertitle = $row['browsertitle'];
         $GLOBALS['Description'] = $row['description'];
         $GLOBALS['MotorcycleSweepstakes'] = $title;
         $GLOBALS['UniversalCat'] = isset($params['catuniversal']) ? $params['catuniversal'] : 0;
         $GLOBALS['YearList'] = $this->getYMMOptions($params, 'year');
         $GLOBALS['MakeList'] = $this->getYMMOptions($params, 'make');
         $GLOBALS['ModelList'] = $this->getYMMOptions($params, 'model');
         if ($GLOBALS['EnableSEOUrls'] == 1) {
             $GLOBALS['FormAction'] = $GLOBALS['ShopPath'] . "/sweepstakes/savesweepstakes";
         } else {
             $GLOBALS['FormAction'] = $GLOBALS['ShopPath'] . "/sweepstakes.php?action=savesweepstakes";
         }
         //            $GLOBALS['YMMTable']     = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("YMMOptions");
         if (isset($_POST['email'])) {
             $GLOBALS['Email'] = $_POST['email'];
             $GLOBALS['Firstname'] = $_POST['firstname'];
             $GLOBALS['Lastname'] = $_POST['lastname'];
             $GLOBALS['PhoneNumber'] = $_POST['phone'];
             $GLOBALS['AddressLine1'] = $_POST['address1'];
             $GLOBALS['AddressLine2'] = $_POST['address2'];
             $GLOBALS['City'] = $_POST['city'];
             $GLOBALS['State'] = $_POST['states'];
             $GLOBALS['ZipCode'] = $_POST['zipcode'];
         }
         // Generate the captcha image
         $GLOBALS['ISC_CLASS_CAPTCHA'] = GetClass('ISC_CAPTCHA');
         $GLOBALS['ISC_CLASS_CAPTCHA']->CreateSecret();
         $GLOBALS['CaptchaImage'] = $GLOBALS['ISC_CLASS_CAPTCHA']->ShowCaptcha();
         $GLOBALS['ISC_CLASS_TEMPLATE']->SetPageTitle($browsertitle);
         $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("sweepstakes");
         $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate();
     } else {
         ob_end_clean();
         header(sprintf("Location: %s", $GLOBALS['ShopPath']));
         die;
     }
 }
 /**
  * Show the page listing the vendor payments.
  */
 private function ManageVendorPayments()
 {
     // Fetch any payments and place them in a data grid
     $GLOBALS['PaymentDataGrid'] = $this->ManageVendorPaymentsGrid();
     // Was this an ajax based sort? Return the table now
     if (isset($_REQUEST['ajax']) && $_REQUEST['ajax'] == 1) {
         echo $GLOBALS['PaymentDataGrid'];
         return;
     }
     $GLOBALS['HideClearResults'] = 'display: none';
     if (isset($_REQUEST['vendorId']) && $_REQUEST['vendorId'] != 0) {
         $GLOBALS['HideClearResults'] = "";
         $selectedVendor = $_REQUEST['vendorId'];
     } else {
         $selectedVendor = 0;
     }
     $GLOBALS['VendorList'] = $this->BuildVendorList($selectedVendor);
     $GLOBALS['Message'] = GetFlashMessageBoxes();
     // Do we need to disable the export button and hide the search options?
     if (!$GLOBALS['PaymentDataGrid']) {
         $GLOBALS['DisableExport'] = 'disabled="disabled"';
         $GLOBALS['DisplayGrid'] = 'display: none';
         $GLOBALS['DisableDelete'] = 'disabled="disabled"';
         $vendorCache = $GLOBALS['ISC_CLASS_DATA_STORE']->Read('Vendors');
         if (count($_GET) > 1) {
             $GLOBALS['Message'] = MessageBox(GetLang('NoPaymentsForVendor'), MSG_ERROR);
         } else {
             if (empty($vendorCache)) {
                 $GLOBALS['DisableAdd'] = 'disabled="disabled"';
                 $GLOBALS['DisplaySearch'] = 'display: none';
                 $GLOBALS['Message'] = MessageBox(GetLang('NoVendorsConfigured'), MSG_ERROR);
             } else {
                 $GLOBALS['Message'] = MessageBox(GetLang('NoVendorPayments'), MSG_SUCCESS);
                 $GLOBALS['DisplaySearch'] = 'display: none';
             }
         }
     }
     $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintHeader();
     $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate('vendorpayments.manage');
     $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate();
     $GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintFooter();
 }
Esempio n. 25
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();
		}
Esempio n. 26
0
 /**
  * Set up all of the template variables and predefined values for showing the form to edit an
  * existing order or create a new order. Will also set up the post variables as values if this
  * is a post request.
  *
  * @param array Optionally, if editing an order, the existing order to use for the default values.
  */
 private function SetupOrderManagementForm($order = array())
 {
     $GLOBLS['CurrentTab'] = 0;
     if ($_SERVER['REQUEST_METHOD'] == 'POST') {
         $postData = $_POST;
     } else {
         $postData = $order;
     }
     $orderFields = array('OrderBillFirstName' => 'ordbillfirstname', 'OrderBillLastName' => 'ordbilllastname', 'OrderBillCompany' => 'ordbillcompany', 'OrderBillPhone' => 'ordbillphone', 'OrderBillStreet1' => 'ordbillstreet1', 'OrderBillStreet2' => 'ordbillstreet2', 'OrderBillSuburb' => 'ordbillsuburb', 'OrderBillZip' => 'ordbillzip', 'OrderShipFirstName' => 'ordshipfirstname', 'OrderShipLastName' => 'ordshiplastname', 'OrderShipCompany' => 'ordshipcompany', 'OrderShipPhone' => 'ordshipphone', 'OrderShipStreet1' => 'ordshipstreet1', 'OrderShipStreet2' => 'ordshipstreet2', 'OrderShipSuburb' => 'ordshipsuburb', 'OrderShipZip' => 'ordshipzip', 'CustomerEmail' => 'custconemail', 'CustomerPassword' => 'custpassword', 'CustomerPassword2' => 'custpassword2', 'CustomerStoreCredit' => 'custstorecredit', 'CustomerGroup' => 'custgroupid', 'CustomerType' => 'customerType', 'OrderComments' => 'ordcustmessage', 'OrderNotes' => 'ordnotes', 'OrderId' => 'orderid', 'OrderTrackingNo' => 'ordtrackingno', 'AnonymousEmail' => 'anonymousemail');
     $GLOBALS['HideSelectedCustomer'] = 'display: none';
     $GLOBALS['HideCustomerSearch'] = '';
     $GLOBALS['HideAddressSelects'] = 'display: none';
     if (isset($postData['ordcustid']) && $postData['ordcustid'] > 0) {
         $GLOBALS['CurrentTab'] = 1;
         $GLOBALS['CustomerType'] = 'existing';
         $query = "\n\t\t\t\t\tSELECT *\n\t\t\t\t\tFROM [|PREFIX|]customers WHERE customerid='" . (int) $postData['ordcustid'] . "'\n\t\t\t\t";
         $result = $GLOBALS['ISC_CLASS_DB']->Query($query);
         $existingCustomer = $GLOBALS['ISC_CLASS_DB']->Fetch($result);
         if ($existingCustomer['customerid']) {
             $GLOBALS['HideSelectedCustomer'] = '';
             $GLOBALS['HideCustomerSearch'] = 'display: none';
             $GLOBALS['HideHistoryLink'] = 'display: none';
             $GLOBALS['CustomerId'] = $existingCustomer['customerid'];
             $GLOBALS['CustomerFirstName'] = isc_html_escape($existingCustomer['custconfirstname']);
             $GLOBALS['CustomerLastName'] = isc_html_escape($existingCustomer['custconlastname']);
             $GLOBALS['CustomerPhone'] = '';
             if ($existingCustomer['custconphone']) {
                 $GLOBALS['CustomerPhone'] = isc_html_escape($existingCustomer['custconphone']) . '<br />';
             }
             $GLOBALS['CustomerEmail'] = '';
             if ($existingCustomer['custconemail']) {
                 $GLOBALS['CustomerEmail'] = '<a href="mailto:' . isc_html_escape($existingCustomer['custconemail']) . '">' . isc_html_escape($existingCustomer['custconemail']) . '</a><br />';
             }
             $GLOBALS['CustomerCompany'] = '';
             if ($existingCustomer['custconcompany']) {
                 $GLOBALS['CustomerCompany'] = isc_html_escape($existingCustomer['custconcompany']) . '<br />';
             }
             // Grab the addresses
             $addresses = $this->LoadCustomerAddresses($existingCustomer['customerid']);
             $GLOBALS['AddressJson'] = 'OrderManager.LoadInAddresses(' . isc_json_encode($addresses) . ');';
             if (!empty($addresses)) {
                 $GLOBALS['HideAddressSelects'] = '';
                 $GLOBALS['DisableAddressSelects'] = 'disabled="disabled"';
             }
             $GLOBALS['SelectedCustomer'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet('OrdersCustomerSearchResult');
         }
     } else {
         if (isset($postData['ordcustid']) && $postData['ordcustid'] == 0) {
             if (!isset($postData['customerType'])) {
                 $GLOBALS['CurrentTab'] = 2;
             } else {
                 if ($postData['customerType'] == 'anonymous') {
                     $GLOBALS['CurrentTab'] = 2;
                 } else {
                     $GLOBALS['CurrenTab'] = 1;
                 }
             }
         }
     }
     /**
      * Customer and order custom fields
      */
     $GLOBALS['OrderCustomFormFieldsAccountFormId'] = FORMFIELDS_FORM_ACCOUNT;
     $GLOBALS['OrderCustomFormFieldsBillingFormId'] = FORMFIELDS_FORM_BILLING;
     $GLOBALS['OrderCustomFormFieldsShippingFormId'] = FORMFIELDS_FORM_SHIPPING;
     $GLOBALS['CustomFieldsAccountLeftColumn'] = '';
     $GLOBALS['CustomFieldsAccountRightColumn'] = '';
     $GLOBALS['CustomFieldsBillingColumn'] = '';
     $GLOBALS['CustomFieldsShippingColumn'] = '';
     $formIdx = array(FORMFIELDS_FORM_ACCOUNT, FORMFIELDS_FORM_BILLING, FORMFIELDS_FORM_SHIPPING);
     $fieldMap = array('FirstName' => 'firstname', 'LastName' => 'lastname', 'Company' => 'company', 'Phone' => 'phone', 'AddressLine1' => 'street1', 'AddressLine2' => 'street2', 'City' => 'suburb', 'Zip' => 'zip', 'Country' => 'country', 'State' => 'state');
     /**
      * Now process the forms
      */
     foreach ($formIdx as $formId) {
         $formSessionId = 0;
         if ($formId == FORMFIELDS_FORM_ACCOUNT) {
             /**
              * We are only using the real custom fields for the account section, so check here
              */
             if (!gzte11(ISC_MEDIUMPRINT)) {
                 continue;
             }
             if (isset($existingCustomer['custformsessionid'])) {
                 $formSessionId = $existingCustomer['custformsessionid'];
             }
         } else {
             if (isset($postData['ordformsessionid'])) {
                 $formSessionId = $postData['ordformsessionid'];
             }
         }
         /**
          * This part here gets all the existing fields
          */
         if ($_SERVER['REQUEST_METHOD'] == 'POST') {
             $fields = $GLOBALS['ISC_CLASS_FORM']->getFormFields($formId, true);
         } else {
             if (isId($formSessionId)) {
                 $fields = $GLOBALS['ISC_CLASS_FORM']->getFormFields($formId, false, $formSessionId);
             } else {
                 $fields = $GLOBALS['ISC_CLASS_FORM']->getFormFields($formId);
             }
         }
         /**
          * Get any selected country and state. This needs to be separate as we physically
          * print out each form field at a time so we need this information before hand
          */
         if ($formId !== FORMFIELDS_FORM_ACCOUNT) {
             $countryId = GetCountryIdByName(GetConfig('CompanyCountry'));
             $stateFieldId = 0;
             foreach (array_keys($fields) as $fieldId) {
                 if (isc_strtolower($fields[$fieldId]->record['formfieldprivateid']) == 'state') {
                     $stateFieldId = $fieldId;
                 } else {
                     if (isc_strtolower($fields[$fieldId]->record['formfieldprivateid']) == 'country') {
                         if ($_SERVER['REQUEST_METHOD'] == 'POST') {
                             $country = $fields[$fieldId]->getValue();
                         }
                         if ($formId == FORMFIELDS_FORM_BILLING) {
                             $country = @$order['ordbillcountry'];
                         } else {
                             $country = @$order['ordshipcountry'];
                         }
                         if (trim($country) !== '') {
                             $countryId = GetCountryIdByName($country);
                         }
                     }
                 }
             }
         }
         /**
          * Now we construct and build each form field
          */
         $column = 0;
         foreach (array_keys($fields) as $fieldId) {
             if ($formId == FORMFIELDS_FORM_ACCOUNT) {
                 if ($fields[$fieldId]->record['formfieldprivateid'] !== '' || !gzte11(ISC_MEDIUMPRINT)) {
                     continue;
                 }
                 $fieldHTML = $fields[$fieldId]->loadForFrontend();
                 if ($column % 2 > 0) {
                     $varname = 'CustomFieldsAccountLeftColumn';
                 } else {
                     $varname = 'CustomFieldsAccountRightColumn';
                 }
             } else {
                 /**
                  * We are using all the custom fields for the billing/shipping are, so check here
                  */
                 if (!gzte11(ISC_MEDIUMPRINT) && $fields[$fieldId]->record['formfieldprivateid'] == '') {
                     continue;
                 }
                 if ($formId == FORMFIELDS_FORM_BILLING) {
                     $varname = 'CustomFieldsBillingColumn';
                 } else {
                     $varname = 'CustomFieldsShippingColumn';
                 }
                 /**
                  * Set the value for the private fields if this is NOT a post
                  */
                 if ($_SERVER['REQUEST_METHOD'] !== 'POST' && $fields[$fieldId]->record['formfieldprivateid'] !== '') {
                     $key = @$fieldMap[$fields[$fieldId]->record['formfieldprivateid']];
                     if (trim($key) !== '') {
                         if ($formId == FORMFIELDS_FORM_BILLING) {
                             $key = 'ordbill' . $key;
                         } else {
                             $key = 'ordship' . $key;
                         }
                         if (array_key_exists($key, $order)) {
                             $fields[$fieldId]->setValue($order[$key]);
                         }
                     }
                 }
                 /**
                  * Add in any of the country/state lists if needed
                  */
                 if (isc_strtolower($fields[$fieldId]->record['formfieldprivateid']) == 'country') {
                     $fields[$fieldId]->setOptions(array_values(GetCountryListAsIdValuePairs()));
                     if ($fields[$fieldId]->getValue() == '') {
                         $fields[$fieldId]->setValue(GetConfig('CompanyCountry'));
                     }
                     $fields[$fieldId]->addEventHandler('change', 'FormFieldEvent.SingleSelectPopulateStates', array('countryId' => $fieldId, 'stateId' => $stateFieldId, 'inOrdersAdmin' => true));
                 } else {
                     if (isc_strtolower($fields[$fieldId]->record['formfieldprivateid']) == 'state' && isId($countryId)) {
                         $stateOptions = GetStateListAsIdValuePairs($countryId);
                         if (is_array($stateOptions) && !empty($stateOptions)) {
                             $fields[$fieldId]->setOptions($stateOptions);
                         }
                     }
                 }
                 /**
                  * We also do not what these fields
                  */
                 if (isc_strtolower($fields[$fieldId]->record['formfieldprivateid']) == 'savethisaddress' || isc_strtolower($fields[$fieldId]->record['formfieldprivateid']) == 'shiptoaddress') {
                     continue;
                 }
             }
             $GLOBALS[$varname] .= $fields[$fieldId]->loadForFrontend() . "\n";
             $column++;
         }
     }
     /**
      * Add this to generate our JS event script
      */
     $GLOBALS['FormFieldEventData'] = $GLOBALS['ISC_CLASS_FORM']->buildRequiredJS();
     /**
      * Do we display the customer custom fields?
      */
     if (!gzte11(ISC_MEDIUMPRINT)) {
         $GLOBALS['HideCustomFieldsAccountLeftColumn'] = 'none';
         $GLOBALS['HideCustomFieldsAccountRightColumn'] = 'none';
     } else {
         if ($GLOBALS['CustomFieldsAccountLeftColumn'] == '') {
             $GLOBALS['HideCustomFieldsAccountLeftColumn'] = 'none';
         }
         if ($GLOBALS['CustomFieldsAccountRightColumn'] == '') {
             $GLOBALS['HideCustomFieldsAccountRightColumn'] = 'none';
         }
     }
     $defaultValues = array('custgroupid' => 0, 'ordstatus' => 7);
     foreach ($defaultValues as $postField => $default) {
         if (!isset($postData[$postField])) {
             $postData[$postField] = $default;
         }
     }
     foreach ($orderFields as $templateField => $orderField) {
         if (!isset($postData[$orderField])) {
             $GLOBALS[$templateField] = '';
         } else {
             $GLOBALS[$templateField] = isc_html_escape($postData[$orderField]);
         }
     }
     if (isset($postData['ordbillsaveAddress'])) {
         $GLOBALS['OrderBillSaveAddress'] = 'checked="checked"';
     }
     if (isset($postData['ordshipsaveAddress'])) {
         $GLOBALS['OrderShipSaveAddress'] = 'checked="checked"';
     }
     if (isset($postData['shippingUseBilling'])) {
         $GLOBALS['ShippingUseBillingChecked'] = 'checked="checked"';
     }
     if (isset($postData['billingUseShipping'])) {
         $GLOBALS['BillingUseShippingChecked'] = 'checked="checked"';
     }
     $GLOBALS['OrderStatusOptions'] = $this->GetOrderStatusOptions($postData['ordstatus']);
     $customerClass = GetClass('ISC_ADMIN_CUSTOMERS');
     $GLOBALS['CustomerGroupOptions'] = $customerClass->GetCustomerGroupsAsOptions($postData['custgroupid']);
     $GLOBALS['PaymentMethodsList'] = $this->GetPaymentProviderList($postData);
     if (!empty($order)) {
         $GLOBALS['HideEmailInvoice'] = 'display: none';
     } else {
         if (isset($postData['emailinvoice'])) {
             $GLOBALS['EmailInvoiceChecked'] = 'checked="checked"';
         }
     }
     $GLOBALS['Message'] = GetFlashMessageBoxes();
 }
 /**
  * Displays the Edit Template form
  *
  */
 private function EditTemplate($loadFromPost = false, $templateid = 0)
 {
     try {
         // no template supplied, 404
         if (!$templateid) {
             if (!isset($_GET["tempId"])) {
                 throw new Exception(GetLang("NoTemplateId"));
             }
             $templateid = $_GET["tempId"];
             $_SESSION['TemplateId'] = $templateid;
         }
         $template = $this->GetTemplate($templateid);
     } catch (Exception $ex) {
         FlashMessage($ex->getMessage(), MSG_ERROR, 'index.php?ToDo=viewimporttemplates');
     }
     $GLOBALS['TemplateId'] = $templateid;
     $GLOBALS['FormAction'] = "updateImportTemplate";
     $GLOBALS['TemplateTitle'] = GetLang("EditImTemplateTitle");
     $GLOBALS['CancelMessage'] = GetLang("CancelEditTemplate");
     $GLOBALS['SaveAndAddAnother'] = GetLang('SaveAndContinueEditing');
     $GLOBALS['hiddenFields'] = sprintf("<input type='hidden' name='tempId' value='%d'>", $templateid);
     $GLOBALS['Vendor'] = $template['vendorid'];
     if (isset($_GET["tab"])) {
         $GLOBALS['ShowTabScript'] = "ShowTab(" . (int) $_GET["tab"] . ");";
     }
     if ($loadFromPost) {
         // reload posted data
         $this->SetGlobalsFromPost();
     } else {
         // load template settings
         $GLOBALS['ExportTemplateName'] = isc_html_escape($template['importtemplatename']);
         if ($template['blankforfalse']) {
             $GLOBALS['BlankForFalseChecked'] = "checked=\"checked\"";
         }
         $GLOBALS['ExportTemplateDesc'] = $template['description'];
         $GLOBALS['ExportTemplateCreationTime'] = $template['creation_time'];
         $GLOBALS['ExportTemplateModifiedTime'] = $template['mod_time'];
         $usedTypes = explode(",", $template['usedtypes']);
         // grid fields
         $types = $this->SetTypeData($templateid, $usedTypes);
         // method settings
         //$ret = $this->BuildSettings($this->GetMethodSettings($templateid));
         //$GLOBALS['Settings'] = $ret['html'];
         //$GLOBALS['VerifyJS'] .= $ret['js'];
     }
     if (gzte11(ISC_HUGEPRINT) && !$GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId() && $GLOBALS['Vendor']) {
         $GLOBALS['VendorLabel'] = GetLang("VendorLabel");
         $query = "SELECT * FROM [|PREFIX|]vendors WHERE vendorid = '" . $GLOBALS['Vendor'] . "'";
         $result = $GLOBALS['ISC_CLASS_DB']->Query($query);
         $vendorData = $GLOBALS['ISC_CLASS_DB']->Fetch($result);
         if (isset($vendorData['vendorid'])) {
             $GLOBALS['VendorData'] = isc_html_escape($vendorData['vendorname']);
         }
     } else {
         $GLOBALS['HideVendorRow'] = 'style="display: none;"';
     }
     $GLOBALS['Message'] = GetFlashMessageBoxes();
     $GLOBALS["ISC_CLASS_TEMPLATE"]->SetTemplate("importtemplates.form");
     $GLOBALS["ISC_CLASS_TEMPLATE"]->ParseTemplate();
 }
Esempio n. 28
0
	private function loadProductComments($productId)
	{
		$GLOBALS['ProductId'] = $productId;

		// Are there any reviews for this product? If so, load them
		if ($GLOBALS['ISC_CLASS_PRODUCT']->GetNumReviews() == 0) {
			$GLOBALS['NoReviews'] = GetLang('NoReviews');
		}
		else {
			// Setup paging data
			$reviewsTotal = $GLOBALS['ISC_CLASS_PRODUCT']->GetNumReviews();
			$reviewsPerPage = GetConfig('ProductReviewsPerPage');
			$pages = ceil($reviewsTotal / $reviewsPerPage);

			$revpage = 1;
			$start = 0;

			if (isset($_GET['revpage'])) {
				$revpage = (int)$_GET['revpage'];
			}

			if ($revpage < 1) {
				$revpage = 1;
			}
			elseif ($revpage > $pages) {
				$revpage = $pages;
			}

			$start = ($revpage - 1) * $reviewsPerPage;

			$GLOBALS['ProductNumReviews'] = $reviewsTotal;
			$GLOBALS['ReviewStart'] = $start + 1;
			$GLOBALS['ReviewEnd'] = $start + $reviewsPerPage;

			// do we need to show paging?
			if ($pages > 1) {
				// Form the previous and next links
				$reviewLink = ProdLink($GLOBALS['ISC_CLASS_PRODUCT']->GetProductName());
				if($GLOBALS['EnableSEOUrls'] == 1) {
					$reviewLink .= '?revpage=';
				}
				else {
					$reviewLink .= '&revpage=';
				}

				if ($GLOBALS['ReviewEnd'] > $reviewsTotal) {
					$GLOBALS['ReviewEnd'] = $reviewsTotal;
				}

				// show a previous link
				if ($revpage > 1) {
					$GLOBALS["ReviewLink"] = $reviewLink . ($revpage - 1);
					$GLOBALS["PrevRevLink"] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ProductReviewPreviousLink");
				}

				// show a next link
				if ($revpage < $pages) {
					$GLOBALS["ReviewLink"] = $reviewLink . ($revpage + 1);
					$GLOBALS["NextRevLink"] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ProductReviewNextLink");
				}

				$GLOBALS['ProductReviewPaging'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ProductReviewPaging");
			}

			// Load all reviews for this product
			$query = "
				SELECT *
				FROM [|PREFIX|]reviews
				WHERE revproductid='".(int)$GLOBALS['ISC_CLASS_PRODUCT']->GetProductId()."' AND revstatus='1'
				ORDER BY revdate DESC
			";
			$query .= $GLOBALS['ISC_CLASS_DB']->AddLimit($start, $reviewsPerPage);
			$result = $GLOBALS['ISC_CLASS_DB']->Query($query);

			$GLOBALS['ProductReviews'] = "";

			$GLOBALS['AlternateReviewClass'] = '';
			$GLOBALS['ReviewNumber'] = $GLOBALS['ReviewStart'];
			while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
				$GLOBALS['ReviewRating'] = (int) $row['revrating'];
				$GLOBALS['ReviewTitle'] = isc_html_escape($row['revtitle']);
				$GLOBALS['ReviewDate'] = isc_date(GetConfig('DisplayDateFormat'), $row['revdate']);

				if ($row['revfromname'] != "") {
					$GLOBALS['ReviewName'] = isc_html_escape($row['revfromname']);
				} else {
					$GLOBALS['ReviewName'] = GetLang('Unknown');
				}

				$GLOBALS['ReviewText'] = nl2br(isc_html_escape($row['revtext']));

				$GLOBALS['ProductReviews'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ProductReviewItem");
				++$GLOBALS['ReviewNumber'];
				if($GLOBALS['AlternateReviewClass']) {
					$GLOBALS['AlternateReviewClass'] = '';
				}
				else {
					$GLOBALS['AlternateReviewClass'] = 'Alt';
				}
			}

			$GLOBALS['ProductReviewList'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ProductReviewList");
		}

		// Is captcha enabled?
		if (GetConfig('CaptchaEnabled') == false) {
			$GLOBALS['HideReviewCaptcha'] = "none";
		}
		else {
			// Generate the captcha image
			$GLOBALS['ISC_CLASS_CAPTCHA'] = GetClass('ISC_CAPTCHA');
			$GLOBALS['ISC_CLASS_CAPTCHA']->CreateSecret();
			$GLOBALS['CaptchaImage'] = $GLOBALS['ISC_CLASS_CAPTCHA']->ShowCaptcha();
		}

		$GLOBALS['ProductReviewFlashMessages'] = GetFlashMessageBoxes('reviews');

		// If we've got review data in the session then we need to show the review form
		if(!empty($_SESSION['productReviewData']['product_id'])) {
			// But only if it's for the current product
			 if($_SESSION['productReviewData']['product_id'] == $productId) {
				$GLOBALS['AutoShowReviewForm'] = 1;

				$reviewFields = array(
					'RevTitle' => 'revtitle',
					'RevText' => 'revtext',
					'RevFromName' => 'revfromname',
				);

				foreach($reviewFields as $templateVar => $field) {
					if(!empty($_SESSION['productReviewData'])) {
						$GLOBALS[$templateVar] = isc_html_escape($_SESSION['productReviewData'][$field]);
					}
				}

				if(isset($_SESSION['productReviewData']['revrating'])) {
					$GLOBALS['ReviewRating'.(int)$_SESSION['productReviewData']['revrating']] = 'selected="selected"';
				}
			}

			// Make sure we remove any review data
			unset($_SESSION['productReviewData']);
		}

		$GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("product_comments");
		return $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true);
	}
Esempio n. 29
0
	/**
	 * Show the "Edit Vendor" form.
	 */
	private function EditVendor()
	{
		$GLOBALS['Message'] = GetFlashMessageBoxes();
		$vendor = $this->GetVendorData($_REQUEST['vendorId']);

		// If the vendor doesn't exist, show an error message
		if(!isset($vendor['vendorid'])) {
			FlashMessage(GetLang('InvalidVendor'), MSG_ERROR, 'index.php?ToDo=viewVendors');
		}

		// Set up the form title and action
		$GLOBALS['FormAction']	= 'SaveUpdatedVendor';
		if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Manage_Vendors)) {
			$GLOBALS['Title']		= GetLang('EditVendor');
		}
		else {
			$GLOBALS['Title']		= GetLang('VendorProfile');
		}
		$GLOBALS['Intro']		= GetLang('EditVendorIntro');

		// Set the form values
		$GLOBALS['VendorId']		= (int)$vendor['vendorid'];
		$GLOBALS['VendorName']		= isc_html_escape($vendor['vendorname']);
		$GLOBALS['VendorPhone']		= isc_html_escape($vendor['vendorphone']);
		$GLOBALS['VendorAddress']	= isc_html_escape($vendor['vendoraddress']);
		$GLOBALS['VendorCity']		= isc_html_escape($vendor['vendorcity']);
		$GLOBALS['VendorZip']		= isc_html_escape($vendor['vendorzip']);
		$GLOBALS['CountryList']		= GetCountryList($vendor['vendorcountry']);
		$GLOBALS['VendorEmail']		= isc_html_escape($vendor['vendoremail']);
		$GLOBALS['VendorState']		= isc_html_escape($vendor['vendorstate']);

		$vendorLogoSize = GetConfig('VendorLogoSize');
		if(!$vendorLogoSize) {
			$GLOBALS['HideLogoUpload'] = 'display: none';
		}
		else {
			$GLOBALS['HideCurrentVendorLogo'] = 'display: none';
			if($vendor['vendorlogo']) {
				$GLOBALS['HideCurrentVendorLogo'] = '';
				$GLOBALS['CurrentVendorLogoLink'] = GetConfig('ShopPath').'/'.GetConfig('ImageDirectory').'/'.isc_html_escape($vendor['vendorlogo']);
				$GLOBALS['CurrentVendorLogo'] = isc_html_escape($vendor['vendorlogo']);
			}
		}

		$vendorPhotoSize = GetConfig('VendorPhotoSize');
		if(!$vendorPhotoSize) {
			$GLOBALS['HidePhotoUpload'] = 'display: none';
		}
		else {
			$GLOBALS['HideCurrentVendorPhoto'] = 'display: none';
			if($vendor['vendorphoto']) {
				$GLOBALS['HideCurrentVendorPhoto'] = '';
				$GLOBALS['CurrentVendorPhotoLink'] = GetConfig('ShopPath').'/'.GetConfig('ImageDirectory').'/'.isc_html_escape($vendor['vendorphoto']);
				$GLOBALS['CurrentVendorPhoto'] = isc_html_escape($vendor['vendorphoto']);
			}
		}

		if($vendor['vendororderemail'] != '') {
			$GLOBALS['VendorForwardInvoices'] = 'checked="checked"';
			$GLOBALS['VendorOrderEmail'] = isc_html_escape($vendor['vendororderemail']);
		}
		else {
			$GLOBALS['HideForwardInvoiceEmails'] = 'display: none';
		}

		$GLOBALS['VendorProfitMargin'] = number_format($vendor['vendorprofitmargin'], GetConfig('DecimalPlaces'), GetConfig('DecimalToken'), '');

		// Vendor has configured shipping
		if($vendor['vendorshipping'] == 1) {
			$GLOBALS['VendorShippingCustom'] = 'checked="checked"';
			$GLOBALS['HideStoreMethodsList'] = 'display: none';

			// Fetch any shipping methods set up
			$GLOBALS['HideShippingNotConfigured'] = 'display: none';

			// Fetch any shipping zones, place them in the data grid
			$GLOBALS['ISC_CLASS_ADMIN_SETTINGS_SHIPPING'] = GetClass('ISC_ADMIN_SETTINGS_SHIPPING');
			$GLOBALS['ShippingZonesGrid'] = $GLOBALS['ISC_CLASS_ADMIN_SETTINGS_SHIPPING']->ManageShippingZonesGrid($numZones);

			// No shipping zones have been configured yet
			if($numZones == 0) {
				$GLOBALS['DisableDeleteZones'] = 'disabled="disabled"';
				$GLOBALS['DisplayZoneGrid'] = "none";
				$GLOBALS['NoZonesMessage'] = MessageBox(GetLang('NoShippingZones'), MSG_SUCCESS);
			}

		}
		// Using store shipping
		else {
			$GLOBALS['VendorShippingDefault'] = 'checked="checked"';
			$GLOBALS['HideShippingZonesGrid'] = 'display: none';
		}

		// Fetch a list of the shipping methods available for the entire store
		$GLOBALS['StoreShippingMethods'] = $this->GetStoreShippingMethods();

		if($GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId() > 0) {
			$GLOBALS['HidePermissions'] = 'display: none';
		}
		// Showing the permissions table, so generate the list for that
		else {
			$GLOBALS['HidePermissions'] = '';

			$accessibleCategories = '';
			if($vendor['vendoraccesscats']) {
				$accessibleCategories = explode(',', $vendor['vendoraccesscats']);
				$accessibleCategories = array_map('intval', $accessibleCategories);
			}

			if(empty($accessibleCategories)) {
				$GLOBALS['AccessAllCategories'] = 'checked="checked"';
				$GLOBALS['HideAccessCategories'] = 'display: none';
			}

			$categoryClass = GetClass('ISC_ADMIN_CATEGORY');
			$GLOBALS['AccessCategoryOptions'] = $categoryClass->GetCategoryOptions($accessibleCategories,  "<option %s value='%d'>%s</option>", 'selected="selected"', "", false);
		}

		$stateOptions = GetStatesByCountryNameAsOptions($vendor['vendorcountry'], $numStates, $vendor['vendorstate']);

		if ($numStates > 0) {
			// Show the states dropdown list
			$GLOBALS['StateList'] = $stateOptions;
			$GLOBALS['HideStateBox'] = 'display: none';
		}
		else {
			// Show the states text box
			$GLOBALS['HideStateList'] = 'display: none';
		}
		// Initialize the WYSIWYG editor
		$wysiwygOptions = array(
			'id'		=> 'wysiwyg',
			'width'		=> '100%',
			'height'	=> '500px',
			'value'		=> $vendor['vendorbio']
		);
		$GLOBALS['WYSIWYG'] = GetClass('ISC_ADMIN_EDITOR')->GetWysiwygEditor($wysiwygOptions);

		$GLOBALS['SaveAndAddAnother'] = GetLang('SaveAndContinueEditing');
		$this->template->display('vendor.form.tpl');
	}
Esempio n. 30
0
 public function EditSeries($MsgDesc = "", $MsgStatus = "")
 {
     $GLOBALS['Message'] = GetFlashMessageBoxes();
     if (isset($_GET['seriesId'])) {
         if ($MsgDesc != "") {
             $GLOBALS['Message'] = MessageBox($MsgDesc, $MsgStatus);
         }
         $seriesId = (int) $_GET['seriesId'];
         $query = sprintf("select * from [|PREFIX|]brand_series where seriesid='%d'", $GLOBALS['ISC_CLASS_DB']->Quote($seriesId));
         $result = $GLOBALS["ISC_CLASS_DB"]->Query($query);
         if ($row = $GLOBALS["ISC_CLASS_DB"]->Fetch($result)) {
             $GLOBALS['SeriesId'] = $row['seriesid'];
             $_SESSION['congoseries'] = '';
             $_SESSION['congobrand'] = '';
             $_SESSION['congoseries'] = $row['brandid'];
             $GLOBALS['BrandName'] = $this->BrandName($row['brandid']);
             $GLOBALS['SeriesName'] = isc_html_escape($row['seriesname']);
             $GLOBALS['Contents'] = isc_html_escape($row['seriescontent']);
             $GLOBALS['FeaturePoints1'] = isc_html_escape($row['feature_points1']);
             $GLOBALS['FeaturePoints2'] = isc_html_escape($row['feature_points2']);
             $GLOBALS['FeaturePoints3'] = isc_html_escape($row['feature_points3']);
             $GLOBALS['FeaturePoints4'] = isc_html_escape($row['feature_points4']);
             $GLOBALS['Seriesaltkeyword'] = isc_html_escape($row['seriesaltkeyword']);
             $GLOBALS['SeriesTitle'] = GetLang('EditSeries');
             $GLOBALS['SeriesIntro'] = GetLang('EditSeriesIntro');
             $GLOBALS['CancelMessage'] = GetLang('CancelEditSeries');
             $GLOBALS['FormAction'] = "SaveEditedBrandSeries";
             $GLOBALS['SeriesImageMessage'] = '';
             if ($row['seriesphoto'] != '') {
                 $image = '../' . 'series_images' . '/' . $row['seriesphoto'];
                 $GLOBALS['SeriesImageMessage'] = sprintf(GetLang('SeriesImageDesc'), $image, $row['seriesphoto']);
             }
             $GLOBALS['SeriesLargeImageMessage'] = '';
             if ($row['serieshoverimagefile'] != '') {
                 $limage = '../' . 'series_images' . '/' . $row['serieshoverimagefile'];
                 $GLOBALS['SeriesLargeImageMessage'] = sprintf(GetLang('SeriesLargeImageDesc'), $limage, $row['serieshoverimagefile']);
             }
             $wysiwygOptions = array('id' => 'wysiwyg', 'width' => '60%', 'height' => '350px', 'value' => $row['proddesc']);
             $wysiwygOptions1 = array('id' => 'wysiwyg1', 'width' => '60%', 'height' => '350px', 'value' => $row['seriesdescription']);
             $wysiwygOptions2 = array('id' => 'wysiwyg2', 'width' => '60%', 'height' => '350px', 'value' => $row['seriesfooter']);
             $wysiwygOptions3 = array('id' => 'wysiwyg3', 'width' => '60%', 'height' => '350px', 'value' => $row['feature_points']);
             $wysiwygOptions4 = array('id' => 'wysiwyg4', 'width' => '60%', 'height' => '350px', 'value' => $row['divdesc']);
             $GLOBALS['WYSIWYG'] = GetClass('ISC_ADMIN_EDITOR')->GetWysiwygEditor1($wysiwygOptions);
             $GLOBALS['WYSIWYG1'] = GetClass('ISC_ADMIN_EDITOR')->GetWysiwygEditor1($wysiwygOptions1);
             $GLOBALS['WYSIWYG2'] = GetClass('ISC_ADMIN_EDITOR')->GetWysiwygEditor1($wysiwygOptions2);
             $GLOBALS['WYSIWYG3'] = GetClass('ISC_ADMIN_EDITOR')->GetWysiwygEditor($wysiwygOptions3);
             $GLOBALS['WYSIWYG4'] = GetClass('ISC_ADMIN_EDITOR')->GetWysiwygEditor1($wysiwygOptions4);
             $GLOBALS["ISC_CLASS_TEMPLATE"]->SetTemplate("series.edit.form");
             $GLOBALS["ISC_CLASS_TEMPLATE"]->ParseTemplate();
         } else {
             ob_end_clean();
             header("Location: index.php?ToDo=viewBrands");
             die;
         }
     } else {
         ob_end_clean();
         header("Location: index.php?ToDo=viewBrands");
         die;
     }
 }