I am trying to show catalog prices only to logged in users. Following snippet works however it has two issues:
if(!Mage::helper('customer')->isLoggedIn()) {
Mage::getSingleton('customer/session')->setBeforeAuthUrl(Mage::helper('core/url')->getCurrentUrl());
echo '<a href="'.Mage::getUrl('customer/account/login').'">Please Login to view prices</a>';
}
Issues:
1) If login credentials are incorrect, page redirects to previous page (on catalog page) and shows 'invalid login error'. Ideally, it should stay on the login page and should not redirect unless login is successful.
2) If user login is successful in first attempt, page redirects to catalog page. however, url contains port 8080. domain.com:8080/catalog/
Any fix for above issues?
or
Is it possible to have login on a popup on the catalog page?