eAuction
  Not just another Perl script
Google
Welcome, Guest. Please Login or Register


If you use eAuction a lot and like it or if you make money from eAuction or from eAuction-related activities ...
then the project asks you for a donation in favor of the further development.



The forums are protected by
AccessControl
(written by Dieter Werner)
Click here if you want to check your IP against the most important RBLs of the net.
Click here in order to visite the AccessControl forums.


<< Visit the international e Auction Marketplace >>
Buy and sell PC and Consumer Electronic components






  HomeHelpSearchLoginRegister
 



Pages: 1
Tutorial: How to Add New Fields (Read 185 times)
mars
eAuction Expert
Tester
***
Offline

I love Perl

Posts: 149

Tutorial: How to Add New Fields
09/08/05 at 04:10:19
 
A TUTORIAL FOR ADDING ADDITIONAL FIELDS::
A RADIO BUTTON ($color)
A CHECKBOX ($test )
A SELECT MENU ($axes)

Wednesday 07, 2005
For:  eAuction162 Beta
===============================================

Demo at:
Multimedia file viewing and clickable links are available for registered members only!!  You need to Login or Register!!


Register and add your own record(s)
===============================================

current demo version has an additional radio button set added ($color) &, check box ($test) array
and a select drop-down menu ($axes).
=====================================================================
- Plan where you want your new fields to be in the New Item Form
- Where in the sequence you write the data in is where in the sequence  that the program pulls it out to display. This is very important.
- In this example the radio button ($color) and the checkbox ($test) and select drop-down  menu ($axes)  $condition and  $payment.
- It is vitally important that the sequence must be respected in all code modifications except in the HTML areas.
- All code is case sensitive so be careful.
- Make sure to add the new text to your  eAlanguage.pl  file.
========================================================================

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

eAget_new_item.pl

# START CODE BLOCK MODIFICATIONS:
#  "place" new variables that represent your new fields: $color and $test and $axes and @test
#  because test is a checkbox it is coded as an array so needs to be "placed" 2 times

Search For:
----------

   my (
       $title, $desc, $start_time, $close_time, $addr1, $addr2, $addr3,
       $phone, $fax, $email, $status, $cat, $key, $img_info, $item_info,
       $location, $condition, $payment, $featured,
       @checked, @test, @payment, @featured, @image
   );

__________
Change To:
----------  

   my (
       $title, $desc, $start_time, $close_time, $addr1, $addr2, $addr3,
       $phone, $fax, $email, $status, $cat, $key, $img_info, $item_info,
       $location, $condition, $color, $test, $axes, $payment, $featured,
       @checked, @test, @payment, @featured, @image
   );

   
# START CODE BLOCK MODIFICATIONS:
#  place new Checked selection OPTIONS for radio buttons (red,blue,green) and checkboxes (t1,t2,t3,t4,t5)  and select menu (1, 2, 3, 4, 5) below  in THE CORRECT SEQUENCE.

Search For:
-----------

my %checked = (
       'New', "",
       'Used', "",
       'Antique', "",          
       'Cash', "",
       'PayPal', "",
       'Check', "",
       'Money Order', "",
       'On Delivery', "",
       'top_pic', "",
       'top_list', "",
       'cat_pic', "",
       'cat_list', "",
   );

______________
Change To:
--------------

my %checked = (
       'New', "",
       'Used', "",
       'Antique', "",        
       'Red', "",
       'Blue', "",
       'Green', "",      
       't1', "",
       't2', "",
       't3', "",
       't4', "",
       't5', "",
       '1', "",
       '2', "",
       '3', "",
       '4', "",
       '5', "",    
       'Cash', "",
       'PayPal', "",
       'Check', "",
       'Money Order', "",
       'On Delivery', "",
       'top_pic', "",
       'top_list', "",
       'cat_pic', "",
       'cat_list', "",
   );

   
# START CODE BLOCK MODIFICATIONS:
#  place new variables that represent your new fields  in THE CORRECT SEQUENCE
#  @test = split /\:\:\:/, $test; is for checkboxes only


Search for both occurrences of:
-------------------------------

                       (
                   $location,
                   $condition,
                   $payment,
                   $featured
               ) = split /\|\|/, $item_info;
               
               @featured = split /\:\:\:/, $featured;

_______________________________
change each  occurrence to to:
-------------------------------

                       (
                   $location,
                   $condition,
                   $color,
                   $test,
                   $axes,
                   $payment,
                   $featured
               ) = split /\|\|/, $item_info;
               
               @test = split /\:\:\:/, $test;
               @payment = split /\:\:\:/, $payment;
               @featured = split /\:\:\:/, $featured;


# START CODE BLOCK MODIFICATIONS:
#  Indicate the default checked option for radio buttons, checkboxes and select menu in THE CORRECT SEQUENCE
#  in this case it is Red for the color Radio Buttons and t1 for the test CheckBox and 1 for axes.

Search for:
-----------

   $condition
       ?   ($checked{$condition} = ' checked')
       :   ($checked{'New'} = ' checked');
       
   $payment
       ?   do { ($checked{$_} = ' checked') foreach @payment }
       :   ($checked{'Cash'} = ' checked');    
   
   $featured && do { ($checked{$_} = ' checked') foreach @featured };

__________
Change to:
----------

   $condition
       ?   ($checked{$condition} = ' checked')
       :   ($checked{'New'} = ' checked');
 
   $color
       ?   ($checked{$color} = ' checked')
       :   ($checked{'Red'} = ' checked');
               
   $test
       ?   do { ($checked{$_} = ' checked') foreach @test }
       :   ($checked{'t1'} = ' checked');  
       
   $axes
       ?   ($checked{$axes} = ' checked')
       :   ($checked{'1'} = ' checked');
       
   $payment
       ?   do { ($checked{$_} = ' checked') foreach @payment }
       :   ($checked{'Cash'} = ' checked');    
   
   $featured && do { ($checked{$_} = ' checked') foreach @featured };


# START CODE BLOCK MODIFICATIONS:
#  This is the HTML code section and you can place your new fields wherever you like.
#  But I suggest you place them (for now) in the same sequence you have been maintaining, between condition and payment.

Search for:
----------

           <tr class="mask">
               <td valign="top"><b>$txt{'Condition'}:<br>&lt;/td>
               <td>
                   <input type="radio" name="CONDITION" value="New" class="radio"$checked{'New'}>
                   <b>$txt{'New'}&lt;/b>
                   <input type="radio" name="CONDITION" value="Used" class="radio"$checked{'Used'}>
                   <b>$txt{'Used'}&lt;/b>
                   <input type="radio" name="CONDITION" value="Antique" class="radio"$checked{'Antique'}>
                   <b>$txt{'Antique'}&lt;/b>
               &lt;/td>
               &lt;/tr>
                <tr class="mask">
               <td valign="top"><b>$txt{'Payment'}:<br>&lt;/td>
               <td>
                   <input type="checkbox" name="PAYMENT1" value="Cash" class="checkbox"$checked{'Cash'}>
                   <b>$txt{'Cash'}&lt;/b>
                   <input type="checkbox" name="PAYMENT2" value="PayPal" class="checkbox"$checked{'PayPal'}>
                   <b>PayPal&lt;/b>
                   <input type="checkbox" name="PAYMENT3" value="Check" class="checkbox"$checked{'Check'}>
                   <b>$txt{'Check'}&lt;/b>
                   <input type="checkbox" name="PAYMENT4" value="Money Order" class="checkbox"$checked{'Money Order'}>
                   <b>$txt{'Money Order'}&lt;/b>
                   <input type="checkbox" name="PAYMENT5" value="On Delivery" class="checkbox"$checked{'On Delivery'}>
                   <b>$txt{'On Delivery'}&lt;/b>
               &lt;/td>
           &lt;/tr>


_____________
Repace with:
-------------

<tr class="mask">
               <td valign="top"><b>$txt{'Condition'}:<br>&lt;/td>
               <td>
                   <input type="radio" name="CONDITION" value="New" class="radio"$checked{'New'}>
                   <b>$txt{'New'}&lt;/b>
                   <input type="radio" name="CONDITION" value="Used" class="radio"$checked{'Used'}>
                   <b>$txt{'Used'}&lt;/b>
                   <input type="radio" name="CONDITION" value="Antique" class="radio"$checked{'Antique'}>
                   <b>$txt{'Antique'}&lt;/b>
               &lt;/td>
               &lt;/tr>

           <tr class="mask">
               <td valign="top"><b>$txt{'Color'}:<br>&lt;/td>
               <td>
                   <input type="radio" name="COLOR" value="Red" class="radio"$checked{'Red'}>
                   <b>$txt{'Red'}&lt;/b>
                   <input type="radio" name="COLOR" value="Blue" class="radio"$checked{'Blue'}>
                   <b>$txt{'Blue'}&lt;/b>
                   <input type="radio" name="COLOR" value="Green" class="radio"$checked{'Green'}>
                   <b>$txt{'Green'}&lt;/b>
               &lt;/td>
           &lt;/tr>
           
           <tr class="mask">
               <td valign="top"><b>$txt{'Test'}:<br>&lt;/td>
               <td>
                   <input type="checkbox" name="TEST1" value="t1" class="checkbox"$checked{'t1'}>
                   <b>$txt{'t1'}&lt;/b>
                   <input type="checkbox" name="TEST2" value="t2" class="checkbox"$checked{'t2'}>
                   <b>$txt{'t2'}&lt;/b>
                   <input type="checkbox" name="TEST3" value="t3" class="checkbox"$checked{'t3'}>
                   <b>$txt{'t3'}&lt;/b>
                   <input type="checkbox" name="TEST4" value="t4" class="checkbox"$checked{'t4'}>
                   <b>$txt{'t4'}&lt;/b>
                   <input type="checkbox" name="TEST5" value="t5" class="checkbox"$checked{'t5'}>
                   <b>$txt{'t5'}&lt;/b>
               &lt;/td>
           &lt;/tr>

           <tr class="mask">
               <td valign="top"><b>$txt{'Axes'}:<br>&lt;/td>
               <td>
                   <select name="AXES"> selected
                             <option value="1" selected>1&lt;/option>
                             <option value="2">2&lt;/option>
                             <option value="3">3&lt;/option>
                             <option value="4">4&lt;/option>
                             <option value="5">5&lt;/option>
                             &lt;/select>
               &lt;/td>
           &lt;/tr>
   
           <tr class="mask">
               <td valign="top"><b>$txt{'Payment'}:<br>&lt;/td>
               <td>
                   <input type="checkbox" name="PAYMENT1" value="Cash" class="checkbox"$checked{'Cash'}>
                   <b>$txt{'Cash'}&lt;/b>
                   <input type="checkbox" name="PAYMENT2" value="PayPal" class="checkbox"$checked{'PayPal'}>
                   <b>PayPal&lt;/b>
                   <input type="checkbox" name="PAYMENT3" value="Check" class="checkbox"$checked{'Check'}>
                   <b>$txt{'Check'}&lt;/b>
                   <input type="checkbox" name="PAYMENT4" value="Money Order" class="checkbox"$checked{'Money Order'}>
                   <b>$txt{'Money Order'}&lt;/b>
                   <input type="checkbox" name="PAYMENT5" value="On Delivery" class="checkbox"$checked{'On Delivery'}>
                   <b>$txt{'On Delivery'}&lt;/b>
               &lt;/td>
           &lt;/tr>

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

eAdisp_item.pl

# START CODE BLOCK MODIFICATIONS:
#  place new variables that represent your new fields in their CORRECT SEQUENCE that you started above


Locate:
--------

   my (
       $title, $reserve, $inc, $desc, $image, $close_time, $start_time,
       $alias, $high_bidder, $status, $email, $bid, $what_bid, $time,
       $last_bid, $high_bid, $last_time, $img_info, $enl_image,
       $reserve_info, $rating_info, $lowest_new_bid, $message,
       $html_description, $aftermin, $clicks, $row, $rowcolor,
       $itm_record, $rated, $buy_it, $item_info, $location,
       $condition, $payment,
       @nowtime, @closetime, @bids, @image, @test,
       @payment, @temp
   );


__________
Change to:
----------

my (
       $title, $reserve, $inc, $desc, $image, $close_time, $start_time,
       $alias, $high_bidder, $status, $email, $bid, $what_bid, $time,
       $last_bid, $high_bid, $last_time, $img_info, $enl_image,
       $reserve_info, $rating_info, $lowest_new_bid, $message,
       $html_description, $aftermin, $clicks, $row, $rowcolor,
       $itm_record, $rated, $buy_it, $item_info, $location,
       $condition, $color, $test, $axes, $payment,
       @nowtime, @closetime, @bids, @image, @test,
       @payment, @temp
   );

   
 
# START CODE BLOCK MODIFICATIONS:
#  place new variables that represent your new fields in their CORRECT SEQUENCE that you started above
#  $color = $txt{$color};  is for radio buttons only
#  @test = split /\:\:\:/, $test;  is for checkboxes only


Search for:
------------

  $high_bid = $last_bid;        
   
   (
       $location,
       $condition,
       $payment
   ) = split /\|\|/, $item_info;
   
   $condition = $txt{$condition};
   
   @payment = split /\:\:\:/, $payment;
   
   $#payment >= 1
       ?   do {
               (push @temp, $txt{$_}) foreach @payment;
               $payment = join ', ', @temp;
                @temp = ();
           }
       :   ($payment = $txt{$payment});

   $#bids == 0 && ($last_time = $start_time);


__________
Change to:
----------
  $high_bid = $last_bid;        
   
   (
       $location,
       $condition,
       $color,
       $axes,
       $test,
       $payment
   ) = split /\|\|/, $item_info;
   
   $condition = $txt{$condition};
   $color = $txt{$color};
   
   @test = split /\:\:\:/, $test;
   
   $#test >= 1
       ?   do {
               (push @temp, $txt{$_}) foreach @test;
               $test = join ', ', @temp;
                         @temp = ();
           }
       :   ($test = $txt{$test});
       
   
   @payment = split /\:\:\:/, $payment;
   
   $#payment >= 1
       ?   do {
               (push @temp, $txt{$_}) foreach @payment;
               $payment = join ', ', @temp;
                @temp = ();
           }
       :   ($payment = $txt{$payment});

   $#bids == 0 && ($last_time = $start_time);


# START CODE BLOCK MODIFICATIONS:
#  This is the HTML code section and you can place your new fields wherever you like.
#  Again I suggest you place them (for now) in the same sequence you have been maintaining, between condition and payment.

Search for:
----------
<td bgcolor="$config{'colortablehead'}" nowrap><b>$txt{'Condition'}: &lt;/b>&lt;/td>
<td bgcolor="$config{'colortablebody'}" nowrap><b>$condition&lt;/b>&lt;/td>
 &lt;/tr>
<tr>
<td bgcolor="$config{'colortablehead'}" nowrap><b>$txt{'Payment'}: &lt;/b>&lt;/td>
<td bgcolor="$config{'colortablebody'}" nowrap><b>$payment&lt;/b>&lt;/td>
&lt;/tr>

__________
Change to:
----------
<td bgcolor="$config{'colortablehead'}" nowrap><b>$txt{'Condition'}: &lt;/b>&lt;/td>
<td bgcolor="$config{'colortablebody'}" nowrap><b>$condition&lt;/b>&lt;/td>
&lt;/tr>
<tr>
<td bgcolor="$config{'colortablehead'}" nowrap><b>$txt{'Color'}: &lt;/b>&lt;/td>
<td bgcolor="$config{'colortablebody'}" nowrap><b>$color&lt;/b>&lt;/td>
&lt;/tr>
                   
<tr>
<td bgcolor="$config{'colortablehead'}" nowrap><b>$txt{'Test'}: &lt;/b>&lt;/td>
<td bgcolor="$config{'colortablebody'}" nowrap><b>$test&lt;/b>&lt;/td>
&lt;/tr>  

<tr>
<td bgcolor="$config{'colortablehead'}" nowrap><b>$txt{'Axes'}: &lt;/b>&lt;/td>
<td bgcolor="$config{'colortablebody'}" nowrap><b>$axes&lt;/b>&lt;/td>
&lt;/tr>
<tr>
<td bgcolor="$config{'colortablehead'}" nowrap><b>$txt{'Payment'}: &lt;/b>&lt;/td>
<td bgcolor="$config{'colortablebody'}" nowrap><b>$payment&lt;/b>&lt;/td>
&lt;/tr>

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

eAproc_new_item.pl

# START CODE BLOCK MODIFICATIONS:
#  place new variables that represent your new fields in their CORRECT SEQUENCE that you started above

Locate:
--------

   my (
       $password, $key, $img_info, $item_number, $start_time,
       $close_time, $nowtime, $bid, $buy_it, $reserve, $inc,
       $seller_data, $user_items, $html_description, $flag,
       $payment, $featured, $item_info,
       @nowtime, @starttime, @closetime, @user_items,
       @image, @payment, @featured, @temp
   );


__________
Change to:
----------

   my (
       $password, $key, $img_info, $item_number, $start_time,
       $close_time, $nowtime, $bid, $buy_it, $reserve, $inc,
       $seller_data, $user_items, $html_description, $flag,
       $test, $payment, $featured, $item_info,
       @nowtime, @starttime, @closetime, @user_items,
       @image, @test, @payment, @featured, @temp
   );

# START CODE BLOCK MODIFICATIONS:
# this section is concerned with the  $form additions
#  place new variables that represent your new fields in their CORRECT SEQUENCE that you started above
#  for adding a CheckBoxes it is the next 2 lines
#    (exists $form{"TEST$_"} && push @test, $form{"TEST$_"}) for 1 .. 6;
#    $test = join ':::', @test;
#   the for 1 .. 5;  is what you would use if you have 4 checkboxes the user can select
#   the for 1 .. 6;  is what you would use if you have 5 checkboxes the user can select --- and so on
#  for adding a Radio button set and a select menu it is simply to place  
   $form{'COLOR'} and $form{'AXES '}in the correct sequence


Search For:
------------
   (exists $form{"PAYMENT$_"} && push @payment, $form{"PAYMENT$_"}) for 1 .. 6;
   $payment = join ':::', @payment;
   (exists $form{"FEATURED$_"} && push @featured, $form{"FEATURED$_"}) for 1 .. 5;
   $featured = join ':::', @featured;
   
   $item_info = join '||', (
       $form{'LOCATION'},
       $form{'CONDITION'},
       $payment,
       $featured
   );

___________
Change To:
-----------

   (exists $form{"TEST$_"} && push @test, $form{"TEST$_"}) for 1 .. 6;
   $test = join ':::', @test;
   (exists $form{"PAYMENT$_"} && push @payment, $form{"PAYMENT$_"}) for 1 .. 6;
   $payment = join ':::', @payment;
   (exists $form{"FEATURED$_"} && push @featured, $form{"FEATURED$_"}) for 1 .. 5;
   $featured = join ':::', @featured;
   
   $item_info = join '||', (
       $form{'LOCATION'},
       $form{'CONDITION'},
       $form{'COLOR'},
       $form{'AXES'},
       $test,
       $payment,
       $featured
   );
   

# START CODE BLOCK MODIFICATIONS:
#  Because I placed the additional  $test  checkbox before another checkbox ($payment) I need to prevent the "inheriting" of  checked options.
#   to avoid  'pushing' the content of @test into @temp and pushing the content of @payment into @temp too
#   make sure you add      @temp = (); needs to $test and any additional checkbox variables you add.


Search For:
-------------

$html_description = enable_html($form{'DESC'});
$bid = parse_amt($form{'BID'});
$buy_it = parse_amt($form{'BUY_IT'});
$inc = parse_amt($form{'INC'});
$reserve = parse_amt($form{'RESERVE'});            
           
(push @temp, $txt{$_}) foreach @payment;
$payment = join ', ', @temp;

@temp = ();


____________
Change To:
------------

$html_description = enable_html($form{'DESC'});
$bid = parse_amt($form{'BID'});
$buy_it = parse_amt($form{'BUY_IT'});
$inc = parse_amt($form{'INC'});
$reserve = parse_amt($form{'RESERVE'});            
           
(push @temp, $txt{$_}) foreach @test;
$test = join ', ', @temp;

@temp = ();
           
(push @temp, $txt{$_}) foreach @payment;
$payment = join ', ', @temp;

@temp = ();


# START CODE BLOCK MODIFICATIONS:
#  This is the HTML code section and you can place your new fields wherever you like.
#  Again I suggest you place them (for now) in the same sequence you have been maintaining, between condition and payment.

Search For:
-----------

<tr>
<td bgcolor="$config&;anch=123;'colortablehead'}"><b>$txt{'Condition'}:&lt;/b>&lt;/td>
<td bgcolor="$config{'colortablebody'}">$txt{$form{'CONDITION'}}&lt;/td>
&lt;/tr>                            
<tr>
<td bgcolor="$config{'colortablehead'}"><b>$txt{'Payment'}:&lt;/td>
<td bgcolor="$config{'colortablebody'}" nowrap>$payment&lt;/td>
&lt;/tr>


Change To:
-----------
<tr>
<td bgcolor="$config{'colortablehead'}"><b>$txt{'Condition'}:&lt;/b>&lt;/td>
<td bgcolor="$config{'colortablebody'}">$txt{$form{'CONDITION'}}&lt;/td>
&lt;/tr>
<tr>
<td bgcolor="$config{'colortablehead'}"><b>$txt{'Color'}:&lt;/b>&lt;/td>
<td bgcolor="$config{'colortablebody'}">$txt{$form{'COLOR'}}&lt;/td>
&lt;/tr>                            
<tr>
<td bgcolor="$config{'colortablehead'}"><b>$txt{'Test'}:&lt;/td>
<td bgcolor="$config{'colortablebody'}" nowrap>$test&lt;/td>
&lt;/tr>
<tr>
<td bgcolor="$config{'colortablehead'}"><b>$txt{'Axes'}:&lt;/td>
<td bgcolor="$config{'colortablebody'}" nowrap>$axes&lt;/td>
&lt;/tr>                          
<tr>
<td bgcolor="$config{'colortablehead'}"><b>$txt{'Payment'}:&lt;/td>
<td bgcolor="$config{'colortablebody'}" nowrap>$payment&lt;/td>
&lt;/tr>

Back to top
 
« Last Edit: 09/12/05 at 01:54:11 by mars »  


Advertising
View Profile   IP Logged
Pages: 1


If you like eAuction, please Rate it.
If you don't like eAuction, please Rate it too.


1 is being poor and 10 is being excellent


EveryScript

ip-location


AccessControl - Members Only