[ic] Trouble adding user entered fields to orderline.

John Matecsa interchange-users@icdevgroup.org
Sat Feb 8 20:53:00 2003


I'm having trouble adding some fields that the buyer can use to record
which employee or employees each line item is for.

Your ideas about what where I went wrong would be very much appreciated.

The steps I tried follow... 

Step 1:
=======

Added columns to the order-line database:

alter table orderline add employee_number_one varchar(5);
alter table orderline add employee_number_two varchar(5);
alter table orderline add employee_number_three varchar(5);
alter table orderline add employee_number_four varchar(5);
alter table orderline add employee_number_five varchar(5);


Step 2:
=======

Inserted five lines in /etc/log_transaction

status: [scratch status]
description: [filter mac][item-description][/filter]
employee_number_one: [item-modifier mv_employee_number_one]
employee_number_two: [item-modifier mv_employee_number_two]
employee_number_three: [item-modifier mv_employee_number_three]
employee_number_four: [item-modifier mv_employee_number_four]
employee_number_five: [item-modifier mv_employee_number_five]
[/import]


Step 3:
=======

Inserted some more "employee" lines in pages/ord/checkout.html


        [item-list modular=1]

	<TR class="[item-alternate
2]maincontent[else]contentbar1[/else][/item-alternate]">
	  <TD align=center valign=top>
	    <INPUT TYPE=checkbox NAME="[quantity-name]"
onClick="this.form.action='[process-target]', this.form.submit()"
VALUE=0>
 	  </TD>
	  <TD><b>[item-sku]</b></TD>
	  <TD>[page [item-sku]]<b>[item-data products description]</b></a>

	    [if scratch dealer]
	    [if-item-data pricing sku]
	      <BR>[page quantity [item-code]]
	      [LC]QUANTITY PRICING[fr_FR]FIXATION DU PRIX PAR
LOT[/fr_FR][/LC]</A>
 	    [/if-item-data]
	    [/if]

        [if-item-data options o_enable]
            [if-item-data !options o_modular]
                [table-organize cols=4 table=' ' font="size=1" pretty=1]
                    [item-options td=1 label=1 bold=1 price=1]
                [/table-organize]
            [/if-item-data]
        [/if-item-data]

	    [if-item-field weight]
	    [seti weight][summary amount=`[item-quantity] * [item-field
weight]`][/seti]
	    [/if-item-field]
	  </TD>
	  <TD ALIGN=CENTER valign=top>
	    <INPUT TYPE=text NAME="[quantity-name]" VALUE="[item-quantity]"
SIZE=3>
 	  </TD>
	  <TD ALIGN=RIGHT>
             [discount-price]
	    [if discount [item-code]]<BR>[LC]Item is discounted[fr_FR]Article
sans suite[/fr_FR][/LC] [item-discount][/if]
	  </TD>
	  <TD ALIGN=RIGHT>
             [item-subtotal]
          </TD>

	  <TD ALIGN=CENTER valign=top>
	    <INPUT TYPE=text NAME="[mv_employee_number_one]" SIZE=5>
 	  </TD>
	  <TD ALIGN=CENTER valign=top>
	    <INPUT TYPE=text NAME="[mv_employee_number_two]" SIZE=5>
 	  </TD>
	  <TD ALIGN=CENTER valign=top>
	    <INPUT TYPE=text NAME="[mv_employee_number_three]" SIZE=5>
 	  </TD>
	  <TD ALIGN=CENTER valign=top>
	    <INPUT TYPE=text NAME="[mv_employee_number_four]" SIZE=5>
 	  </TD>
	  <TD ALIGN=CENTER valign=top>
	    <INPUT TYPE=text NAME="[mv_employee_number_five]" SIZE=5>
 	  </TD>
        </TR>

        [/item-list]

Step 4:
=======

Restarted the catalog


Step 5:
=======

When I tried it, no "employee" data was recorded in the order line
database.

Step 6:
=======

Reread relevant on-line documentation, tinkered a while, search the mail
list archives, tinkered a while longer, slept on it, tried again,
decided to beg for help.


*** Bonus question. *** What is the best way to reject invalid employee
numbers, such as ones with less that 5 digits.


Many thanks.

-- 
John Matecsa <matecsaj@picassofish.com>
Picasso Fish Corporation