/** * (non-PHPdoc) * @see Citruscart/admin/CitruscartController#display($cachable) */ function display($cachable = false, $urlparams = '') { $app = JFactory::getApplication(); if (empty(JFactory::getUser()->id)) { $url = JRoute::_("index.php?option=com_citruscart&view=orders"); Citruscart::load("CitruscartHelperUser", 'helpers.user'); $redirect = JRoute::_(CitruscartHelperUser::getUserLoginUrl($url), false); $app->redirect($redirect); return; } $model = $this->getModel($this->get('suffix')); $this->_setModelState(); $config = Citruscart::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'); $app->input->set('view', $this->get('suffix')); $app->input->set('layout', 'default'); parent::display($cachable, $urlparams); }
/** * constructor */ function __construct() { if (empty(JFactory::getUser()->id)) { $url = JRoute::_("index.php?option=com_citruscart&view=dashboard"); Citruscart::load("CitruscartHelperUser", 'helpers.user'); $redirect = JRoute::_(CitruscartHelperUser::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_citruscart&view=addresses"); Citruscart::load("CitruscartHelperUser", 'helpers.user'); $redirect = JRoute::_(CitruscartHelperUser::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 Citruscart::load("CitruscartHelperRoute", 'helpers.route'); $router = new CitruscartHelperRoute(); $url = JRoute::_("index.php?option=com_citruscart&view=wishlists&Itemid=" . $router->findItemid(array('view' => 'wishlists')), false); Citruscart::load("CitruscartHelperUser", 'helpers.user'); $redirect = JRoute::_(CitruscartHelperUser::getUserLoginUrl($url), false); JFactory::getApplication()->redirect($redirect); return; } }
/** * constructor */ function __construct() { if (empty(JFactory::getUser()->id)) { $url = JRoute::_("index.php?option=com_citruscart&view=orders"); Citruscart::load("CitruscartHelperUser", 'helpers.user'); $redirect = JRoute::_(CitruscartHelperUser::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() { $app = JFactory::getApplication(); $user_id = JFactory::getUser()->id; $Itemid = $app->input->getInt('Itemid', 0); $id = $app->input->getInt('product_id', 0); $url = "index.php?option=com_citruscart&view=products&task=view&Itemid=" . $Itemid . "&id=" . $id; if ($user_id) { $productcomment_id = $app->input->getInt('productcomment_id', ''); Citruscart::load('CitruscartHelperProduct', 'helpers.product'); $producthelper = new CitruscartHelperProduct(); JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_citruscart/tables'); $productcomment = JTable::getInstance('productcomments', 'CitruscartTable'); $productcomment->load($productcomment_id); $helpful_votes_total = $productcomment->helpful_votes_total; $helpful_votes_total = $helpful_votes_total + 1; $helpfulness = $app->input->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 = $app->input->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_citruscart/tables'); $reviewhelpfulness = JTable::getInstance('ProductCommentsHelpfulness', 'CitruscartTable'); $reviewhelpfulness->load(array('user_id' => $user_id)); if ($report == 1 && !empty($reviewhelpfulness->productcommentshelpfulness_id) && empty($reviewhelpfulness->reported)) { $reviewhelpfulness->reported = 1; $reviewhelpfulness->save(); $productcomment->save(); $app->enqueueMessage(JText::sprintf("COM_CITRUSCART_THANKS_FOR_REPORTING_THIS_COMMENT")); $app->redirect($url); return; } $reviewhelpfulness->bind($help); if (!empty($reviewhelpfulness->productcommentshelpfulness_id)) { $app->enqueueMessage(JText::sprintf("COM_CITRUSCART_YOU_HAVE_ALREADY_COMMENTED_ON_THIS_REVIEW")); $app->redirect($url); return; } else { $reviewhelpfulness->save(); $productcomment->save(); $app->enqueueMessage(JText::sprintf("COM_CITRUSCART_THANKS_FOR_YOUR_FEEDBACK_ON_THIS_COMMENT")); $app->redirect($url); return; } } else { Citruscart::load("CitruscartHelperUser", 'helpers.user'); $redirect = JRoute::_(CitruscartHelperUser::getUserLoginUrl($url), false); $app->redirect($redirect); return; } }