예제 #1
0
		/**
		* Displays the contents of the iframe for allocating items to an address in a split-shipping order
		*
		*/
		protected function editOrderMultiAddressFrame()
		{
			if (empty($_GET['quoteSession']) || (empty($_GET['item']) && empty($_GET['address']))) {
				exit;
			}

			/** @var ISC_QUOTE */
			$quote = getClass('ISC_ADMIN_ORDERS')->getQuoteSession($_GET['quoteSession']);
			if(!$quote) {
				exit;
			}

			$quote->setIsSplitShipping(true);

			$customer = $quote->getCustomerId();
			if ($customer) {
				$customer = getClass('ISC_CUSTOMER')->getCustomerInfo($customer);
			}

			require_once ISC_BASE_PATH . '/lib/addressvalidation.php';

			// @todo @hack placing billing address into 'existing' address list as the address frame doesn't currently have a radio to select between billing/different address
			$addresses = array(
				convertAddressArrayToFieldArray($quote->getBillingAddress()->getAsArray()),
			);

			if ($customer && $customer['customerid']) {
				$addresses = getClass('ISC_CUSTOMER')->getCustomerShippingAddresses($customer['customerid']);
				foreach($addresses as $index => $address) {
					$address = convertAddressArrayToFieldArray($address);
					$countryIso = getCountryISO2ByName($address['Country']);
					if(file_exists(ISC_BASE_PATH.'/lib/flags/'.strtolower($countryIso.'.gif'))) {
						$address['countryFlag'] = strtolower($countryIso);
					}
					$addresses[$index] = $address;
				}
			}
			$this->template->assign('addresses', $addresses);

			$this->populateQuoteFormFields($quote);

			if (Interspire_Request::get('address', false)) {
				// take items from address being edited
				$address = Interspire_Request::get('address');
				/** @var ISC_QUOTE_ADDRESS */
				$address = $quote->getAddressById($address);
				if (!$address) {
					exit;
				}
				$items = $address->getItems();
				$this->template->assign('address', $address);

				$this->template->assign('shippingFormFields', $this->populateQuoteAddressFormFields(FORMFIELDS_FORM_SHIPPING, $address));
			} else {
				// take items from posted list to be added to new address
				$items = array();
				foreach ($_GET['item'] as $itemId) {
					$items[] = $quote->getItemById($itemId);
				}
			}

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

			$this->template->assign('quoteSession', $_GET['quoteSession']);

			$this->engine->stylesheets[] = 'Styles/order.form.css';
			$this->engine->bodyScripts[] = 'script/order.form.js';
			$this->engine->setupHeaderFooter();
			$this->template->display('order.form.allocate.frame.tpl');
		}
예제 #2
0
	/**
	* Handle a browser request to finish a picnik edit, typically triggered by clicking the 'save and close' button in picnik -- will download the new image and store it locally
	*
	* @return void
	*/
	public function handleReceivePicnik()
	{
		$token = $this->loadToken(Interspire_Request::get('token'));

		$remoteFile = $_GET['file'];
		$this->template->assign('PicnikRemoteFile', $remoteFile);

		if (!$token) {
			$this->template->assign('PicnikError', GetLang('PicnikError_InvalidToken'));
		} else {
			$token['imagetype'] = (int)$token['imagetype'];
			$this->receivePicnik($token, $remoteFile);
		}

		// all done, redirect to where the user was when starting the edit session
		$this->template->display('pageheader.popup.tpl');
		$this->template->display('picnik.received.tpl');
		$this->template->display('pagefooter.popup.tpl');
	}