Exemplo n.º 1
0
	/**
	 * Function to get eBay details, the results contain shipping, payment, and others details
	 * @return SimpleXMLElement The eBay Details object
	 */
	public function GeteBayDetailsAction($siteId = 0)
	{
		//@ToDo refactor the cache system to use the operations class directly
		ISC_ADMIN_EBAY_OPERATIONS::setSiteId($siteId);
		return ISC_ADMIN_EBAY_OPERATIONS::geteBayDetails();
	}
Exemplo n.º 2
0
	/**
	* Lists up to 5 items with eBay
	*
	* @param array $products An array of products to list
	* @param ISC_ADMIN_EBAY_TEMPLATE $template The template to list the product with
	* @return array Array of ISC_ADMIN_EBAY_LIST_ITEM_RESULT objects for each item listed
	*/
	public static function listItems($products, $template)
	{
		ISC_ADMIN_EBAY_OPERATIONS::setSiteId($template->getSiteId());

		$results = array();
		$regularProducts = array();

		// any products with a variation should be listed separately with a FixedPriceItem request
		foreach ($products as $productId => $product) {
			if ($product['prodvariationid']) {
				try {
					$xml = ISC_ADMIN_EBAY_OPERATIONS::addFixedPriceItem($product, $template);
				}
				catch (ISC_EBAY_API_REQUEST_EXCEPTION $ex) {
					$xml = $ex->getResponseXML();
				}

				$results[] = new ISC_ADMIN_EBAY_LIST_ITEM_RESULT($product, $xml);
			}
			else {
				$regularProducts[$productId] = $product;
			}
		}

		// process the remainder of the items
		if (!empty($regularProducts)) {
			try {
				$xml = ISC_ADMIN_EBAY_OPERATIONS::addItems($regularProducts, $template);
			}
			catch (ISC_EBAY_API_REQUEST_EXCEPTION $ex) {
				$xml = $ex->getResponseXML();

				// if we have item level data then we want to process the results to get any errors for each item
				// otherwise, throw the exception and it will get caught in the job as a per-request level error
				if (!isset($xml->AddItemResponseContainer)) {
					throw $ex;
				}
			}

			// process each add item response
			foreach ($xml->AddItemResponseContainer as $item) {
				$productId = (int)$item->CorrelationID;
				$results[] = new ISC_ADMIN_EBAY_LIST_ITEM_RESULT($regularProducts[$productId], $item);
			}
		}

		return $results;
	}
Exemplo n.º 3
0
	/**
	* Checks if a category is catalog-enabled (ie. can prefill an item's information/specifics based off UPC etc)
	*
	* @param int $categoryId The ID of the category
	* @param int $siteId The eBay site to for the specified category
	* @return bool True if the category is catalog-enabled, false otherwise
	*/
	public static function getCategoryIsCatalogEnabled($categoryId, $siteId)
	{
		ISC_ADMIN_EBAY_OPERATIONS::setSiteId($siteId);

		$categoryXML = ISC_ADMIN_EBAY_OPERATIONS::getCategory2CS($categoryId);

		if (isset($categoryXML->MappedCategoryArray->Category->CatalogEnabled)) {
			return true;
		}

		return false;
	}