Set the product sub-module on menu item Category Listing to display custom view

  • Posts: 86
  • Thank you received: 11
  • Hikashop Business
5 years 9 months ago #294230

-- HikaShop version -- : 3.4.0
-- Joomla version -- : 3.8.8

I have searched and searched and I may not be phrasing my question correctly. I am setting up a category listing menu item. The category view is fine but the product display is not what I need. In the screenshot you will see three products within the category. How can I set these to display a custom view of product / listing_div.php ?

Attachments:

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

  • Posts: 81361
  • Thank you received: 13037
  • MODERATOR
5 years 9 months ago #294231

Hi,

In the settings of your menu item, under the "products options" tab, you can select between div, table and list layouts, which corresponds to listing_div, listing_table and listing_list.
There is way to add additional layouts there.
So you have two options:
- you put the code of your custom view in a view override of "listing_list" or "listing_table", supposing that you don't use these.
- you do a view override of product / listing.php and there, at the beginning, you can use such code to force the layout:
$this->params->set('layout_type', 'custom');
supposing that you have a view file listing_custom.php

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

  • Posts: 86
  • Thank you received: 11
  • Hikashop Business
5 years 9 months ago #294274

Thanks for the quick response. Just a follow up question on this:

nicolas wrote: - you do a view override of product / listing.php and there, at the beginning, you can use such code to force the layout:
$this->params->set('layout_type', 'custom');
supposing that you have a view file listing_custom.php


Won't that method force this view onto ALL product/category pages? We need this view to only show for categories we specify.

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

  • Posts: 81361
  • Thank you received: 13037
  • MODERATOR
5 years 9 months ago #294275

Hi,

That's just a hint. Yes, you need some code around it to restrict that command to only some categories or only some menu items.
You have the information of the current category in $this->element in that view file. If you know a bit of PHP, it shouldn't be a problem to write the condition as you need it.

Last edit: 5 years 9 months ago by nicolas.

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

  • Posts: 86
  • Thank you received: 11
  • Hikashop Business
5 years 9 months ago #294315

Ok. I think we'll go with overriding the listing_list view to start. Might be a good option to throw in to a future version. The product custom views work excellent.

The following user(s) said Thank You: nicolas

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

Time to create page: 0.068 seconds
Powered by Kunena Forum