예제 #1
0
	function addToCart($msc_id, $msc_option) {
		$cart = oseRegistry::Call('payment')->getInstance('Cart');
		$payment_mode = oseMscPublic::getPaymentMode();
		$item = array('entry_id' => $msc_id, 'entry_type' => 'msc', 'msc_option' => $msc_option);
		$cart->addItem($item['entry_id'], $item['entry_type'], $item);
		$cart->updateParams('payment_mode', $payment_mode);
		$cart->update();
	}
예제 #2
0
	function addToCart() {
		$cart = oseRegistry::Call('payment')->getInstance('Cart');
		$msc_id = JRequest::getInt('msc_id', 0);
		$msc_option = JRequest::getCmd('msc_option', null);
		$item = array('entry_id' => $msc_id, 'entry_type' => 'msc', 'msc_option' => $msc_option);
		$cart->addItem($item['entry_id'], $item['entry_type'], $item);
		$items = $cart->get('items');
		$cart->setCartItems($items, 'payment_mode', 'm');
		$cart->update();
		$session = JFactory::getSession();
		$session->set('ose_reg_step', 'cart');
		$result = array();
		$result['success'] = true;
		$result['title'] = 'Done';
		$result['content'] = JText::_('Added to Cart') . '!';
		$result = oseJson::encode($result);
		oseExit($result);
	}
예제 #3
0
	function jomsocialRegRedirect()
	{
		require_once(JPATH_SITE.DS.'components'.DS.'com_osemsc'.DS.'init.php');
		require_once(JPATH_SITE.DS.'components'.DS.'com_osemsc'.DS.'helpers'.DS.'oseMscPublic.php');
		$uri = &JFactory::getURI();
		$vars['task']	= $uri->getVar( 'task' );
		$vars['view']	= $uri->getVar( 'view' );
		if(empty($vars['task']))
		{
			$vars['task'] = JRequest::getCmd('task');
		}
		if(empty($vars['view']))
		{
			$vars['view'] = JRequest::getCmd('view');
		}
		$session =& JFactory::getSession();
		if(isset($_SESSION['__XIPT']['SELECTED_PROFILETYPE_ID']))
		{
			$session->set('pid',$_SESSION['__XIPT']['SELECTED_PROFILETYPE_ID']);
		}
		$vars['joms_regs'] = ($vars['view'] == 'register' && ( $vars['task'] == 'registerSucess' ));

		if($vars['joms_regs'])
		{
			//$pid = $_SESSION['__XIPT']['SELECTED_PROFILETYPE_ID'];
			$pid = $session->get('pid',null);
			$db= oseDB :: instance();
			$query = "SELECT * FROM `#__osemsc_ext` WHERE `type` = 'jspt'";
			$db->setQuery($query);
			$objs = $db->loadObjectList();
			if(!empty($objs))
			{
				foreach($objs as $obj)
				{
					$data = oseJson::decode($obj->params);
					if($data->enable && $pid == $data->jspt_id)
					{
						$msc_id = $obj->id;
						break;
					}
				}

			}
			$redirect = false;
			if(!empty($msc_id))
			{
				JRequest::setVar('msc_id',$msc_id);
				$msc = oseRegistry::call('msc');
				$opts = $msc->runAddonAction('panel.payment.getOptions',array(),true,true);
				$options = $opts['results'];
				if(!empty($options))
				{
					foreach($options as $option)
					{
						if(!$option['isFree'] && $option['a3']>0)
						{
							$msc_option = $option['id'];
							$redirect =true;
							break;
						}
					}
				}
			}
			if($redirect)
			{
				$cart = oseRegistry::Call('payment')->getInstance('Cart');
				$payment_mode = oseMscPublic::getPaymentMode();

				$item = array('entry_id'=>$msc_id,'entry_type'=>'msc','msc_option'=>$msc_option);
				$cart->addItem($item['entry_id'],$item['entry_type'],$item);
				//oseExit($cart);
				$cart->updateParams('payment_mode',$payment_mode);
				$cart->update();

				$session = JFactory::getSession();
				$session->set('ose_reg_step','cart');
				$app = JFactory::getApplication();
				$app->redirect( 'index.php?option=com_osemsc&view=register');
			}
		}

	}
예제 #4
0
	function addToCart($exit = true) {
		$cart = oseRegistry::Call('payment')->getInstance('Cart');
		$msc_id = JRequest::getInt('msc_id', 0);
		$msc_option = JRequest::getCmd('msc_option', null);
		$payment_mode = oseMscPublic::getPaymentMode();
		$item = array('entry_id' => $msc_id, 'entry_type' => 'msc', 'msc_option' => $msc_option);
		$cart->addItem($item['entry_id'], $item['entry_type'], $item);
		$cart->updateParams('payment_mode', $payment_mode);
		$cart->update();
		$session = JFactory::getSession();
		$session->set('ose_reg_step', 'cart');
		$result = array();
		$result['success'] = true;
		$result['title'] = 'Done';
		$result['content'] = JText::_('Added to Cart!');
		$Itemid = JRequest::getInt('Itemid');
		$Itemid = (!empty($Itemid)) ? "&Itemid=" . $Itemid : "";
		$result['link'] = str_replace("&", "&", JRoute::_('index.php?option=com_osemsc&view=register' . $Itemid));
		$result = oseJson::encode($result);
		if ($exit == true) {
			oseExit($result);
		}
	}