/**
  * Test the shipping method by displaying a simple HTML form
  */
 public function TestQuoteForm()
 {
     // Load up the module variables
     $this->SetCustomVars();
     // Which countries has the user chosen to ship orders to?
     $GLOBALS['Countries'] = GetCountryList(GetConfig('CompanyCountry'));
     $GLOBALS['StateList'] = GetStatesByCountryNameAsOptions(GetConfig('CompanyCountry'), $numStates);
     $GLOBALS['WeightMeasurement'] = GetConfig('WeightMeasurement');
     if (!$GLOBALS['StateList']) {
         $GLOBALS['StateNameAppend'] = '2';
         $GLOBALS['HideStatesList'] = 'display: none';
     }
     $GLOBALS['Image'] = $this->GetImage();
     $this->ParseTemplate("module.upsonline.test");
 }
Example #2
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');
	}
Example #3
0
 /**
  * Test the shipping method by displaying a simple HTML form
  */
 public function TestQuoteForm()
 {
     $GLOBALS['ServiceTypes'] = "";
     $service_types = $this->GetValue("service");
     if (!is_array($service_types)) {
         $service_types = array($service_types);
     }
     // Load up the module variables
     $this->SetCustomVars();
     foreach ($this->_variables['service']['options'] as $k => $v) {
         if (in_array($v, $service_types)) {
             $sel = 'selected="selected"';
         } else {
             $sel = "";
         }
         $GLOBALS['ServiceTypes'] .= sprintf("<option %s value='%s'>%s</option>", $sel, $v, $k);
     }
     $GLOBALS['DeliveryTypes'] = "";
     $del_types = $this->GetValue("carriercode");
     if (!is_array($del_types)) {
         $del_types = array($del_types);
     }
     foreach ($this->_variables['carriercode']['options'] as $k => $v) {
         if (in_array($v, $del_types)) {
             $sel = 'selected="selected"';
         } else {
             $sel = "";
         }
         $GLOBALS['DeliveryTypes'] .= sprintf("<option %s value='%s'>%s</option>", $sel, $v, $k);
     }
     // Which countries has the user chosen to ship orders to?
     $first_country = "United States";
     $GLOBALS['Countries'] = GetCountryList("United States");
     $GLOBALS['WeightUnit'] = GetConfig('WeightMeasurement');
     $num_states = 0;
     $GLOBALS['StateList'] = $state_options = GetStatesByCountryNameAsOptions($first_country, $num_states);
     $GLOBALS['Image'] = $this->_image;
     $this->ParseTemplate("module.fedex.test");
 }
	/**
	 * Manage the store location settings and show a list of shipping zones for management.
	 */
	private function ManageShippingSettings()
	{
		if (!$GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Manage_Settings)) {
			$GLOBALS['ISC_CLASS_ADMIN_ENGINE']->DoHomePage(GetLang('Unauthorized'), MSG_ERROR);
			return;
		}

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

		// Get the getting started box if we need to
		$GLOBALS['GettingStartedStep'] = '';
		if(empty($GLOBALS['Message']) && (isset($_GET['wizard']) && $_GET['wizard']==1) && !in_array('shippingOptions', GetConfig('GettingStartedCompleted')) && !GetConfig('DisableGettingStarted')) {
			$GLOBALS['GettingStartedTitle'] = GetLang('WizardShippingOptions');
			$GLOBALS['GettingStartedContent'] = GetLang('WizardShippingOptionsDesc');
			$GLOBALS['GettingStartedStep'] = $this->template->render('Snippets/GettingStartedModal.html');
		}

		// Generate the breadcrumb
		$GLOBALS['BreadcrumEntries'][GetLang('Settings')] = "index.php?ToDo=viewSettings";
		$GLOBALS['BreadcrumEntries'][GetLang('ShippingSettings')] = "index.php?ToDo=viewShippingSettings";

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

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

		// Was this an ajax based sort? Return the table now
		if(isset($_REQUEST['ajax']) && $_REQUEST['ajax'] == 1) {
			echo $GLOBALS['ZoneDataGrid'];
			return;
		}

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

		$GLOBALS['CompanyName'] = GetConfig('CompanyName');
		$GLOBALS['CompanyAddress'] = GetConfig('CompanyAddress');
		$GLOBALS['CompanyCity'] = GetConfig('CompanyCity');
		$GLOBALS['CompanyZip'] = GetConfig('CompanyZip');

		$stateOptions = sprintf("<option value=''>%s</option>", GetLang('ChooseState'));
		$stateOptions .= GetStatesByCountryNameAsOptions(GetConfig('CompanyCountry'), $numStates, GetConfig('CompanyState'));

		if (GetConfig('CompanyState') != "") {
			$GLOBALS['HideStateNote'] = "none";
		} else {
			$GLOBALS['HideStateBox'] = "none";
		}

		if ($numStates > 0) {
			// Show the states dropdown list
			$GLOBALS['StateList'] = $stateOptions;
			$GLOBALS['HideStateBox'] = "none";
		}
		else {
			// Show the states text box
			$GLOBALS['CompanyState'] = GetConfig('CompanyState');
			$GLOBALS['HideStateList'] = "none";
		}

		$GLOBALS['CountryList'] = GetCountryList(GetConfig('CompanyCountry'));
		$GLOBALS['ShippingProviders'] = $this->GetShippingCompaniesAsOptions();

		$GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintHeader();
		$this->template->display('settings.shipping.manage.tpl');
		$GLOBALS['ISC_CLASS_ADMIN_ENGINE']->PrintFooter();
	}