Handling different category templates.

  • Posts: 292
  • Thank you received: 5
  • Hikashop Business
13 years 4 months ago #3018

I have a Joomla menu item called 'shop' which displays a list of categories.
I have selected image + title display - so it uses template: listing_img_title.php
However, I only want the image displayed on some of the categories.
Or to put it another way I want to use different templates down the tree, like this:

  • Category 1 - template 1 (e.g. listing_title.php)
  • Category 1.1 - template 1
  • Category 1.2 - template 1
  • Category 1.2.1 - template 2 (e.g. listing_img_title.php)
  • Category 1.2.2 - template 2
[/ul]
  • Category 2 - template 1
  • Category 3 - template 1
  • [/ul]
    How can I do this?

    Please Log in or Create an account to join the conversation.

    • Posts: 81604
    • Thank you received: 13082
    • MODERATOR
    13 years 4 months ago #3020

    I see what you want to do. But then, one could ask to have such possibilities for other options of the menus/modules. In order to accomplish such feature, I think we should add an "menu" override option to each category and that would override the current menu itemid in the links so that when you select the category, the itemid would be changed in the URL and, thus, the options affected to the view would be changed.
    It seems like a nice way of handling all that.

    Now, if you want a solution right away, you should edit the file listing_div of the view category in the menu Display->Views and set the item view type dynamically based on the categories:

    if(in_array($this->element->category_id, array(2,8,16))){
    $this->params->set('div_item_layout_type','img_title');
    }
    So, for the categories with the id 2, 8 and 16, the item layout type would be overriden to the img_title template instead of the one in the options of the menu.

    Please Log in or Create an account to join the conversation.

    • Posts: 292
    • Thank you received: 5
    • Hikashop Business
    13 years 4 months ago #3033

    Thanks for that - changing the template as you suggested did what I wanted.

    An override feature sounds like the way to go.

    1. Override for category.
    Inheritance handling - Sub-categories inherit override or default?

    2. Override for product at category level.
    Inheritance handling?

    3. Override for product.

    Please Log in or Create an account to join the conversation.

    • Posts: 81604
    • Thank you received: 13082
    • MODERATOR
    13 years 4 months ago #3034

    Thank you for your input.
    Everything you said is possible.... We just need to get to it and take some time to do it :)

    Please Log in or Create an account to join the conversation.

    Time to create page: 0.068 seconds
    Powered by Kunena Forum