Show only the K2 items that have IMAGE?

Support forum dedicated to free and advanced Joomla content presentation module with various layout options and data sources support.
GK User
Sun Dec 14, 2014 9:27 pm
Is there a way to show only K2 items that have IMAGE. For example I am using K2 to build a directory, and some items will have IMAGE and most of them will without one, so I want to display only the ones with IMAGE :)

If is this possible only throug override of some of templates (newsgallery maybe?) can you please advise me how to do it?

Thanks! :)
User avatar
Fresh Boarder

GK User
Tue Dec 16, 2014 4:46 pm
Unfortunately it is very hard to implement and it is beyond of our technical support. The main problem is connected with fact that K2 doesn't store informations about featured images - these images are generated from md5 hash based on the item. So it is not possible to get only items with image. Then other issue appears - if you will get i.e. 100 items and 99 will without images, then you will be able to display only one item.
User avatar
Administrator

GK User
Wed Dec 17, 2014 10:47 pm
Yeah... I do know that K2 stores images in a, lets say, "strange" way. Can we than do something like this:
1. Make extra field with name IMAGE that would be a text field, or radio button with "yes" and "no" choice. All the items with image will have value "yes" and all without image will have value "no"
2. Check the value for this extra field in NSP and show only the items with value YES :)

Or if the extra field is too complicated to use, can we use the "image_credits" or "image_caption" field in similar way?
User avatar
Fresh Boarder

GK User
Thu Dec 18, 2014 10:58 pm
Technically it is possible, but it is a custom work beyond of our technical support.
User avatar
Administrator

GK User
Thu Dec 18, 2014 11:53 pm
Please be kind and tell me should I look to modify only one file or is more complicated? If is only one file can you tell me wich one? :?

Thanks :)
User avatar
Fresh Boarder

GK User
Sat Dec 20, 2014 1:07 pm
You should start with editing the data source model for K2, maybe it will also need to edit the view file for K2 in the module.
User avatar
Administrator

GK User
Sat Dec 20, 2014 4:03 pm
Great, thanks :)
User avatar
Fresh Boarder

GK User
Sun Jan 18, 2015 12:45 am
Hi,

This was quite easy to achive... since I am not a programmer here is the link where one can see what I did:

http://www.clickman.rs/en/web-design/62 ... ow-pro-gk5

I am sure that one can write the code to verify if the actual image file is present so the trick with image credit field would not be needed any more... who knows maybe you will implement this feature in one of the next updates :)
User avatar
Fresh Boarder


cron