Keyword

Extra Fields & Category View...

  • Scotty
  • Scotty's Avatar Topic Author
  • Offline
  • New Member
More
13 years 6 months ago #95188 by Scotty
Extra Fields & Category View... was created by Scotty
Hi, I'm new to K2 and just trying to sort out a few things...

 

I'm looking for a way to show only certain extra fields in the category view. For example, lets say I have a product catalogue with 15 extra fields showing the products specifications. On the item page I want to show all 15 fields but in the category page I only want to show the 5 most important ones.

Is there any way to do this? An extension maybe?

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

More
13 years 6 months ago #95189 by william white
Replied by william white on topic Extra Fields & Category View...
There may be several ways of coding what you want.

In any case you will need to create an override for the category in questions and edit category_item.php

look for <!-- Item extra fields --> in the file

you will need to test inside the foreach loop that prints out the extra fields and only show the five fields you want there using the or operator.... something like

if this->extrafield->name is contained in "string with the names you want"

allow the echo

strpos may be the way to test this

 

or

remove the foreach loop and declare the extra fields into an array and hardcode the printing of them

Mabey someone else will answer with "real code"

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

  • Scotty
  • Scotty's Avatar Topic Author
  • Offline
  • New Member
More
13 years 6 months ago #95190 by Scotty
Replied by Scotty on topic Extra Fields & Category View...
Thank you for your suggestion William. I'm afraid I don't (yet) know enough PHP to implement this.

 

I think when creating new Extra Fields a simple "show in Category view" YES/NO option would be a useful addition to K2.

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


Powered by Kunena Forum