Skip to main content
format the code
Source Link
Manashvi Birla
  • 8.9k
  • 9
  • 28
  • 53

I have a store using Magento 1.7 and I need to set a login/registration page as the first page that is shown before buying anything, so that it is mandatory to log in.

I edited cms.xmlcms.xml, under app/design/frontend/base/default/layout/cms.xmlapp/design/frontend/base/default/layout/cms.xml, and managed to show login/registration in the homepage:

<cms_page translate="label">
    <label>CMS Pages (All)</label>
    <reference name="content">
        <block type="core/template" name="page_content_heading" template="cms/content_heading.phtml"/>
        <block type="page/html_wrapper" name="cms.wrapper" translate="label">
            <label>CMS Content Wrapper</label>
            <action method="setElementClass"><value>std</value></action>
            <block type="customer/form_login" name="customer_form_login" template="customer/form/login.phtml"/>
            <block type="cms/page" name="cms_page"/>
        </block>
    </reference>
</cms_page>

I also added a line in customer.xmlcustomer.xml under design/frontend/default/custom_theme/layout/customer.xmldesign/frontend/default/custom_theme/layout/customer.xml for removing the login/registration boxes after customer login, so that it looks like:

<customer_logged_in>
    <reference name="top.links">
        <remove name="customer_form_login"></remove>
(...)

But I still can navigate through all the contents of my store without loging in; how should I do in order that the first page only contains login/registration? I think that is something related to layouts and phtml, but I am a bit confused and don't know which file I should edit or if I should include some other files.

Any help is much appreciated :-)

I have a store using Magento 1.7 and I need to set a login/registration page as the first page that is shown before buying anything, so that it is mandatory to log in.

I edited cms.xml, under app/design/frontend/base/default/layout/cms.xml, and managed to show login/registration in the homepage:

<cms_page translate="label">
    <label>CMS Pages (All)</label>
    <reference name="content">
        <block type="core/template" name="page_content_heading" template="cms/content_heading.phtml"/>
        <block type="page/html_wrapper" name="cms.wrapper" translate="label">
            <label>CMS Content Wrapper</label>
            <action method="setElementClass"><value>std</value></action>
            <block type="customer/form_login" name="customer_form_login" template="customer/form/login.phtml"/>
            <block type="cms/page" name="cms_page"/>
        </block>
    </reference>
</cms_page>

I also added a line in customer.xml under design/frontend/default/custom_theme/layout/customer.xml for removing the login/registration boxes after customer login, so that it looks like:

<customer_logged_in>
    <reference name="top.links">
        <remove name="customer_form_login"></remove>
(...)

But I still can navigate through all the contents of my store without loging in; how should I do in order that the first page only contains login/registration? I think that is something related to layouts and phtml, but I am a bit confused and don't know which file I should edit or if I should include some other files.

Any help is much appreciated :-)

I have a store using Magento 1.7 and I need to set a login/registration page as the first page that is shown before buying anything, so that it is mandatory to log in.

I edited cms.xml, under app/design/frontend/base/default/layout/cms.xml, and managed to show login/registration in the homepage:

<cms_page translate="label">
    <label>CMS Pages (All)</label>
    <reference name="content">
        <block type="core/template" name="page_content_heading" template="cms/content_heading.phtml"/>
        <block type="page/html_wrapper" name="cms.wrapper" translate="label">
            <label>CMS Content Wrapper</label>
            <action method="setElementClass"><value>std</value></action>
            <block type="customer/form_login" name="customer_form_login" template="customer/form/login.phtml"/>
            <block type="cms/page" name="cms_page"/>
        </block>
    </reference>
</cms_page>

I also added a line in customer.xml under design/frontend/default/custom_theme/layout/customer.xml for removing the login/registration boxes after customer login, so that it looks like:

<customer_logged_in>
    <reference name="top.links">
        <remove name="customer_form_login"></remove>
(...)

But I still can navigate through all the contents of my store without loging in; how should I do in order that the first page only contains login/registration? I think that is something related to layouts and phtml, but I am a bit confused and don't know which file I should edit or if I should include some other files.

Any help is much appreciated :-)

Source Link
LeCodeur
  • 366
  • 2
  • 17

Login mandatory for using my store

I have a store using Magento 1.7 and I need to set a login/registration page as the first page that is shown before buying anything, so that it is mandatory to log in.

I edited cms.xml, under app/design/frontend/base/default/layout/cms.xml, and managed to show login/registration in the homepage:

<cms_page translate="label">
    <label>CMS Pages (All)</label>
    <reference name="content">
        <block type="core/template" name="page_content_heading" template="cms/content_heading.phtml"/>
        <block type="page/html_wrapper" name="cms.wrapper" translate="label">
            <label>CMS Content Wrapper</label>
            <action method="setElementClass"><value>std</value></action>
            <block type="customer/form_login" name="customer_form_login" template="customer/form/login.phtml"/>
            <block type="cms/page" name="cms_page"/>
        </block>
    </reference>
</cms_page>

I also added a line in customer.xml under design/frontend/default/custom_theme/layout/customer.xml for removing the login/registration boxes after customer login, so that it looks like:

<customer_logged_in>
    <reference name="top.links">
        <remove name="customer_form_login"></remove>
(...)

But I still can navigate through all the contents of my store without loging in; how should I do in order that the first page only contains login/registration? I think that is something related to layouts and phtml, but I am a bit confused and don't know which file I should edit or if I should include some other files.

Any help is much appreciated :-)