コード例 #1
0
		private function editOrderLoadCustomerAction()
		{
			if(empty($_POST['customerId'])) {
				exit;
			}

			$customer = getClass('ISC_CUSTOMER')->getCustomerInfo($_POST['customerId']);
			if(!$customer) {
				exit;
			}

			$response = array(
				'email' => $customer['custconemail'],
				'firstName' => $customer['custconfirstname'],
				'lastName' => $customer['custconlastname'],
				'addresses' => array()
			);

			$addresses = getClass('ISC_CUSTOMER')->getCustomerShippingAddresses($customer['customerid']);
			require_once ISC_BASE_PATH . '/lib/addressvalidation.php';
			foreach($addresses as $address) {
				$address = convertAddressArrayToFieldArray($address);
				$countryIso = getCountryISO2ByName($address['Country']);
				if(file_exists(ISC_BASE_PATH.'/lib/flags/'.strtolower($countryIso.'.gif'))) {
					$address['countryFlag'] = strtolower($countryIso);
				}
				$response['addresses'][] = $address;
			}

			$this->sendEditOrderResponse($response);
		}
コード例 #2
0
ファイル: class.orders.php プロジェクト: hungnv0789/vhtm
		/**
		* 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');
		}