PDA

View Full Version : price in short form in Auto Template



Attieh Almatrafi
August 7, 2011, 01:50 PM
I want to know the variable to display the price in the short form below model.
I've seen to show the ad published sampler takes the following code:



<tr>
<td align="{$text_dir_rev}"><span class="field">{$lang.added}:</span></td>
<td align="{$text_dir}"><span class="value">{$listing.Date|date_format:$smarty.const.RL_DATE_F ORMAT}</span></td>
</tr>


So I imagine that similar lake could put the price, but not variables.

greetings
Javier S.L.

Mike
September 13, 2011, 11:53 AM
Hello,

If you want to put just price (i mean no other fields in future you can do next).


open includes/classes/rlListings.class.php

find function getListings (for browse pages)


foreach ( $listings as $key => $value )
{
$items = $category_fields[$category]['fields'];

$first = 1;

foreach ($items as $item => $val)
{
$field = $category_fields[$category]['fields'][$item];

if ($first != 1)
{
$field['value'] = $GLOBALS['rlCommon'] -> adaptValue( $field, $listings[$key][$item], 'listing', $listings[$key]['ID'] );
}
else
{
if ( $field['Condition'] == 'isUrl' || $field['Condition'] == 'isEmail' )
{
$field['value'] = $listings[$key][$item];
}
else
{
$field['value'] = $GLOBALS['rlCommon'] -> adaptValue( $field, $listings[$key][$item], 'listing', $listings[$key]['ID'] );
}
}
/*add this*/
if( $field['Key'] == 'price' )
{
$listings[$key]['price'] = $field['value'];
}
/*end*/
$listings[$key]['fields'][] = $field;

$first++;
}

$listings[$key]['listing_title'] = $this -> getListingTitle( $category, $listings[$key] );
}

you have to make same changes to the rlSearch.class.php - function search if you want the same for search results


make sure that price is the right key of your price field (can be lf_price)


then you can add


<tr>
<td align="{$text_dir_rev}"><span class="field">{$lang.price}:</span></td>
<td align="{$text_dir}"><span class="value">{$listing.price}</span></td>
</tr>

to templates/your_templates/blocks/listing.tpl