Keyword

How do I add a parameter to category K2 back-end?

  • lexx006
  • lexx006's Avatar Topic Author
  • Offline
  • New Member
More
11 years 4 days ago - 11 years 4 days ago #118859 by lexx006
Hello everybody!

I need to add a parameter to category in K2 back-end in order to use it in a view.
I've tried to add one:
<param name="num_leading_items_added" type="text" size="4" default="10" label="K2_LEADING_COUNT" description="K2_NUMBER_OF_ITEMS_TO_DISPLAY_AS_LEADING"/>
to
components\com_k2\views\itemlist\tmpl\category.xml
and
administrator\components\com_k2\models\category.xml

but I still can't see the parameter in a category in K2 back-end.

How can I add a parameter?

Thanks for advance!

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

  • Stefanos Mountrakis
  • Stefanos Mountrakis's Avatar
  • Offline
  • New Member
More
11 years 4 days ago #118860 by Stefanos Mountrakis
Replied by Stefanos Mountrakis on topic Re: How do I add a parameter to category K2 back-end?
You can create an extra field without changing core files

1) Create a folder under /plugins/k2 named catField, inside there
2) Create a file catField.php

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

  • lexx006
  • lexx006's Avatar Topic Author
  • Offline
  • New Member
More
11 years 4 days ago - 11 years 4 days ago #118861 by lexx006
Hi,

Thanks for the reply.

Sorry but I need to have PARAMETER not an Extra field. haha

E.g. - Items count to show. Later I can use this parameter in view.html.php

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

  • Stefanos Mountrakis
  • Stefanos Mountrakis's Avatar
  • Offline
  • New Member
More
11 years 4 days ago #118862 by Stefanos Mountrakis
Replied by Stefanos Mountrakis on topic Re: How do I add a parameter to category K2 back-end?
yes... this is an extra field created inside of a category item not inside of an item. You can retrieve inside of view.html.php since its stored as a plugin

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

  • lexx006
  • lexx006's Avatar Topic Author
  • Offline
  • New Member
More
11 years 4 days ago #118863 by lexx006
Hi,

I tried as you said before but with no success. I can't see any new fields when I open a category layout in back-end.


I need to have it like this:

$params = K2HelperUtilities::getParams('com_k2');

$myparam = $params->get('myparam');

It is possible?

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

  • Mohamed Abdelaziz
  • Mohamed Abdelaziz's Avatar
  • Offline
  • Platinum Member
  • Joomla Developer
More
11 years 3 days ago #118864 by Mohamed Abdelaziz
Replied by Mohamed Abdelaziz on topic Re: How do I add a parameter to category K2 back-end?
Hello lexx006,

Its possible, but it is not recommended to hack the core file, the way StV explained is recommended.

The field will appear below the editor area, not on the right pane.

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.

  • lexx006
  • lexx006's Avatar Topic Author
  • Offline
  • New Member
More
11 years 3 days ago #118865 by lexx006
Hi Mohamed,

Thank you for the reply!

Yes, I got it, I looked for the field on the left side below the WYSIWYG but there's no filed there.

Perhaps I did something wrong. haha

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