简体   繁体   中英

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.

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.

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.

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.

Thank you!

You can set different layout from admin for category. To set different list.phtml for parent category you can follow below steps-

  1. In Admin panel Create a static block (from CMS-> static blocks )
  2. In static block you can add your list.phtml for sub categories using below code

    {{block type="core/template" template="path/to/your/file/list.phtml"}} // You can replace core/template with your module/block

  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

  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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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