Cat & subcat different layout possible?

  • Posts: 101
  • Thank you received: 12
11 years 7 months ago #96571

Hi,

We are displaying categories on the homepage in one column (see second picture: top left).
I did this with a menu-item type: Categories listing.
Here are the options:


No problem here.

Now when you click on one of the 3 categories we'd like to show the subcategories in 4 columns (no products are shown)
And from there, there are 2 possibilities when you click on one of the subcategories:
A) you see subsubcategories (should also be with 4 columns and again no products are shown)
B) you have a list of products (also with 4 columns and no categories are shown)
(see picture below for visual help)

So when I'm on the homepage I see 3 categories and when I click on one of them I should see subcategories in 4 columns.
When I click on one of the subcategories I will see a page with products (in 4 columns) or a page with subsubcategories (in 4 columns).

Here you can see what I mean. This picture is how I did it in redshop. But we want to move to hikashop but keep the layout the same.



How would I go and configure this?
After reading the documentation I don't see exactly how I can have different layouts for the parent category (one column), and a different layout for the subcategories(4 columns) and subsubcategories(4 columns)?

EDIT: If there was a way the set default 4 columns for the categories then I can just set "one column" in the homepage menu-item. That way it would work but I don't see where I can set default values for categories.


Thanks in advance.

Last edit: 11 years 7 months ago by SG.

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

  • Posts: 12953
  • Thank you received: 1778
11 years 7 months ago #96640

Hi,

That's currently not possible with hikashop's options, but I think that you'll be able to do that by creating a category custom field and adding some code customization.

Last edit: 11 years 7 months ago by Mohamed Thelji.

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

  • Posts: 101
  • Thank you received: 12
11 years 7 months ago #96749

Hi,

Since the parent categories are the only ones that have to be shown in one column, could I do the following to simulate what I'm trying to do?


On the home page I show an article with 3 blocks of text with picture as you can see in the previous post in the picture "Top Left".
And then just make all the categories with 4 columns?
I suppose this would only work if I make a menu for each category and subcategory?
So is there no way to make one default "category template" somehow and let in be inherited by every category?

I first thought I could do this in Configuration -> Display -> Modules main default options
And choose Category there but it doesn't work that way. Apparently you need to have a menu to be able to make a category.
Unless you guys have a way to make this work without really needing a menu?

Any advice is more than welcome.
Thanks

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

  • Posts: 13201
  • Thank you received: 2322
11 years 7 months ago #96810

Hi,

Yes if the main page show an article with three blocks, you can create three category listing menus to display categories in 4 columns.
The subcategories will be displayed in 4 columns too.

You have to create as many menu as the number of block in your home page.

Hope this will help you.

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

  • Posts: 101
  • Thank you received: 12
11 years 7 months ago #97031

Hi,

I'm trying some custom code after searching on the forum but can't seem to figure it out.

In Category / Listing I have access to $_GET["cid"], $_GET and $this->params->get('id')

How do we pass an itemid 526 so that's it's used when category 2 is selected and 514 for anything else?

I think I'm using the variable the wrong way.

With $_GET = 526 the variable is set but nothing happens.
And $this->params->set('id',526) doesn't seem to set the value.

Here is what I've tried to add in Category / Listing:

$menu_id = $this->params->get('id');
echo ("menu id: ".$menu_id."<br>");

if($_GET["cid"]==2)
{
  $_GET['Itemid'] = 526;
  $this->params->set('id',526);

}
else {
  $_GET['Itemid'] = 514;
  $this->params->set('id',514);
}

$html = $this->loadTemplate($layout_type);

$menu_id = $this->params->get('id');
echo ("menu id: ".$menu_id."<br>");


Can you help out. I might be overlooking things.

Thanks

Last edit: 11 years 7 months ago by SG.

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

  • Posts: 13201
  • Thank you received: 2322
11 years 7 months ago #97283

$_get = 526; will not work.
Thanks to try JRequest::setVar('Itemid','526'); instead.

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

  • Posts: 101
  • Thank you received: 12
11 years 7 months ago #97353

Hi Xavier,

That seems to set the var itemid to 526 but still the "content menu" 514 is used instead of 526.
Do I need to execute some other code to make sure it's passed on before the layout is loaded?

In my example when I have breadcrumbs:
Home > Webshop > Birth > Glass

And I click on Webshop which has cid 2 I want to use the settings from content menu 526.
But setting the itemid to 526 before $html = $this->loadTemplate($layout_type);
doesn't do anything.

Also $this->params->get('id'); has still the value 514 after setting itemid to 526 but not sure if this has to do with anything.

Any idea how to make sure that when someone clicks on webshop the content menu 526 is loaded?
Is Category / Listing the correct place to do this? I thought as long as it was done before $html = $this->loadTemplate($layout_type); that it would work.

Thanks.

$itemid = JFactory::getApplication()->input->getInt('Itemid'); 
echo "itemid: ".$itemid."<br>";

$id = $this->params->get('id');
echo "id: ".$id."<br>";

$cid = JFactory::getApplication()->input->getInt('cid'); 
echo "cid: ".$cid."<br>";

if($cid==2)
{
  echo "CID == 2. set itemid to 526<br />";

  JRequest::setVar('Itemid','526');
  /* $this->params->id = 526;  this doesn't work */
}
else {echo "cid not 2. just use default content menu 514<br />";}

$itemid = JFactory::getApplication()->input->getInt('Itemid'); 
echo "<br>After IF -- itemid".$itemid."<br>";

$id = $this->params->get('id');
echo "id: ".$id."<br><br>";

echo print_r($this->params);

if(empty($layout_type) || $layout_type=='table') $layout_type = 'div';
$html = $this->loadTemplate($layout_type);


And this is the output when you click on Webshop which has cid 2:

itemid: 514
id: 514
cid: 2
CID == 2. set itemid to 526

After IF -- itemid526
id: 514

Last edit: 11 years 7 months ago by SG.

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

  • Posts: 82785
  • Thank you received: 13353
  • MODERATOR
11 years 7 months ago #97555

Mmm. It sounds like you're trying a solution quite complex for what you want.

Here is a simple solution:
Create a joomla article, create a joomla menu item and assign that article to it and then set that menu item as default menu.
Then, create a category listing module to display your first level of categories the way you want.
In the menu option of the category listing module, select the category listing menu item that you want to be used for the second level of categories (and the display of these categories will used the options of the menu, not the module).
Finally, add that module to your joomla article using the loadposition plugin of joomla:
docs.joomla.org/How_do_you_put_a_module_inside_an_article%3F

That way, you will have a home page with a joomla article containing the first level of categories the way you want, and when clicking on a category, you will go the your category listing menu item which will list the sub categories of the main category clicked with the options of the menu item and the products of the sub category will be displayed with the associated products listing module of the menu item which will also have his own display options.

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

Time to create page: 0.088 seconds
Powered by Kunena Forum