Keyword

[SOLVED] Extra Fields in Category View

  • TOM SCHUURMANS
  • TOM SCHUURMANS's Avatar Topic Author
  • Offline
  • New Member
More
10 years 11 months ago #119851 by TOM SCHUURMANS
[SOLVED] Extra Fields in Category View was created by TOM SCHUURMANS
Is there a way to limit the number of extra fields to be shown in Category View?

For example: I have 20 products/articles and they all have between 15 and 20 extra fields with specifications.

What I want is to have a category view of all produscts with only 5 extra fields showing. In item view all extra fields have to be shown.

Is this possible for a K2 newbie like me?

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
10 years 11 months ago #119852 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: Extra Fields in Category View
In the extrafields loop (for each) inside the category_item.php and put a counter (eg $i ).

Then use this example -- php.net/manual/en/control-structures.while.php to limit the results to the 5 first extrafields.

Remember to always override instead of editiing core files.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

  • TOM SCHUURMANS
  • TOM SCHUURMANS's Avatar Topic Author
  • Offline
  • New Member
More
10 years 11 months ago #119853 by TOM SCHUURMANS
Replied by TOM SCHUURMANS on topic Re: Extra Fields in Category View
Thanks for your answer.

The override part I get, I can find the extra fields loop but the examples in your link are way beyond my php skills :-)

Can you help me out here with a step by step tutorial?

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

  • Mohamed Abdelaziz
  • Mohamed Abdelaziz's Avatar
  • Offline
  • Platinum Member
  • Joomla Developer
More
10 years 11 months ago - 10 years 11 months ago #119854 by Mohamed Abdelaziz
Replied by Mohamed Abdelaziz on topic Re: Extra Fields in Category View
Hi,

You can add this line
<?php if($key > 4) break; ?>

directly after the foreach loop starting line
<?php foreach ($this->item->extra_fields as $key=>$extraField): ?>

Multiple Extra Fields Groups for K2
AutoMeta for K2
Chained Fields for K2
More K2 Extensions In My Extensions Store

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

  • TOM SCHUURMANS
  • TOM SCHUURMANS's Avatar Topic Author
  • Offline
  • New Member
More
10 years 11 months ago #119855 by TOM SCHUURMANS
Replied by TOM SCHUURMANS on topic Re: Extra Fields in Category View
Thanks!

Works like a charm!

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


Powered by Kunena Forum