简体   繁体   English

magento 1.9哪个布局XML文件指定哪个list.phtml文件将显示类别中的子类别列表?

[英]magento 1.9 Which layout XML file specifies which list.phtml file will show a list of subcategories within a category?

I want to specify a different list.phtml for showing subcategories within a category when clicking through categories from the list.phtml used to showcase a list of products. 我想指定一个不同的list.phtml,以便在用于显示产品列表的list.phtml中的类别单击时显示类别中的子类别。

I have one list.phtml that works great for listing subcategories, but then messes up placement of the shopping cart/shopping cart items when showing products. 我有一个list.phtml非常适合列出子类别,但是在显示产品时却弄乱了购物车/购物车项目的位置。

I have another list.phtml that works great for listing products inside of a category, but doesn't show subcategories of a category when you click on it. 我还有另一个list.phtml,非常适合在类别中列出产品,但是单击类别时却不显示该类别的子类别。

My goal is to specify a different list.phtml for when you are viewing a list of subcategories, from when you are viewing a list of products inside a layout XML file if that is possible. 我的目标是为查看子类别列表和在布局XML文件中查看产品列表(如果可能)时指定一个不同的list.phtml。

Thank you! 谢谢!

You can set different layout from admin for category. 您可以从admin设置不同的布局类别。 To set different list.phtml for parent category you can follow below steps- 要为父类别设置其他list.phtml ,您可以按照以下步骤操作:

  1. In Admin panel Create a static block (from CMS-> static blocks ) 在管理控制台中,创建一个静态块(通过CMS->静态块
  2. In static block you can add your list.phtml for sub categories using below code 在静态块中,您可以使用以下代码为子类别添加list.phtml

    {{block type="core/template" template="path/to/your/file/list.phtml"}} // You can replace core/template with your module/block {{block type =“ core / template” template =“ path / to / your / file / list.phtml”}} //您可以用模块/块替换core / template

  3. Now go to Catalog->Manage Categories 现在转到目录->管理类别

  4. Select the parent category for which you want to display subcategory list 选择要显示其子类别列表的父类别

  5. Now select Display settings tab 现在选择显示设置选项卡

  6. Now select Static block only in Display Mode 现在, 显示模式下选择静态块

  7. And Select your block from in CMS Block dropdown 并从“ CMS阻止”下拉列表中选择您的阻止

  8. Clean cache and check the category pages in frontend 清理缓存并检查前端中的类别页面

Note : don't forget to add your custom module/block to whitelist from System->Permissions->Blocks 注意 :不要忘记从系统->权限->块将自定义模块/块添加到白名单中

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM