Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2013-03-12 11:42:26

vineonardo
Member
Registered: 2011-08-31
Posts: 128
Website

How do I Add custom fields to images?

Hello,
I’ve a website where I’m using images as individual products. Now I’m asked to convert this site into ecommerce website.
Problem is there’s lots of information that needs to be stored for each product(image in this case). By default Textpattern’s Image tab provides very few fields to store data. I need a lot more than that.
I wish to know if there’s anyway I can store more than just caption & alt. I’ve had success in past to add an extra field(cost field) to images by modifying some library files.
I wish to know if I can do similar thing again.

Plan is to make some way to easily convert existing website in ecommerce by adding some additional fields to images & then using the jCart for cart & checkout mechanism.
I’d love to hear what you think about this, I’m totally out of ideas right now.

Offline

#2 2013-03-16 23:33:03

THE BLUE DRAGON
Member
From: Israel
Registered: 2007-11-16
Posts: 638
Website

Re: How do I Add custom fields to images?

Hi Vineet,
I think you will be better use articles instead of images,
as Images and files are media, and an article is the main body with the content.
Adding image/s to an article can be done super easily nowadays, using 2 cool plugins: bot_image_upload and abl_droploader

But, if you are still looking to add custom fields in the image editing page,
then you can just use JS to create fake fields, you can add how many fields you want and in any type.
After that, you simply save all the content from them as array into the caption textarea, and then use rah_repeat to split that array in your website and play with the content how you like to.
By doing that, you do not modify any TXP file, and do not need to deal with database.
I’m doing it to create custom UI fields in the write tab, take a look at my TXP tip: http://txptips.com/create-your-own-custom-ui-in-the-write-tab

Offline

#3 2013-03-17 06:00:30

vineonardo
Member
Registered: 2011-08-31
Posts: 128
Website

Re: How do I Add custom fields to images?

Thanks Gil, it’s a great tip. I can’t wait to try it out.
But for ecommerce, as you suggested I’ve already started using articles only as they are needed for yab_cart.
Thanks a lot for your tip on txptip, it’s very very useful.

Offline

Board footer

Powered by FluxBB