Example #1
0
	/**
	* Gets specific details and available item conditions for a specific category
	*
	*/
	private function getCategoryFeaturesAction()
	{
		$categoryId = (int)$_POST['categoryId'];
		$siteId = (int)$_POST['siteId'];

		try {
			$categoryFeatures = ISC_ADMIN_EBAY_CATEGORIES::getCategoryFeatures($categoryId, $siteId);

			$categoryPath = ISC_ADMIN_EBAY_CATEGORIES::getFormattedCategoryPath($categoryId, $siteId);
			$categoryFeatures['path'] = $categoryPath;
		}
		catch (Exception $ex) {
			ISC_JSON::output('The category information could not be retrieved.', false);
		}

		$output = array(
			'categoryFeatures' => $categoryFeatures
		);

		// are we requesting features for the primary category?
		if (!empty($_POST['primaryCategory'])) {
			// include conditions
			if ($categoryFeatures['has_conditions']) {
				$conditions = array('-- Do Not Map --');
				$conditions += $categoryFeatures['conditions'];

				$this->template->assign('conditions', $conditions);
				$this->template->assign('conditionRequired', $categoryFeatures['conditions_required']);
				$output['conditionsHTML'] = $this->template->render('ebay.mapconditions.tpl');
			}

			// generate a list of features
			$this->template->assign('categoryOptions', $categoryFeatures);
			$currencyId = GetClass('ISC_ADMIN_EBAY')->getCurrencyFromSiteId($siteId);
			$currency = GetCurrencyById($currencyId);
			$this->template->assign('currency', $currency);
			$output['categoryFeaturesList'] = $this->template->render('ebay.template.featureslist.tpl');
		}

		ISC_JSON::output('', true, $output);
	}
Example #2
0
	/**
	* Displays the edit template form
	*
	*/
	public function editEbayTemplate()
	{
		GetLib('class.json');

		$templateId = (int)$_GET['templateId'];

		try {
			$template = new ISC_ADMIN_EBAY_TEMPLATE($templateId);

			$this->template->assign('templateId', $templateId);

			$this->template->assign('formTitle', GetLang('EditEbayTemplate'));
			$this->template->assign('hasStore', (bool)GetConfig('EbayStore'));

			$this->template->assign('ebaySites', $this->getSupportedSites());
			$this->template->assign('siteId', $template->getSiteId());
			$this->template->assign('templateName', $template->getTemplateName());
			$this->template->assign('templateIsDefault', $template->isDefaultTemplate());
			$this->template->assign('isPrivateListing', $template->isPrivateListing());

			// setup category details
			$primaryCategoryOptions = $template->getPrimaryCategoryOptions();
			$secondaryCategoryOptions = $template->getSecondaryCategoryOptions();
			$this->template->assign('primaryCategory', $primaryCategoryOptions['path']);
			$this->template->assign('primaryCategoryOptions', ISC_JSON::encode($primaryCategoryOptions));
			$this->template->assign('categoryOptions', $primaryCategoryOptions);
			$this->template->assign('sellingMethod', $template->getSellingMethod());

			try {
				if (empty ($secondaryCategoryOptions)) {
					$secondaryCategoryId = $template->getSecondaryCategoryId();
					if (!empty ($secondaryCategoryId)) {
						$secondaryCategoryOptions = '';
						$secondaryCategoryOptions = ISC_ADMIN_EBAY_CATEGORIES::getCategoryFeatures($secondaryCategoryId, $template->getSiteId());
						$categoryPath = ISC_ADMIN_EBAY_CATEGORIES::getFormattedCategoryPath($secondaryCategoryId, $template->getSiteId());
						$secondaryCategoryOptions['path'] = $categoryPath;
					} else {
						$secondaryCategoryOptions = ISC_ADMIN_EBAY_CATEGORIES::getCategoryOptionsFromId($template->getSecondaryCategoryId(), $template->getSiteId());
					}
				}
			}
			catch (Exception $ex) {
				$secondaryCategoryOptions = array(
					'category_id'	=> $template->getSecondaryCategoryId(),
					'name'			=> $template->getSecondaryCategoryName(),
					'path'			=> $template->getSecondaryCategoryName(),
				);
			}


			if ($secondaryCategoryOptions) {
				$this->template->assign('secondaryCategoryOptionsData', $secondaryCategoryOptions);
				$this->template->assign('secondaryCategory', $secondaryCategoryOptions['path']);
			}
			$secCatNotSupportVariations = (isset ($secondaryCategoryOptions['variations_supported']) && $secondaryCategoryOptions['variations_supported'] == 0);
			$this->template->assign('secCatSelectedNotSupportVariations', ($secCatNotSupportVariations));
			$this->template->assign('secondaryCategoryOptions', ISC_JSON::encode($secondaryCategoryOptions));
			$this->template->assign('categoryFeaturesList', $this->template->render('ebay.template.featureslist.tpl'));

			$primaryStoreCategoryOptions = array();
			if ($template->getPrimaryStoreCategoryId()) {
				$primaryStoreCategoryOptions = array(
					'category_id'	=> $template->getPrimaryStoreCategoryId(),
					'name'			=> $template->getPrimaryStoreCategoryName(),
					'path'			=> $template->getPrimaryStoreCategoryName(),
				);

				$this->template->assign('primaryStoreCategory', $primaryStoreCategoryOptions['path']);
			}
			$this->template->assign('primaryStoreCategoryOptions', ISC_JSON::encode($primaryStoreCategoryOptions));

			$secondaryStoreCategoryOptions = array();
			if ($template->getSecondaryStoreCategoryId()) {
				$secondaryStoreCategoryOptions = array(
					'category_id'	=> $template->getSecondaryStoreCategoryId(),
					'name'			=> $template->getSecondaryStoreCategoryName(),
					'path'			=> $template->getSecondaryStoreCategoryName(),
				);

				$this->template->assign('secondaryStoreCategory', $secondaryStoreCategoryOptions['path']);
			}
			$this->template->assign('secondaryStoreCategoryOptions', ISC_JSON::encode($secondaryStoreCategoryOptions));

			$this->template->assign('sellingMethod', $template->getSellingMethod());
		}
		catch (Exception $ex) {
			FlashMessage($ex->getMessage(), MSG_ERROR, 'index.php?ToDo=viewEbay');
		}

		$GLOBALS['BreadcrumEntries'][GetLang('EditEbayTemplate')] = 'index.php?ToDo=editEbayTemplate';
		$this->engine->PrintHeader();
		$this->template->display('ebay.template.form.tpl');
		$this->engine->PrintFooter();
	}