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
or
!!
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></td>
<td>
<input type="radio" name="CONDITION" value="New" class="radio"$checked{'New'}>
<b>$txt{'New'}</b>
<input type="radio" name="CONDITION" value="Used" class="radio"$checked{'Used'}>
<b>$txt{'Used'}</b>
<input type="radio" name="CONDITION" value="Antique" class="radio"$checked{'Antique'}>
<b>$txt{'Antique'}</b>
</td>
</tr>
<tr class="mask">
<td valign="top"><b>$txt{'Payment'}:<br></td>
<td>
<input type="checkbox" name="PAYMENT1" value="Cash" class="checkbox"$checked{'Cash'}>
<b>$txt{'Cash'}</b>
<input type="checkbox" name="PAYMENT2" value="PayPal" class="checkbox"$checked{'PayPal'}>
<b>PayPal</b>
<input type="checkbox" name="PAYMENT3" value="Check" class="checkbox"$checked{'Check'}>
<b>$txt{'Check'}</b>
<input type="checkbox" name="PAYMENT4" value="Money Order" class="checkbox"$checked{'Money Order'}>
<b>$txt{'Money Order'}</b>
<input type="checkbox" name="PAYMENT5" value="On Delivery" class="checkbox"$checked{'On Delivery'}>
<b>$txt{'On Delivery'}</b>
</td>
</tr>
_____________
Repace with:
-------------
<tr class="mask">
<td valign="top"><b>$txt{'Condition'}:<br></td>
<td>
<input type="radio" name="CONDITION" value="New" class="radio"$checked{'New'}>
<b>$txt{'New'}</b>
<input type="radio" name="CONDITION" value="Used" class="radio"$checked{'Used'}>
<b>$txt{'Used'}</b>
<input type="radio" name="CONDITION" value="Antique" class="radio"$checked{'Antique'}>
<b>$txt{'Antique'}</b>
</td>
</tr>
<tr class="mask">
<td valign="top"><b>$txt{'Color'}:<br></td>
<td>
<input type="radio" name="COLOR" value="Red" class="radio"$checked{'Red'}>
<b>$txt{'Red'}</b>
<input type="radio" name="COLOR" value="Blue" class="radio"$checked{'Blue'}>
<b>$txt{'Blue'}</b>
<input type="radio" name="COLOR" value="Green" class="radio"$checked{'Green'}>
<b>$txt{'Green'}</b>
</td>
</tr>
<tr class="mask">
<td valign="top"><b>$txt{'Test'}:<br></td>
<td>
<input type="checkbox" name="TEST1" value="t1" class="checkbox"$checked{'t1'}>
<b>$txt{'t1'}</b>
<input type="checkbox" name="TEST2" value="t2" class="checkbox"$checked{'t2'}>
<b>$txt{'t2'}</b>
<input type="checkbox" name="TEST3" value="t3" class="checkbox"$checked{'t3'}>
<b>$txt{'t3'}</b>
<input type="checkbox" name="TEST4" value="t4" class="checkbox"$checked{'t4'}>
<b>$txt{'t4'}</b>
<input type="checkbox" name="TEST5" value="t5" class="checkbox"$checked{'t5'}>
<b>$txt{'t5'}</b>
</td>
</tr>
<tr class="mask">
<td valign="top"><b>$txt{'Axes'}:<br></td>
<td>
<select name="AXES"> selected
<option value="1" selected>1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select>
</td>
</tr>
<tr class="mask">
<td valign="top"><b>$txt{'Payment'}:<br></td>
<td>
<input type="checkbox" name="PAYMENT1" value="Cash" class="checkbox"$checked{'Cash'}>
<b>$txt{'Cash'}</b>
<input type="checkbox" name="PAYMENT2" value="PayPal" class="checkbox"$checked{'PayPal'}>
<b>PayPal</b>
<input type="checkbox" name="PAYMENT3" value="Check" class="checkbox"$checked{'Check'}>
<b>$txt{'Check'}</b>
<input type="checkbox" name="PAYMENT4" value="Money Order" class="checkbox"$checked{'Money Order'}>
<b>$txt{'Money Order'}</b>
<input type="checkbox" name="PAYMENT5" value="On Delivery" class="checkbox"$checked{'On Delivery'}>
<b>$txt{'On Delivery'}</b>
</td>
</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'}: </b></td>
<td bgcolor="$config{'colortablebody'}" nowrap><b>$condition</b></td>
</tr>
<tr>
<td bgcolor="$config{'colortablehead'}" nowrap><b>$txt{'Payment'}: </b></td>
<td bgcolor="$config{'colortablebody'}" nowrap><b>$payment</b></td>
</tr>
__________
Change to:
----------
<td bgcolor="$config{'colortablehead'}" nowrap><b>$txt{'Condition'}: </b></td>
<td bgcolor="$config{'colortablebody'}" nowrap><b>$condition</b></td>
</tr>
<tr>
<td bgcolor="$config{'colortablehead'}" nowrap><b>$txt{'Color'}: </b></td>
<td bgcolor="$config{'colortablebody'}" nowrap><b>$color</b></td>
</tr>
<tr>
<td bgcolor="$config{'colortablehead'}" nowrap><b>$txt{'Test'}: </b></td>
<td bgcolor="$config{'colortablebody'}" nowrap><b>$test</b></td>
</tr>
<tr>
<td bgcolor="$config{'colortablehead'}" nowrap><b>$txt{'Axes'}: </b></td>
<td bgcolor="$config{'colortablebody'}" nowrap><b>$axes</b></td>
</tr>
<tr>
<td bgcolor="$config{'colortablehead'}" nowrap><b>$txt{'Payment'}: </b></td>
<td bgcolor="$config{'colortablebody'}" nowrap><b>$payment</b></td>
</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'}:</b></td>
<td bgcolor="$config{'colortablebody'}">$txt{$form{'CONDITION'}}</td>
</tr>
<tr>
<td bgcolor="$config{'colortablehead'}"><b>$txt{'Payment'}:</td>
<td bgcolor="$config{'colortablebody'}" nowrap>$payment</td>
</tr>
Change To:
-----------
<tr>
<td bgcolor="$config{'colortablehead'}"><b>$txt{'Condition'}:</b></td>
<td bgcolor="$config{'colortablebody'}">$txt{$form{'CONDITION'}}</td>
</tr>
<tr>
<td bgcolor="$config{'colortablehead'}"><b>$txt{'Color'}:</b></td>
<td bgcolor="$config{'colortablebody'}">$txt{$form{'COLOR'}}</td>
</tr>
<tr>
<td bgcolor="$config{'colortablehead'}"><b>$txt{'Test'}:</td>
<td bgcolor="$config{'colortablebody'}" nowrap>$test</td>
</tr>
<tr>
<td bgcolor="$config{'colortablehead'}"><b>$txt{'Axes'}:</td>
<td bgcolor="$config{'colortablebody'}" nowrap>$axes</td>
</tr>
<tr>
<td bgcolor="$config{'colortablehead'}"><b>$txt{'Payment'}:</td>
<td bgcolor="$config{'colortablebody'}" nowrap>$payment</td>
</tr>