Forums / Setting Up Categories, Products, Attributes / adding custom fields for products

adding custom fields for products

Views: 6,110

Results 1 to 20 of 20
5 Apr 2011, 10:31 AM
#1
jagall avatar

jagall

Zen Follower

Join Date:
Mar 2011
Location:
Ireland
Posts:
286
Plugin Contributions:
0

adding custom fields for products

i have spent ages searching for a solution to this, i want to add 2 new fields to my product list and have found a few suggestions how to this in the forum but still now working. i have added the fields to the database and changed the scripts as instructed but still not working. Has anyone any straight forward solutions to this. cheers::(

5 Apr 2011, 11:10 AM
#3
kamion avatar

kamion

New Zenner

Join Date:
Mar 2011
Posts:
93
Plugin Contributions:
0

Re: adding custom fields for products

It is not easy at first, but it can be done. :) Unfortunately, you have to give a lot more detailed information than your original post if you want some sensible help, other than words of encouragement.

5 Apr 2011, 12:44 PM
#4
dropbop avatar

dropbop

Zen Follower

Join Date:
Apr 2008
Location:
Athlone, Ireland
Posts:
177
Plugin Contributions:
1

Re: adding custom fields for products

There is also this thread.

I have had a look at most of the ones that have been posted, and personally, I find this the easiest to follow.

http://www.zen-cart.com/forum/showthread.php?t=57924

5 Apr 2011, 12:54 PM
#5
jagall avatar

jagall

Zen Follower

Join Date:
Mar 2011
Location:
Ireland
Posts:
286
Plugin Contributions:
0

Re: adding custom fields for products

i have added 2 fields to the database and amended a no of scripts to reflect this as advised in some of the forums namely:

admin/includes/modules/products/collect_info.php
admin/includes/modules/products/preview_info.php
admin/includes/languages/english/product.php
admin/includes/modules/update_product.php
/includes/modules/pages/product_info/main_template_vars.php
admin/includes/modules/category_product_listing.php
/public_html/shop/zencart/includes/templates/template_default/templates/tpl_product_info_display.php

not v good at this and tearing my hair out at this stage.
thanks

5 Apr 2011, 12:58 PM
#6
jagall avatar

jagall

Zen Follower

Join Date:
Mar 2011
Location:
Ireland
Posts:
286
Plugin Contributions:
0

Re: adding custom fields for products

dropbop:

There is also this thread.

I have had a look at most of the ones that have been posted, and personally, I find this the easiest to follow.

http://www.zen-cart.com/forum/showthread.php?t=57924

cheers i followed this too but didn't work for me might start over again with it :dontgetit

5 Apr 2011, 3:29 PM
#8
dropbop avatar

dropbop

Zen Follower

Join Date:
Apr 2008
Location:
Athlone, Ireland
Posts:
177
Plugin Contributions:
1

Re: adding custom fields for products

jagall:

not v good at this and tearing my hair out at this stage.
thanks

You would not be the first ;)

Its all a great big learning process, and everyone has to start somewhere, even the Zen gurus were not alway gurus :smartalec:

But keep trying, and you will get it.

:)

5 Apr 2011, 9:37 PM
#9
jagall avatar

jagall

Zen Follower

Join Date:
Mar 2011
Location:
Ireland
Posts:
286
Plugin Contributions:
0

Re: adding custom fields for products

CoolCarPartsOnline:

Try this module.

I have used it to create more than 10 new fields: http://www.zen-cart.com/index.php?main_page=product_contrib_info&products_id=271

hi only read the brief to this and it appears more descriptive does this allow for the fields to be set up in your database :bigups:

5 Apr 2011, 9:41 PM
#10
jagall avatar

jagall

Zen Follower

Join Date:
Mar 2011
Location:
Ireland
Posts:
286
Plugin Contributions:
0

Re: adding custom fields for products

misty:

Try previous thread at
http://www.zen-cart.com/forum/showthread.php?t=127600

cheers i am not sure but when i read it it apprears to me that "this mod creates one extra text field, 4 fields that are designed for pdf uploads and one field for a flash video with adjustable size"
so it may not be for text/numeric data!!

5 Apr 2011, 10:01 PM
#11
jagall avatar

jagall

Zen Follower

Join Date:
Mar 2011
Location:
Ireland
Posts:
286
Plugin Contributions:
0

Re: adding custom fields for products

kamion:

It is not easy at first, but it can be done. :) Unfortunately, you have to give a lot more detailed information than your original post if you want some sensible help, other than words of encouragement.

i have added 2 fields (decimal & numeric) to the database and amended a no of scripts to reflect the inclusion of the two fields this as advised in some of the forums namely:

admin/includes/modules/products/collect_info.php
admin/includes/modules/products/preview_info.php
admin/includes/languages/english/product.php
admin/includes/modules/update_product.php
/includes/modules/pages/product_info/main_template_vars.php
admin/includes/modules/category_product_listing.php
/public_html/shop/zencart/includes/templates/template_default/templates/tpl_product_info_display.php

but nothing seems to work.
e.g. collect_info.php

        <td class="main"><?php echo TEXT_PRODUCTS_COUNT; ?></td>
        <td class="main"><?php echo zen_draw_separator('pixel_trans.gif', '24', '15') . ' ' . zen_draw_input_field('products_count', ($pInfo->products_count== 0 ? 1 : $pInfo->products_count)); ?></td>

/templates/tpl_product_info_display.php

<?php echo (($flag_show_product_info_count ==1 and $products_count !=0) ? '<li> . TEXT_PRODUCTS_COUNT . $products_count . '<li>' : '') . "\n"; ?>

i dont think the above is correct.

any ideas!!

6 Apr 2011, 9:40 AM
#12
dropbop avatar

dropbop

Zen Follower

Join Date:
Apr 2008
Location:
Athlone, Ireland
Posts:
177
Plugin Contributions:
1

Re: adding custom fields for products

This is how I have it in collect_into.php

<td class="main">Count: </td>
<td class="main"><?php echo zen_draw_separator('pixel_trans.gif', '24', '15') . ' ' . zen_draw_input_field('products_count', $pInfo->products_count, zen_set_field_length (TABLE_PRODUCTS, 'products_count')); ?></td>
</tr>

and in tpl_product_info_display.php

<div id="productDescription" class="productGeneral biggerText"><strong>Count: </strong><?php echo $product_info->fields['products_count']; ?></div>
6 Apr 2011, 1:50 PM
#13
jagall avatar

jagall

Zen Follower

Join Date:
Mar 2011
Location:
Ireland
Posts:
286
Plugin Contributions:
0

Re: adding custom fields for products

dropbop:

This is how I have it in collect_into.php

<td class="main">Count: </td> <td class="main"><?php echo zen_draw_separator('pixel_trans.gif', '24', '15') . ' ' . zen_draw_input_field('products_count', $pInfo->products_count, zen_set_field_length (TABLE_PRODUCTS, 'products_count')); ?></td> </tr> ``` > > and in tpl_product_info_display.php > ``` <div id="productDescription" class="productGeneral biggerText"><strong>Count: </strong><?php echo $product_info->fields['products_count']; ?></div> ```

thank you for trying this for me, i copied the code and inserted it but still not working. i'm thinking that may be its a series of errors on my part that is doing this. What you advised is slightly different to the others so perhaps the other files are inconsistent too. i would have thought that the ability to add fields to the products would be a major need for most, so i thought there would be more on this topic.

I followed both advice from the following link and crazy chris but i think it contradicts as well.
www.czetsuya-tech.##########################/2009/05/zencart-add-customize-product-admin.html

Am I correct in assuming that when done correctly that when i go into add products the fields added should appear for data input.
:frusty:
help, i'm getting the feeling i'm a way over my head here.

6 Apr 2011, 11:33 PM
#15
jagall avatar

jagall

Zen Follower

Join Date:
Mar 2011
Location:
Ireland
Posts:
286
Plugin Contributions:
0

Re: adding custom fields for products

CoolCarPartsOnline:

Try this one:http://www.zen-cart.com/index.php?main_page=product_contrib_info&products_id=271

Thanks for sending this. silly question but to implement this do you just replace the files into the sub-directories as named.

This module seems to create another table, i only want to add two fields to the existing product table as they relate to the table in question.

7 Apr 2011, 12:19 AM
#16
coolcarpartsonline avatar

coolcarpartsonline

Totally Zenned

Join Date:
Feb 2008
Posts:
1,386
Plugin Contributions:
0

Re: adding custom fields for products

You would have to merge the changes only.

DO NOT override any files as this was developed for 1.38 and some files have changed since then.

It will not affect the functions of the mod though if you do merge the codes.

7 Apr 2011, 3:13 AM
#17
kamion avatar

kamion

New Zenner

Join Date:
Mar 2011
Posts:
93
Plugin Contributions:
0

Re: adding custom fields for products

Hi jagall,

When you said nothing seems to work, what do you actually see when you try to add/edit the product in the Categoris/Products admin page?

Do you see everything but the new field you added, or do you see a blank page, or do you see fields displayed but stops right where you added your own field?

If you see everything but the new field, it could be you're editing the wrong file in the wrong place (override).

If you see only a blank page, it could be a syntax error in your code - like an extra semicolon, or missing bracket, etc.

If it displays correctly and stops where you added your own field, then something is wrong with that piece of code you added. :)

Am I correct in assuming that when done correctly that when i go into add products the fields added should appear for data input.

Yes. :)

Just refer to existing fields in collect_info.php file and search for all instances of the field name and then duplicate the bits except change the names to your own custom field name.

I suggest search for products_quantity and try to duplicate (and renaming the duplicate) all instances of products_quantity in collect_info.php.

This would then show up when you try to add a new product of that type.

You then need to edit preview_info.php to preview the value you added.

After that, edit update_product.php to actually save the value into the database.

Each step can be done and tested one by one, so you don't have to worry about preview_info.php and update_product.php until you get collect_info.php displaying correctly.

And forget about /templates/tpl_product_info_display.php for now. That's on the Catalog side and you can ignore it for now until you have at least got update_product.php working.

7 Apr 2011, 10:17 PM
#18
jagall avatar

jagall

Zen Follower

Join Date:
Mar 2011
Location:
Ireland
Posts:
286
Plugin Contributions:
0

Re: adding custom fields for products

Hi thanks to all who responded to my pleas, and you will be glad to know my problem is fixed:clap:
big thanks to dropbop for this one.:thumbsup:
i had not assigned the product type 'General' correctly, and few commas had gone astray i know, i know, i feel stupid now . . . but what a relief

11 Apr 2011, 7:26 PM
#19
dropbop avatar

dropbop

Zen Follower

Join Date:
Apr 2008
Location:
Athlone, Ireland
Posts:
177
Plugin Contributions:
1

Re: adding custom fields for products

No problem at all jagall :)

Glad to help.

24 Apr 2011, 8:52 PM
#20
twitchtoo avatar

twitchtoo

Totally Zenned

Join Date:
Apr 2007
Location:
Ontario, Canada
Posts:
1,733
Plugin Contributions:
14

Re: adding custom fields for products

Product description add to admin or short description module

Bug fix in the 'short description' module located here:
http://www.zen-cart.com/index.php?main_page=product_contrib_info&products_id=271

in admin/includes/modules/product/preview_info.php
look for:
$pInfo->products_short_desc = zen_get_products_ahort_desc($pInfo->products_id, $languages[$i]['id']);

replace with:
$pInfo->products_short_desc = zen_get_products_short_desc($pInfo->products_id, $languages[$i]['id']);

i'll post more once i get this module working for 1.3.9h.

Twitch.

Twitch.
https://www.twitchtoo.com Do you work for free? Please donate.
June 7.2026 - NOW AVAILABLE - Twitch Base8 - Obsidian