[ic] Foundation Store -> New Fields

Dan Browning interchange-users@icdevgroup.org
Wed Aug 7 12:50:00 2002


At 01:08 AM 8/7/2002 -0400, you wrote:
>Hi,
>
>I've been customizing the foundation store and read in the catalog
>building tutorial (section 5.1) where new fields/colums may be added. I
>added about 6 fields/columns and provided names I thought would unlikely
>conflict with any variables etc (ie: feat1, feat2 etc) but could not
>import the table!? (I had the proper TAB delimited format because I've
>done this several times).
>
>I get an admin error like this:
>
>FATAL error
>
>There is no column named 'feat1' at
>/usr/local/cpanel/3rdparty/interchange/lib/Vend/Table/Common.pm line
>232,  line 1.
>
>Can anyone shed any light on this error msg? How can I fix this? I'd
>really like to customize my flypage.html and add the additional
>information in these fields.

"Modifying Tables" by Corey Gilmore is attached.

+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Dan Browning, Kavod Technologies <db@kavod.com>
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Disco is to music what Etch-A-Sketch is to art.



Using IC 4.6.5, when I want to add a new column to the products database,
I do this:

Load mysql, add a new column.

ALTER TABLE products ADD COLUMN prod_summary varchar(255);

The column is now in the database.

Edit catalogdir/catalog/dbconf/mysql/products.mysql

It should look something like
# MiniVend database definition
Database  products  products.txt __SQLDSN__
#ifdef SQLUSER
Database  products  USER         __SQLUSER__
#endif
#ifdef SQLPASS
Database  products  PASS         __SQLPASS__
#endif
Database  products  KEY          sku
...

We need to add our new column to this list
Add
Database  products  COLUMN_DEF   "prod_summary=(VARCHAR255)"
to the end of the file, save changes and close.

Here, I Apply Changes within the Admin UI.  This may not be necessary, but
doesn't seem to hurt.

I jump over to the Admin UI, and goto the Administration section.
Choose Knar and edit the variable table (default).

Search for the UI_ITEM_FIELDS variable.

It will resemble
sku description comment category type image display price nontaxable 
related featured required inactive weight shipping

These fields are the ones that are shown when you edit/create a product.
If you only wanted to view/edit the sku, description, comment and category
you would just add those fields.

The order the column names appear in the UI_ITEM_FIELDS variable
determines the order they will appear in when an Item is edited.

Add prod_summary (our new column name) where ever you want it to show.
Lets put it after comment.

sku description comment prod_summary category type image display price 
nontaxable related  featured required inactive weight shipping

Click OK.  Now to synchronize the products.txt with the database, you need
to export.


Goto Tables in the Admin UI, and export the products table using the
default settings.  I Apply Changes once more here.

Now go and edit an item.  The new field prod_summary will appear.  Click
'meta' and you can edit your display settings.

I've found (with 4.6.5) that after I edit the meta for the field, it
returns me to the previous page - without any other fields.  I click OK
until I return to the main Items page, and THEN the meta information is
saved.

This is a little rough, and some of the information may be extraneous,
but I have finance homework due in 30 minutes ;)

.cfg