Keyword

Categories View in Front Page

  • pocasolta
  • pocasolta's Avatar Topic Author
  • Offline
  • Junior Member
More
14 years 10 months ago #75555 by pocasolta
Categories View in Front Page was created by pocasolta
hi all,

I have a site with the following categories:

*PRODUCTS
*--- PRODUCTS_CAT_1
*--- PRODUCTS_CAT_2
*
subProd_Cat_1
*
subProd_Cat_2
*--- PRODUCTS_CAT_3
*NEWS
*COMPANY

for the PRODUCTS category I use a k2 template folder called 'products', and the same goes for 'NEWS' and 'COMPANY'

all the PRODUCTS's children categories inherit its template.

everything is working fine, but I have something that is driving me crazy and don't know how to achieve:

I have the main menu with these options: HOME | PRODUCTS | NEWS | COMPANY
the products, news and company menu items are of k2 category type and each one points to its category.

for the HOME (default) menu item I am showing various modules and it's working ok, but I also need to show a div with all the PRODUCTS subCategories (only 1 level down)... it's got to have just the name (with link) and the image for each category. Just like a frontpage for a product catalog, and it has to be a different layout (much simple) than when I select the PRODUCTS item menu.

I tried creating a fake k2 category, on top of PRODUCTS and giving this category a different template, and then changing the 'category.php' file.
I iterate through every child category using this code:
____ $childs = K2ModelItemlist::getCategoryFirstChilds($this->subCategories[0]->id, ""); (with this sentence I'm getting all the PRODUCT child categories)
and then a 'for' sentence iterating through each subcategory. I can create a div for every cat here with the name and the image, but the link is blank...

I am sure there is a better and maybe easier way to achieve this.

could anyone please help me out here?

thanks!

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

  • pocasolta
  • pocasolta's Avatar Topic Author
  • Offline
  • Junior Member
More
14 years 10 months ago #75556 by pocasolta
Replied by pocasolta on topic Categories View in Front Page
hi again,
anyone knows how could I personalize the category view for the front page only?

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

More
14 years 10 months ago #75557 by rashmani
Replied by rashmani on topic Categories View in Front Page
Hi pocasolta,

haven't tried my self, just an idea: have you tried creating a new K2 Tool component, assign a module location to it and setting parameters to list a category's entried on e level down only? Again, I haven't tried this but if I remember well that should be the way to go.

rash*

pocasolta said:hi again, anyone knows how could I personalize the category view for the front page only?

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

  • pocasolta
  • pocasolta's Avatar Topic Author
  • Offline
  • Junior Member
More
14 years 10 months ago #75558 by pocasolta
Replied by pocasolta on topic Categories View in Front Page
hello rash, thanks for the reply,

I tried what you propose but, as far as I know, with the K2 Tool component I can only get a category list with just the names of the categories. I'd also need to show the text and image for each category.

cheers.

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

More
14 years 10 months ago #75559 by rashmani
Replied by rashmani on topic Categories View in Front Page
Uhm, I believe you should play some with Category Item View parameters.
Another solution (or if the above doesn't solve) could be to edit .php files in template folder and add intro text, image, etc. (you can copy necessary code from the other files in the same folder).
I'll try to make a test later today to see if I'm pointing you in the right direction (by copying the K2 Tools comp and ...).

rash*

pocasolta said:hello rash, thanks for the reply, I tried what you propose but, as far as I know, with the K2 Tool component I can only get a category list with just the names of the categories. I'd also need to show the text and image for each category.

cheers.

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

  • pocasolta
  • pocasolta's Avatar Topic Author
  • Offline
  • Junior Member
More
14 years 10 months ago #75560 by pocasolta
Replied by pocasolta on topic Categories View in Front Page
hi again rash,

I followed jour last idea and I think I now have what I needed! =)

Now I have a new functionality for the k2 tools module: Category Showcase:

What I've done is: I added another feature to the k2 tools module by copying the 'Categories List (Menu)' functionality to a new one: 'Categories showcase'.

This new functionality renders the categories into div's instead of a list, and inside every category's div there's the category name and the category image.
I also added a new parameter to this feature: columns count. With this parameter I can set how many categories per row must be painted.

To do so I modified three files from the '/modules/mod_k2_tools' folder:
* mod_k2_tools.xml :new functionality and new parameter for this functionality
* mod_k2_tools.php :modification to call the correct new method
* helper.php :all the code for this new functionality, based on the code for the 'Categories List (Menu)' option.

I attach the files. I hope it can be useful for someone with the same needs.

Maybe the best approach would be to create a stand-alone module so I don't mess with the original source,...

thanks again! ,' )
Attachments:

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

More
14 years 9 months ago #75561 by rashmani
Replied by rashmani on topic Categories View in Front Page
Thanks? *you* created the solution, I just... inspired.
Thank you.

rash*

pocasolta said:hi again rash,
I followed jour last idea and I think I now have what I needed! =)

Now I have a new functionality for the k2 tools module: Category Showcase:

What I've done is: I added another feature to the k2 tools module by copying the 'Categories List (Menu)' functionality to a new one: 'Categories showcase'.

This new functionality renders the categories into div's instead of a list, and inside every category's div there's the category name and the category image.
I also added a new parameter to this feature: columns count. With this parameter I can set how many categories per row must be painted.

To do so I modified three files from the '/modules/mod_k2_tools' folder:
* mod_k2_tools.xml :new functionality and new parameter for this functionality
* mod_k2_tools.php :modification to call the correct new method
* helper.php :all the code for this new functionality, based on the code for the 'Categories List (Menu)' option.

I attach the files. I hope it can be useful for someone with the same needs.

Maybe the best approach would be to create a stand-alone module so I don't mess with the original source,...

thanks again! ,' )

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

More
14 years 9 months ago #75562 by Matthieu Brunet
Replied by Matthieu Brunet on topic Categories View in Front Page
This is exactly what I needed. Thanks a lot for that !!
But I'm affraid of beeing obliged to do change the file at every update of k2. Maybe it would be a nice (and quick) feature request. It would be even better to be a little more MVC, by mooving all of the HTML code in the view.

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

More
14 years 8 months ago #75563 by Matthieu Brunet
Replied by Matthieu Brunet on topic Categories View in Front Page
It was only an hour of work to convert it into a standalone module, and to move all the html into the template.
So here is my code.
To install it, you just have to upload it in your module directory. I think there is not a lot of work left to install it via the joomla module installer.
The language file miss.
Attachments:

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

More
14 years 8 months ago #75564 by Steve McLure
Replied by Steve McLure on topic Categories View in Front Page
I am a k2 beginner, and still trying to figure out how to populate my front page with ITEMS (rather than ARTICLES). I have added k2 to an existing Joomla 1.5 site. I know how to send ARTICLES to the front page, but i do not see this option for k2 ITEMS. I realize that this discussion is not the best place for this question, but it sounds like this might be an easy question for you guys. Can you help? Thanks, and happy holidays!

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


Powered by Kunena Forum