function checkout() { JRequest::setVar('view', 'shopcheckout'); $activeGuestBuying = EnmasseHelper::isGuestBuyingEnable(); if (JFactory::getUser()->get('guest') && $activeGuestBuying == false) { $msg = JText::_('ORDER_PLEASE_LOGIN_BEFORE'); $redirectUrl = base64_encode(JRoute::_("index.php?option=com_enmasse&controller=shopping&task=checkout")); $link = JRoute::_("index.php?option=com_users&view=login&return=" . $redirectUrl, false); JFactory::getApplication()->redirect($link, $msg); } else { $cart = unserialize(JFactory::getSession()->get('cart')); if (empty($cart) || $cart->getTotalItem() == 0) { $msg = JText::_("CART_IS_EMPTY"); $link = JRoute::_("index.php?option=com_enmasse&controller=deal&task=listing", false); JFactory::getApplication()->redirect($link, $msg); } $arTotal = array(); if (JFactory::getUser()->get('id')) { $arDealId = array(); foreach ($cart->getAll() as $cartItem) { $arDealId[] = $cartItem->getItem()->id; } //get array total quantity of deals $arTotal = EnmasseHelper::getTotalBoughtQtyOfUser(JFactory::getUser()->get('id'), $arDealId); } // check cart item $this->checkMaxCartItem($cart); parent::display(); } }