Add the code:
$user = JFactory::getUser();
if ($user->guest) {
$app=JFactory::getApplication();
$app->enqueueMessage(JText::_('PLEASE_LOGIN_FIRST'));
global $Itemid;
$url = '';
if(!empty($Itemid)){
$url='&Itemid='.$Itemid;
}
if(!HIKASHOP_J16){
$url = 'index.php?option=com_user&view=login'.$url;
}else{
$url = 'index.php?option=com_users&view=login'.$url;
}
$app->redirect(JRoute::_($url.'&return='.urlencode(base64_encode(hikashop_currentUrl('',false))),false));
return false;
}
before the code:
JRequest::setVar( 'layout', 'downloads' );
return parent::display();
in the file components/com_hikashop/controllers/user.php