How to add multiple fields?

How to add multiple fields?, a forum discussion on Jojo CMS. Join us for more discussions on How to add multiple fields? on our Plugin Support forum.

Back to Forum Index : Back to Plugin Support   RSS
logicbomb

11 Jan 2010
Posts: 20

Hi,

I am in the process of customizing jojo_cart_products_wine plugin. Now I have the requirement of adding multiple images for the same product. How do I go about it ? Is there any way to add multiple values for the same field by adding or deleting the rows? If there is no built-in way then please throw some light on how to implement the same.

Thanks in advance.
logicbomb

12 Jan 2010
Posts: 20

Anybody has got any suggestions? Do I have to create a custom field and add scripts or is there a way to configure the number of upload boxes and the cms will take care of the rest?

Thanks.
Harvey

Core Developer

Harvey

13 Jan 2010
Posts: 327

Sorry for the slow reply, been upgrading to Windows 7 and took a while to get the RSS feeds installed.

Installing multiple image fields is simple.

1. Go to phpMyAdmin and add a VARCHAR(255) field for each extra image you need. Call them image2, image3, image4 etc.

2. Run setup - ie visit domain.com/setup/

3. Go to domain.com/admin/edit/fielddata/ - browse for the product table and you should see these new fields below. Ensure the "type" is "fileupload" (it should be by default) and you will manually need to adjust the "order" to get them sitting where you want.

4. Go to "Edit products" - you should see the new image fields in here.

That should cover uploading images. To view the images, you should modify the .tpl file that comes with the jojo_cart_products_wine plugin.

Never edit the core version - make a copy of the file you want to edit in themes/YOURTHEME/templates and edit that version instead.

Look for how the image1 variable is used, and copy that syntax. If you have specific questions on this I can clarify, but it should be reasonably obvious when you look at the .tpl file.
logicbomb

13 Jan 2010
Posts: 20

Hi Harvey, Thanks for your reply. Initially I was looking for a dynamic solution that increases the number of image upload field on the fly and takes care of db and field updates by itself. When we do the edit field data through admin I was looking at the "Units:" field and confused myself that with number of units.

Actually I am working on the same solution you have given above. Got the clue from one of your previous replies in some other thread.
Back to Forum Index : Back to Plugin Support   RSS
You must be logged in to post a reply



You need to Register or Log In before posting on these forums.