Exemple #1
0
 /**
  * @param array $app
  * @param array $config
  */
 public function __construct($app, $config = array())
 {
     parent::__construct($app, $config);
     $this->app->jbdoc->noindex();
     $this->_jbmoney = $this->app->jbmoney;
     $this->_config = JBModelConfig::model()->getGroup('cart.config');
     $this->cart = JBCart::getInstance();
     $this->application = $this->app->zoo->getApplication();
     // load template
     $tmplName = $this->_config->get('tmpl_name', 'uikit');
     $templates = $this->application->getTemplates();
     $this->template = $this->application->getTemplate();
     if (isset($templates[$tmplName])) {
         $this->template = $templates[$tmplName];
     }
     if (!$this->_config->get('enable', 1)) {
         $this->app->jbnotify->error('JBZOO_CART_DISABLED');
     }
     if (!$this->cart->canAccess($this->app->user->get())) {
         $user = JFactory::getUser();
         if (empty($user->id)) {
             $url = 'index.php?option=com_users&view=login&return=' . base64_encode($this->app->jbenv->getCurrentUrl());
             $this->setRedirect($url, JText::_('JBZOO_CART_NEED_LOGIN'));
         } else {
             $this->app->jbnotify->error('JBZOO_CART_UNABLE_ACCESS');
         }
     }
 }