Magento在客户登录页面显示侧栏

时间:2013-01-28 13:33:15

标签: magento layout sidebar

我想在客户帐户登录页面的左侧显示侧边栏。通过调用catlog.xml文件中的导航栏,我已成功将侧栏放在产品页面中。

但是使用customer.xml文件执行相同的方法并未显示侧栏。

注意 通过帖子"Magento: Display Categories in Sidebar",我在产品页中更改了我的侧边栏。但它不适用于客户登录页面

1 个答案:

答案 0 :(得分:0)

您需要首先告诉Magento将2列模板用于“客户帐户登录”页面 - 作为标准,它使用1列模板文件,因此不会有侧栏的左侧或右侧结构块。

操作简单 - 最佳做法是将布局指令添加到 app / design / frontend中的现有创建 local.xml 文件/ YOURPACKAGE / YOUR_THEME / layout / 文件夹。

使用句柄<customer_account_login>以引用登录页面,将以下内容添加到local.xml

<customer_account_login>
    <reference name="root">
        <action method="setTemplate"><template>page/2column-left.phtml</template></action><!-- Tells Magento to use 2 Column Left page template -->
    </reference>
</customer_account_login>

这将使用带有左侧边栏的模板。

然后,也在你的块中相同的<customer_account_login>句柄调用左边的结构块......

<customer_account_login>
    <reference name="root">
        <action method="setTemplate"><template>page/2column-left.phtml</template></action><!-- Tells Magento to use 2 Column Left page template -->
    </reference>
    <reference name="left"><!-- Tells Magento to place the following content in the left structural block-->
        <!-- Your Block Goes Here -->
    </reference>
</customer_account_login>

完成。

如果您不熟悉local.xml文件,可以修改 customers.xml <customer_account_login>句柄的内容,以使用上面提到的“root”和“left” - 你会发现它在root下调用了page / 1column.phtml文件,当然还没有<reference name="left">