Magento – Forward Undeclared customers directly to the login page

If you want to e.g.. a B2B shop up at the log, the user only once / or. must register, to products and / To view or Categories, you can rely on different Extensions. A very common extension is Groups Catalog 2 of power workers.

With this extension, it is possible only to logged in or even just specific customer groups display products and categories and hide individual products for specific groups. So a great extension.

Only at the beginning we had a little action: If the customer comes to the store page / Landing Page he will not be forwarded directly to the login page, under but on the backend “Web” defined page. Here you can indeed login page deposit but this would mean, that the customer now every time, when to “Home” wants -so clicking on the logo- would land on the login page.

As we do this but do not want, we resort to a little trick. To this end, we have created a new file. this is “forced-login.phtml” and is located in the folder app / design / frontend /[Ihr Template]/[Ihr Template]n/template/customer.

This file is the following code:

<?php
if(!$this->helper('customer')->isLoggedIn()){
Magus::app()->getFrontController()->getResponse()->setRedirect(Magus::getUrl('customer/account'));
}

Now this file is or. incorporated into the home page CMS by simply opens the home in the back and there the following line in the default text-area inserts function:

{{block type="core/template" name ="forced_login_block" template ="/customer/forced-login.phtml"}}

Now the system checks, whether the user is logged in. Is it not this, it is passed directly to the login page or he can look at the home page as normal.

be clear Google & Co. Now get problems, but since you -As in o.g. Solution- the products and categories eh hidden, should the search engines can not find anything on the page. This could also be an appropriate robots.txt entry make clear.

Used in Magento Version 1.9 Comments? Additions? Notes? Gladly!

Published by Covos

Since 2009 I have been working intensively with Magento. I started with the creation and operation of B2C stores. This was extended through my work in the logistics sector. This resulted first specialized B2E systems. Today I work day-a day with exciting B2C, B2B- and B2E projects and reports in this blog about challenges and give insider tips.

Leave a Reply

Your email address will not be published. Required fields are marked *