'How to add additonal text fields to PMR listings' FAQ v.0.1
1.0.7.x
|
| Price: |
USD 0 |
| Module Type: |
Property Record Mods |
| Version: |
1.0.7.x |
| Supported?: |
Yes (free) |
|
Module Description:
|
|
|
Adding additional text fields to PMR listings section
1 First you have to create a new field in pmr_properties table
run this query in your phpMyAdmin form or create simple script to update the database
ALTER TABLE pmr_properties ADD field_name type;
where 'type' can be text or varchar.
NOTE: field_name will be a field name in the properties table and the php variable to use.
2 Edit adduserlistings.php
a) Add new field into the form at the very bottom of this script just where you want it to appear.
echo userform ('Field Name Here', '<input type="text" size="45" name="field_name" value="' . $form['field_name'] . '" maxlength="255">');
b) Add the initial value for this field near $form = array();
add this after the above line:
$form['field_name'] = '';
c) update the sql query:
$sql = 'INSERT INTO '. PROPERTIES_TABLE . ' (field_name, userid, approved, mls, type, style, title, description ....
and the values:
("' . $form['field_name'] . '", ' . $f_res['id'] . ', ' . $approved . ' , "' . $form['mls'] . '", ' . $form['type'] . ', ' . $form['style'] . ',
3 Edit edituserlistings.php
The updates are similar to adduserlistings.php
a) add the same form field as in adduserlistings.php
b) add the initial variable as
$form['field_name'] = $f['field_name'];
c) update the sql query, add this:
$sql = 'UPDATE '. PROPERTIES_TABLE . ' SET mls = "' . $form['mls'] . '", type = "' . $form['type']. '",
to
$sql = 'UPDATE '. PROPERTIES_TABLE . ' SET mls = "' . $form['mls'] . '", field_name = "' . $form['field_name']. '", type = "' . $form['type']. '",
4 Admin Panel changes are absolutely the same as above, edit
/admin/addlistings.php /admin/editlistings.php
5 To include the field into the search, please, edit advsearchform.php
echo userform ('Field Name Here', '<input type="text" size="45" name="field_name" maxlength="255">');
among other fields in the listing search form..
then edit search.php
change
$sql = 'SELECT * from ' . PROPERTIES_TABLE . ' WHERE ';
$sql.= 'approved = 1 ';
if (isset($search['userid']) && !empty($search['userid'])) $sql.= ' AND userid = ' . $search['userid'];
to
$sql = 'SELECT * from ' . PROPERTIES_TABLE . ' WHERE ';
$sql.= 'approved = 1 ';
if (isset($search['userid']) && !empty($search['userid'])) $sql.= ' AND userid = ' . $search['userid'];
if (isset($search['field_name']) && !empty($search['field_name'])) $sql.= ' AND field_name LIKE "%' . $search['field_name'] . '%" ';
the above will search the field_name field for the inserted pattern..
Any questions? Please, contact PMR Support.
(c)2007 PMR LLC.
|
Downloaded / Viewed: 833
Submission Date: 09-24-2007
Last Update: --
|
|
|
|