function saveOption()
	{
		$config = osemscPublic::getConfig('register','obj');
		$msc_id = JRequest::getInt('msc_id',0);
		$msc_option = JRequest::getCmd('msc_option',null);

		if($config->register_form == 'onestep')
		{
			$cart = oseMscPublic::getCart();

			//$cart = oseMscPublic::getCart();
			$item = array('entry_id'=>$msc_id,'entry_type'=>'msc','msc_option'=>$msc_option);
			$cart->addItem($item['entry_id'],$item['entry_type'],$item);
			$cart->update();
		}

		oseExit(true);
	}
Exemple #2
0
	function saveMobile() {
		ini_set('max_execution_time', '180');
		$config = osemscPublic::getConfig('register', 'obj');
		$msc_id = JRequest::getInt('msc_id', 0);
		$msc_option = JRequest::getCmd('msc_option', null);
		$creditcard_expirationdate = JRequest::getVar('creditcard_expirationdate', 0);
		if (!empty($creditcard_expirationdate)) {
			$array = explode('-', $creditcard_expirationdate);
			JRequest::setVar('creditcard_year', $array[0]);
			JRequest::setVar('creditcard_month', $array[1]);
		}
		$cart = oseMscPublic::getCart();
		$item = array('entry_id' => $msc_id, 'entry_type' => 'msc', 'msc_option' => $msc_option);
		$cart->addItem($item['entry_id'], $item['entry_type'], $item);
		$cart->update();
		$items = $cart->get('items');
		if (count($items) < 1) {
			$result['success'] = false;
			$result['title'] = JText::_('Error!');
			$result['content'] = JText::_('No Item! Please go to membership list and select one.');
			$result = oseJson::encode($result);
			oseExit($result);
		}
		// count the tax params;
		$country = JRequest::getCmd('bill_country', null);
		$state = JRequest::getCmd('bill_state', 'all');
		$taxParams = oseMscPublic::getTax($country, $state);
		oseMscPublic::savePaymentMode();
		$cart = oseMscPublic::getCart();
		$cart->updateTaxParams('country', $country);
		$cart->updateTaxParams('state', $state);
		$cart->updateTaxParams('rate', $taxParams['rate']);
		$cart->updateTaxParams('file_control', $taxParams['file_control']);
		$cart->updateTaxParams('has_file_control', $taxParams['has_file_control']);
		$cart->updateTaxParams('vat_number', $taxParams['vat_number']);
		$register_form = oseRegistry::call('msc')->getConfig('register', 'obj')->register_form;
		$user = oseMscPublic::getUser();
		if ($user->guest) {
			if (empty($register_form) || $register_form == 'default') {
				$this->saveSC();
			} else {
				switch ($register_form) {
				case ('onestep'):
					$this->saveOS();
					break;
				}
			}
		} else {
			if (empty($register_form) || $register_form == 'default') {
				$result = $this->toPaymentCart();
			} else {
				switch ($register_form) {
				case ('onestep'):
					$result = $this->toPaymentOS();
					break;
				}
			}
			$result['activation'] = false;
			$result = oseJson::encode($result);
			oseExit($result);
		}
	}