/** * (non-PHPdoc) * @see tienda/admin/TiendaController#display($cachable) */ function display($cachable = false, $urlparams = '') { if (empty(JFactory::getUser()->id)) { $url = JRoute::_("index.php?option=com_tienda&view=orders"); Tienda::load("TiendaHelperUser", 'helpers.user'); $redirect = JRoute::_(TiendaHelperUser::getUserLoginUrl($url), false); JFactory::getApplication()->redirect($redirect); return; } $model = $this->getModel($this->get('suffix')); $this->_setModelState(); $config = Tienda::getInstance(); $model->setState('filter_orderstates', $config->get('orderstates_csv', '2, 3, 5, 17')); $list = $model->getList(); $view = $this->getView('orders', 'html'); $view->set('_controller', 'orders'); $view->set('_view', 'orders'); $view->set('_doTask', true); $view->set('hidemenu', false); $view->setModel($model, true); $view->setLayout('view'); JRequest::setVar('view', $this->get('suffix')); JRequest::setVar('layout', 'default'); parent::display($cachable, $urlparams); }
/** * constructor */ function __construct() { if (empty(JFactory::getUser()->id)) { $url = JRoute::_("index.php?option=com_tienda&view=dashboard"); Tienda::load("TiendaHelperUser", 'helpers.user'); $redirect = JRoute::_(TiendaHelperUser::getUserLoginUrl($url), false); JFactory::getApplication()->redirect($redirect); return; } parent::__construct(); $this->set('suffix', 'dashboard'); }
/** * constructor */ function __construct() { if (empty(JFactory::getUser()->id)) { $url = JRoute::_("index.php?option=com_tienda&view=addresses"); Tienda::load("TiendaHelperUser", 'helpers.user'); $redirect = JRoute::_(TiendaHelperUser::getUserLoginUrl($url), false); JFactory::getApplication()->redirect($redirect); return; } parent::__construct(); $this->set('suffix', 'addresses'); $this->registerTask('flag_billing', 'flag'); $this->registerTask('flag_shipping', 'flag'); $this->registerTask('flag_deleted', 'flag'); }
/** * constructor */ function __construct() { parent::__construct(); $this->set('suffix', 'wishlists'); $user = JFactory::getUser(); if (empty($user->id)) { // redirect to login Tienda::load("TiendaHelperRoute", 'helpers.route'); $router = new TiendaHelperRoute(); $url = JRoute::_("index.php?option=com_tienda&view=wishlists&Itemid=" . $router->findItemid(array('view' => 'wishlists')), false); Tienda::load("TiendaHelperUser", 'helpers.user'); $redirect = JRoute::_(TiendaHelperUser::getUserLoginUrl($url), false); JFactory::getApplication()->redirect($redirect); return; } }
/** * constructor */ function __construct() { if (empty(JFactory::getUser()->id)) { $url = JRoute::_("index.php?option=com_tienda&view=orders"); Tienda::load("TiendaHelperUser", 'helpers.user'); $redirect = JRoute::_(TiendaHelperUser::getUserLoginUrl($url), false); JFactory::getApplication()->redirect($redirect); return; } parent::__construct(); $this->set('suffix', 'subscriptions'); $this->registerTask('subscription_enabled.enable', 'boolean'); $this->registerTask('subscription_enabled.disable', 'boolean'); $this->registerTask('lifetime_enabled.enable', 'boolean'); $this->registerTask('lifetime_enabled.disable', 'boolean'); $this->registerTask('update_subscription', 'update'); }
/** * Adding helpfulness of review * */ function reviewHelpfullness() { $user_id = JFactory::getUser()->id; $Itemid = JRequest::getInt('Itemid', ''); $id = JRequest::getInt('product_id', ''); $url = "index.php?option=com_tienda&view=products&task=view&Itemid=" . $Itemid . "&id=" . $id; if ($user_id) { $productcomment_id = JRequest::getInt('productcomment_id', ''); Tienda::load('TiendaHelperProduct', 'helpers.product'); $producthelper = new TiendaHelperProduct(); JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tienda/tables'); $productcomment = JTable::getInstance('productcomments', 'TiendaTable'); $productcomment->load($productcomment_id); $helpful_votes_total = $productcomment->helpful_votes_total; $helpful_votes_total = $helpful_votes_total + 1; $helpfulness = JRequest::getInt('helpfulness', ''); if ($helpfulness == 1) { $helpful_vote = $productcomment->helpful_votes; $helpful_vote_new = $helpful_vote + 1; $productcomment->helpful_votes = $helpful_vote_new; } $productcomment->helpful_votes_total = $helpful_votes_total; $report = JRequest::getInt('report', ''); if ($report == 1) { $productcomment->reported_count = $productcomment->reported_count + 1; } $help = array(); $help['productcomment_id'] = $productcomment_id; $help['helpful'] = $helpfulness; $help['user_id'] = $user_id; $help['reported'] = $report; JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_tienda/tables'); $reviewhelpfulness = JTable::getInstance('ProductCommentsHelpfulness', 'TiendaTable'); $reviewhelpfulness->load(array('user_id' => $user_id)); if ($report == 1 && !empty($reviewhelpfulness->productcommentshelpfulness_id) && empty($reviewhelpfulness->reported)) { $reviewhelpfulness->reported = 1; $reviewhelpfulness->save(); $productcomment->save(); JFactory::getApplication()->enqueueMessage(JText::sprintf("COM_TIENDA_THANKS_FOR_REPORTING_THIS_COMMENT")); JFactory::getApplication()->redirect($url); return; } $reviewhelpfulness->bind($help); if (!empty($reviewhelpfulness->productcommentshelpfulness_id)) { JFactory::getApplication()->enqueueMessage(JText::sprintf("COM_TIENDA_YOU_HAVE_ALREADY_COMMENTED_ON_THIS_REVIEW")); JFactory::getApplication()->redirect($url); return; } else { $reviewhelpfulness->save(); $productcomment->save(); JFactory::getApplication()->enqueueMessage(JText::sprintf("COM_TIENDA_THANKS_FOR_YOUR_FEEDBACK_ON_THIS_COMMENT")); JFactory::getApplication()->redirect($url); return; } } else { Tienda::load("TiendaHelperUser", 'helpers.user'); $redirect = JRoute::_(TiendaHelperUser::getUserLoginUrl($url), false); JFactory::getApplication()->redirect($redirect); return; } }