Keyword

Exclude extra field but use the data in other component

  • Slartibartfast
  • Slartibartfast's Avatar Topic Author
  • Offline
  • Junior Member
More
3 years 11 months ago - 3 years 11 months ago #175729 by Slartibartfast
Hi all!
i have a website that uses plenty of extrafields for a catalogue of products.
Now i need to create a second gallery and a slideshow per product/item and even more custom showcases in the future.
So i though of adding for example 5 image extra fields at the extra fields group i have assigned already, pull these images from widgetkit (or any other gallery/slideshow component) and present it as gallery/slideshow etc via shortcode.
BUT in the above case the 5 images will show anyway as ... images.

i read this reply from Fotis (www.joomlaworks.net/forum/k2-en/49619-extra-fields#169013), which is very helpful in order to separate each extra field.
Could in some way extend this and exclude the 5 image fields from displaying in the item page?
Or any other possible solution about the matter actually ... :)
Last edit: 3 years 11 months ago by Slartibartfast.

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

More
3 years 11 months ago #175731 by JoomlaWorks
I would recommend using the K2 JSON API (?format=json to get JSON or ?format=json&callback=whatever to get JSONP) to grab the extra fields output and then regex the src attribute from the images to use wherever you like.

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

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

  • Slartibartfast
  • Slartibartfast's Avatar Topic Author
  • Offline
  • Junior Member
More
3 years 10 months ago #176037 by Slartibartfast
Replied by Slartibartfast on topic Exclude extra field but use the data in other component
ok so this went really bad. i started to have conflicts. I am not but a very basic coder so i gave up.
Instead i decided to create a custom plugin which seems more appropriate.

i managed to show 4 upload fields in item edit page (content tab) but obviously something is missing cause after i click save nothing is uploaded or nothing is shown to be uploaded.
this is the part of my .xml file with the form fields:
<!-- K2 plugin parameters which extend K2 backend forms are defined here -->
	<fields group="item-content">
		<field name="uvimg1" type="file"  size="80" default=""  label="Image-1" description="" />
		<field name="uvth1" type="file"  size="80" default="" label="Thumb-1" description="" />
		
		<field name="uvimg2" type="file"  size="80" default="" label="Image-2" description="" />
		<field name="uvth2" type="file"  size="80" default="" label="Thumb-2" description="" />
	</fields>
</extension>

Are there any examples of custom k2 plugins with image uploading?

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

More
3 years 10 months ago #176040 by JoomlaWorks
If it's just 4 single images you need to add to your form, it's simpler to just use the image extra field.

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

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

  • Slartibartfast
  • Slartibartfast's Avatar Topic Author
  • Offline
  • Junior Member
More
3 years 10 months ago #176046 by Slartibartfast
Replied by Slartibartfast on topic Exclude extra field but use the data in other component
unfortunately there will be 8 to 10 images with same amount of thumbnails. Thumbs being different images. I started with extra fields but there where so many "if" that my code was for laughs. I tried to use increments but i couldn't cause extra fileds alias do not accept numbers for some reason. My thought was to have aliases like "photo1" "photo2" etc.
Anyway so you suggest it is hard to use upload fields for k2 plugin?
Any existing plugins that use this method?

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

More
3 years 10 months ago #176053 by JoomlaWorks
It's not hard, just out of the scope of this support forum.

You can search for plugins that may fit your needs either in the JED or in getk2.org/extend.

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

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


Powered by Kunena Forum