Zen Cart Logo
Forums / Setting Up Categories, Products, Attributes / New / Custom Extra Product Fields

New / Custom Extra Product Fields

Views: 4,986

Results 1 to 20 of 29
25 Jun 2014, 4:24 PM
#1
stiggybaby avatar

stiggybaby

New Zenner

Join Date:
Apr 2011
Posts:
91
Plugin Contributions:
0

New / Custom Extra Product Fields

I've been searching the forum (and plugins) for close to 2 weeks now, and my head's ready to burst.

It's hard for a newer Zencart admin to sort through everything due to the overwhelming quantity of posts.

So much was written for 13x and I don't know / cannot find if that's what to do for 151.

The thing that I'm trying to do right now is add custom fields to my cvs txt file to import with EP4 (no options, no attributes), and have displayed on the front end.

example:

v_products_height, v_products_width, v_products_compatible

I *could *merge my height and width fields together and use the plugin Product Extra Fields v151 since this plugin only adds 1 text field (according to the description). I have to pdfs, no flash files, and no links to add.

I DID see the Numinix plugin, BUT, like many others apperently, I am lost in the installation instructions (I did install a picaflor-azul template a-ok easy as pie. It's got clear install instructions, and EP4, as it too has easy install instructions).

Neither a google search, nor this forum, nor numinix's site doesn't explain the install clearly.

So basically I'm asking for someone who installed the Numinix plugin to list their install steps AND/OR a link to a mod for adding fields.

BOTH appear in a TON of posts without answers, or from 2009, for example, for a complex code/file mod which leaves newer 151 users stumped.

25 Jun 2014, 5:35 PM
#2
bislewl avatar

bislewl

Totally Zenned

Join Date:
Dec 2011
Location:
Wisconsin, USA
Posts:
674
Plugin Contributions:
12

Re: New / Custom Extra Product Fields

The biggest portion of the numinix product fields that can be confusing, is it consists of 3 basic directories in the module files.

1.) The module itself in the Catalog directory
2.) The "pre-built" optional fields for the admin in the optional_fields directory
3.) The optional fields for the catalog side, in the optional_catalog directory

Quick and basic steps for installing the module
1.) Backup Files and DB
2.) Copy the files in the catalog/admin directory to your whatever admin directory maybe? public_html/zcadmin
3.) Copy the module_version directory to you store directory. public_html?
4.) In the Admin go to tools-> Install SQL Patches select the install.sql file included in the package.

To install one of the fields.
1.) Copy the files from the admin directory for that field to your admin directory
2.) Run the Install.sql for that field

If you choose you choose to add the fields to your catalog too, i would recommend merging (line comparison) between the modules sample files and your sites, files as the templates are more then likely different.

Does that make more sense?

I would say this install is of a moderate complexity if you haven't installed very many modules. There are many developers are there that can install this for you fairly quickly if need be. If you don't feel comfortable installing this i would recommend spending the few $$ to have someone familiar with this module to help you out. However you will need to look outside the forum as this isn't a place to advertise or seek those services.

25 Jun 2014, 5:48 PM
#3
balihr avatar

balihr

Totally Zenned

Join Date:
Oct 2008
Location:
Croatia
Posts:
1,798
Plugin Contributions:
22

Re: New / Custom Extra Product Fields

Last time I used Numinix Product Fields was a few years ago, but the installation is pretty straight-forward.

There's a required part -just go over all files and, if those files already exist on your server, carefully merge the changes. If not, just upload the files preserving folder structure.
As for the optional part - do the same and just merge the changes with already existing files.

And, re: your search... Hehe... The one you mention from 2009 must be this. Unfortunately, it's perfectly correct and not much has changed. The only thing YOU would need to be careful about is the fact that you can't use a new table, but would instead need to add your new fields into the products table (which actually simplifies the process a bit). If you use a separate table, you won't be able to use EP4 with those fields.

4 Jul 2014, 5:56 PM
#4
stiggybaby avatar

stiggybaby

New Zenner

Join Date:
Apr 2011
Posts:
91
Plugin Contributions:
0

Re: New / Custom Extra Product Fields

Actually I wrote 2009 (webego thread), but I was thinking of 2007 (crazy_chris thread). I decided not to try the numinix, and instead edited files... WITHOUT complete success, but some success. Here is what I did so far:

http://www.zen-cart.com/showthread.php?57924-How-To-Add-new-Properties-to-your-Products
http://www.zen-cart.com/showthread.php?185387-Extra-Fields-oin-category-listing-page

THE SHORT LIST:

1.Admin>Tools>Install SQL Patches
ALTER TABLE products ADD products_newfield TEXT;

  1. Edit "/admin/includes/modules/product/collect_info.php".

2a. After "$parameters = array", add to list with others:
'products_newfield' => '',

2b. After "$product = $db->Execute("select"," , add to list with others:
p.products_newfield

2c. Add the input fields in the product-mask, in area with other add:

      <tr>
        <td class="main"><?php echo TEXT_PRODUCT_NOTES; ?></td>
        <td class="main"><?php echo zen_draw_separator('pixel_trans.gif', '24', '15') . ' ' . zen_draw_input_field('products_newfield', $pInfo->products_newfield); ?></td>
      </tr>
      <tr>
        <td colspan="2"><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
      </tr>
  1. Edit "/admin/includes/modules/product/preview_info.php"

After "$product = $db->Execute("select", add to list with others:
p.products_newfield

  1. Edit "/admin/includes/modules/update_product.php"
    After "$sql_data_array = array(", add to list with others:
    'products_newfield' => zen_db_prepare_input($_POST['products_newfield']),

QUESTION QUESTION for #4: Shoud I also add after "// Data-cleaning to prevent MySQL5 data-type mismatch errors:" with the others:
$tmp_value = zen_db_prepare_input($_POST['products_newfield']);
$products_newfield = (!zen_not_null($tmp_value) || $tmp_value=='' || $tmp_value == 0) ? 0 : $tmp_value;

  1. Edit "/includes/modules/pages/product_info/main_template_vars.php"

After "$sql = "select", add to list with others:
p.products_newfield

Also added to the list with the others:
$products_newfield = $product_info->fields['products_newfield'];

Then also with the others after "// build show flags from product type layout settings", I added:

$flag_show_product_info_newfield = zen_get_show_product_switch($_GET['products_id'], 'newfield');

  1. Edit "/includes/templates/MYTEMPLATE/templates/tpl_product_info_display.php
<?php echo (($flag_show_product_info_newfield == 1) ? '<li>' . $products_notes . TEXT_PRODUCT_NEWFIELD . '</li>' : '') . "\n"; ?>

QUESTION QUESTION #6: The above does not work (I see "(bullet point) 100.101TEXT_PRODUCT_NEWFIELD"), but below does:

<!--bof product newfield --> <?php if ($products_newfield != '') { ?> <div class="productGeneral"><li>Newfield:<?php echo $products_newfield; ?></li></div> <?php } ?> <!--eof product newfield -->

Also works:

<?php if (!empty($product_info->fields['products_newfield'])) echo $product_info->fields['products_newfield']; ?>
  1. Edit "/includes/languages/english/YOUR_TEMPLATE/index.php"

define('TABLE_HEADING_NEWFIELD', 'Newfield');

  1. Edit "/includes/modules/pages/index/main_template_vars.php

(under "// create column list $define_list = array('PRODUCT_LIST_MODEL' => PRODUCT_LIST_MODEL,")
'PRODUCT_LIST_NEWFIELD' => PRODUCT_LIST_NEWFIELD,

  case 'PRODUCT_LIST_NEWFIELD':
  $select_column_list .= 'p.products_newfield, ';
  break;
  1. Edit "/includes/modules/YOUR_TEMPLATE/product_listing.php", and add:

    case 'PRODUCT_LIST_NEWFIELD':
    $lc_text = TABLE_HEADING_NEWFIELD;
    $lc_align = '';
    $zc_col_count_description++;
    break;

  2. Edit "/includes/index_filters/default_filter.php", and add to "$select_column_list" (4 different times):

p.products_newfield,

    case 'PRODUCT_LIST_NEWFIELD':
      $listing_sql .= " order by p.products_newfield " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
      break;
  1. Insert into configuration:

?????????????????????

I messed up my table somehow. Basically what happened is that the thread listed:

insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Display Product Newfield', 'PRODUCT_LIST_NEWFIELD, '4', 'Do you want to display the Product Newfield', 8, 5, now());

BUT, I received an error, so I went into phpmyadmin, exported the configuration table as cvs, opened it in open office, inserted row around 212, copied and pasted similar row and edited it to "newfield", and imported the cvs into phpmyadmin (deleting original during the import).

NOW I SEE THE NEWFIELD IN ADMIN, BUT in admin>configuration>product listing when I click on edit, no text box appears on the right. I can click on update, then the value changes from 3(3 for example) to blank ( for example) for ANY AND ALL in this admin>configuration>product listing area. Here's an example of a row from the cvs file:

212,"Display Product Image","PRODUCT_LIST_IMAGE",1,"Do you want to display the Product Image?",8,1,"2014-07-03 07:51:01","2009-05-30 08:43:46","NULL","NULL"

218,"Display Product Newfield","PRODUCT_LIST_NEWFIELD",3,"Do you want to display the Product Newfield?",8,7,"NULL","2009-05-30 08:43:46","NULL","NULL"

So, that is a BIG problem.

2nd problem, the product listing added the newfield, but like this when nothing is in that field for a product:

0

And like this when the value I entered is MEMEMEM:

MEMEMEM

So, 2nd issue really is to stop showing "0" when empty.

And 3rd problem is that on the individual product page it shows:

MEMEMEMTEXT_PRODUCT_NEWFIELD

4 Jul 2014, 6:25 PM
#5
stiggybaby avatar

stiggybaby

New Zenner

Join Date:
Apr 2011
Posts:
91
Plugin Contributions:
0

Re: New / Custom Extra Product Fields

Sorry, I was sooo involved in these file edits and trying to get zencart setup, that I completely forgot my manners...

Thank you both bislewl, and balihr for your replies, and if you have any further direction in helping me out with any or part of the above, it would be greatly appreciated. PLUS, I really want to have a more complete thread on this issue with a FINALIZED 1.5.1 step-by-step so people don't have to google their way for days and days through tons and tons of posts, only to not get the issue solved.

I've read about several other sellers, like myself, of different parts, where extra fields are an absolute MUST due to the type of product and customer needs.

7 Jul 2014, 8:47 PM
#6
delia avatar

delia

Totally Zenned

Join Date:
May 2006
Location:
Gardiner, Maine
Posts:
2,383
Plugin Contributions:
7

Re: New / Custom Extra Product Fields

Hmm, the apsona shop manager is free and is a lot easier to use than the ezpopulate. Fields added to the product table automatically get included.
http://apsona.com/pages/ec/signup.html

Additionally, I wrote the extra product fields mod - it uses a different table because it had the possibility of adding many fields and I wanted to keep that info separated out of the products table.

I've thought about a new version since that one was actually written more to include a flash file on the product page and that's probably not happening anymore. At least I hope so.

So perhaps it would be best to rewrite the mod to include upload maybe 2 PDFs (the other reason for the mod) and several text fields. Connect them to the product table instead and that would have solved your problem, correct?

8 Jul 2014, 6:34 PM
#7
stiggybaby avatar

stiggybaby

New Zenner

Join Date:
Apr 2011
Posts:
91
Plugin Contributions:
0

Re: New / Custom Extra Product Fields

delia:

...So perhaps it would be best to rewrite the mod to include upload maybe 2 PDFs (the other reason for the mod) and several text fields. Connect them to the product table instead and that would have solved your problem, correct?

YES, YES, YES!!!!

From what I have read from several dozen posts on the forum that would help ALL of us parts type of stores (plus have the extra fields searchable, so customers can find the part they need easily would be a big bonus too).

8 Jul 2014, 6:41 PM
#8
delia avatar

delia

Totally Zenned

Join Date:
May 2006
Location:
Gardiner, Maine
Posts:
2,383
Plugin Contributions:
7

Re: New / Custom Extra Product Fields

Searchable is a whole 'nother thing. Though maybe if this was all pulled into the product table, that would take care of itself.

I'm updating the mod now for zc v1.5.3 but making a change like that in tables is major. I'm just going to upload this one with the small change and do another version that changes majorly. I'll let you know when I have a the fully revised mod ready.

9 Jul 2014, 1:22 AM
#9
stiggybaby avatar

stiggybaby

New Zenner

Join Date:
Apr 2011
Posts:
91
Plugin Contributions:
0

Re: New / Custom Extra Product Fields

delia:

Searchable is a whole 'nother thing. Though maybe if this was all pulled into the product table, that would take care of itself...

Yep!

delia:

I'm updating the mod now for zc v1.5.3 but making a change like that in tables is major. I'm just going to upload this one with the small change and do another version that changes majorly. I'll let you know when I have a the fully revised mod ready.

SUH! - WHEAT! Sweet!

9 Jul 2014, 6:40 PM
#10
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: New / Custom Extra Product Fields

In general I'd recommend not altering the "products" table directly, if at all possible, mostly to make things easier for upgrades.
Then adapt the search code to include your additional tables' relevant fields if search is a required component to specific fields you're adding.

9 Jul 2014, 8:43 PM
#11
delia avatar

delia

Totally Zenned

Join Date:
May 2006
Location:
Gardiner, Maine
Posts:
2,383
Plugin Contributions:
7

Re: New / Custom Extra Product Fields

Thanks, Dr. Byte, I appreciate the input and feel better about how I set this up in the first place!

The search change - advanced search result header? The only way is to edit the header_php.php? This was the the real lack in this mod from the start.

11 Jul 2014, 1:18 PM
#12
stiggybaby avatar

stiggybaby

New Zenner

Join Date:
Apr 2011
Posts:
91
Plugin Contributions:
0

Re: New / Custom Extra Product Fields

DrByte:

In general I'd recommend not altering the "products" table directly, if at all possible, mostly to make things easier for upgrades.
Then adapt the search code to include your additional tables' relevant fields if search is a required component to specific fields you're adding.

I get that, and I obviously know nothing compared to you, but I am left not understanding my options on how I can continue to use zencart, as well as anybody else that is a parts supplier that, due to the product, HAS TO HAVE extra fields, and has thousands of parts, and due to that maintains the catalog in a text file using OO Calc or Excel, and therefore has to be able to import and export (in order to maintain inventory count), so therefore needs Easy Populate 4, and therefore basically needs the extra fields to be added to the main products table directly.

Is there another or better way for us parts suppliers (who absolutely have to have extra fields and import/export)?

11 Jul 2014, 1:28 PM
#13
delia avatar

delia

Totally Zenned

Join Date:
May 2006
Location:
Gardiner, Maine
Posts:
2,383
Plugin Contributions:
7

Re: New / Custom Extra Product Fields

I have parts suppliers as clients - once i get the search working with this, the mod will suffice for that part. I'll see about getting apsona to include the new database table at that point. After using apsona for years now, I can't imagine touching ezpopulate again. That is such a nightmare for my clients.

11 Jul 2014, 1:44 PM
#14
delia avatar

delia

Totally Zenned

Join Date:
May 2006
Location:
Gardiner, Maine
Posts:
2,383
Plugin Contributions:
7

Re: New / Custom Extra Product Fields

Dr. Byte, protocol question. Having trouble getting the search right - should I start a new thread for the search modification?

11 Jul 2014, 2:02 PM
#15
stiggybaby avatar

stiggybaby

New Zenner

Join Date:
Apr 2011
Posts:
91
Plugin Contributions:
0

Re: New / Custom Extra Product Fields

stiggybaby:

...so therefore needs Easy Populate 4...

Excuse me, sorry about that. I should have wrote plugins like EP4, and APSONA SHOP MANAGER.

I look forward to using Apsona.

11 Jul 2014, 6:20 PM
#16
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: New / Custom Extra Product Fields

stiggy,
I didn't say you "can't". I was just pointing out that it makes things more complicated. You could absolutely write code which links an added table of data into all your product queries. The "music" product type does exactly that, if you're looking for a basic example.

If you want to proceed with adding more fields to core tables, that's your call. Sorry I said anything.
The Numinix Product Fields addon might be of value if you really need more fields. Just be mindful that it does touch core files (and is based on adding additional fields to those core tables) and you will need to carefully manage it when doing any upgrades.

11 Jul 2014, 6:21 PM
#17
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: New / Custom Extra Product Fields

delia:

The search change - advanced search result header? The only way is to edit the header_php.php?
I believe that's where all the search logic is stored.

20 Jul 2014, 12:55 AM
#18
stiggybaby avatar

stiggybaby

New Zenner

Join Date:
Apr 2011
Posts:
91
Plugin Contributions:
0

Re: New / Custom Extra Product Fields

At some point I did exactly what I wanted to do, but I don't know when so I don't have notes on how I did it.

Here's the CVS export:

2,Show Notes,SHOW_PRODUCT_INFO_NOTES,1,Display Notesr on Product Info 0= off 1= on,1,2,2014-07-17 15:11:30,2009-05-30 08:43:48,NULL,zen_cfg_select_drop_down(array(array('id'=>'1', 'text'=>'True'), array('id'=>'0', 'text'=>'False'))
3,Show Width,SHOW_PRODUCT_INFO_WIDTH,1,Display width on Product Info 0= off 1= on,1,3,0000-00-00 00:00:00,2009-05-30 08:43:48,NULL,zen_cfg_select_drop_down(array(array('id'=>'1', 'text'=>'True'), array('id'=>'0', 'text'=>'False'))

I somehow seem to have inserted my 2 new fields right into the 2 and 3 position between SHOW_PRODUCT_INFO_MODEL and SHOW_PRODUCT_INFO_WEIGHT

I do not want to mess up my product_type_layout but I do want to recreate the same results in my live site.

Can I please get some help on what my INSERT INTO product_type_layout sql patch should be?

THANK YOU!

20 Jul 2014, 2:33 AM
#19
stiggybaby avatar

stiggybaby

New Zenner

Join Date:
Apr 2011
Posts:
91
Plugin Contributions:
0

Re: New / Custom Extra Product Fields

stiggybaby:

At some point I did exactly what I wanted to do, but I don't know when so I don't have notes on how I did it.

Here's the CVS export:

2,Show Notes,SHOW_PRODUCT_INFO_NOTES,1,Display Notesr on Product Info 0= off 1= on,1,2,2014-07-17 15:11:30,2009-05-30 08:43:48,NULL,zen_cfg_select_drop_down(array(array('id'=>'1', 'text'=>'True'), array('id'=>'0', 'text'=>'False'))
3,Show Width,SHOW_PRODUCT_INFO_WIDTH,1,Display width on Product Info 0= off 1= on,1,3,0000-00-00 00:00:00,2009-05-30 08:43:48,NULL,zen_cfg_select_drop_down(array(array('id'=>'1', 'text'=>'True'), array('id'=>'0', 'text'=>'False'))

I somehow seem to have inserted my 2 new fields right into the 2 and 3 position between SHOW_PRODUCT_INFO_MODEL and SHOW_PRODUCT_INFO_WEIGHT

I do not want to mess up my product_type_layout but I do want to recreate the same results in my live site.

Can I please get some help on what my INSERT INTO product_type_layout sql patch should be?

THANK YOU!

Q: Is it best to leave configuration_id as ''

INSERT INTO product_type_layout (configuration_id, configuration_title, configuration_key, configuration_value, configuration_description, product_type_id, sort_order, last_modified, date_added, use_function, set_function) VALUES

VALUES (NULL, 'Show Notes', 'SHOW_PRODUCT_INFO_NOTES', '1', 'Show product Notes on product info page 0= off 1= on?', 1, 17, NULL, NOW(), NULL, 'zen_cfg_select_drop_down(array(array('id'=>'1', 'text'=>'True'), array('id'=>'0', 'text'=>'False')),');

Q: do I have this part correct?
'zen_cfg_select_drop_down(array(array('id'=>'1', 'text'=>'True'), array('id'=>'0', 'text'=>'False')),'
It seems like too many "(". Should I be missing a ")"?

Q: Would it be best doing an SQL patch directly though admin, or better to download a CSV export of product_type_layout, insert rows of my new fields, renumber the configuration_id, set the sort (17, 18, 19, etc for each new field/row in csv), then import it back?

21 Jul 2014, 2:10 AM
#20
stiggybaby avatar

stiggybaby

New Zenner

Join Date:
Apr 2011
Posts:
91
Plugin Contributions:
0

Re: New / Custom Extra Product Fields

Well, since there have been no replies, and I'm basically without assistance, I figured the least likely way for me to goof would be to export the product_type_layout as csv, open in open office, insert rows, copy and paste a good row, then change it to my new field, then import it back over itself.

Everything seems to work... no errors, I can turn off and on the extra fields on the product info page.

Is there any problems that I will run into by doing this this way???

Thx

(PS I found all of the above to be easier to figure out than the numinix plugin)