JReviews Display related listing data in listing detail’s page using banner fields.

JReviews Display related listing data in listing detail’s page using banner fields.

To display related listing data in listing detail page we can use banner field.
Steps
(1) Go to jreviews and click on “field mananger”.
(2) Add new field with the type “banner field”.
(3) Give the name of related listing field in the “Banner code” box on the irhgt side.
(4) Write the code given below in the “PHP Based Formatting” box given at the bottom.

$fieldName=’jr_lstfieldspieleentwickler’; // the field needed to show in listing detail page
$myRelatedListing=’jr_lstfieldtestspiel’; // related listing feld
$title=’Entwickler’;

$rListing = $CustomFields->fieldValue($myRelatedListing,$entry);
if(!empty($rListing))
{
$relatedListing= $CustomFields->fieldValue($myRelatedListing,$entry);
$l=explode(‘id=’,$relatedListing);

$id=explode(‘:’,$l[1]);

$DB->setQuery(“select type,fieldid from #__jreviews_fields where name=’$fieldName'”);
$results = $DB->loadRow();
if($results[0]==’relatedlisting’)
{
$fieldID=$results[1];
$DB->setQuery(“select replace(SUBSTRING($fieldName, 2, LENGTH($fieldName)-2),’*’,’,’) from #__jreviews_content where contentid=$id[0]”);
$results = $DB->loadRow();

$DB->setQuery(“select title from #__content where id in ($results[0])”);
$results = $DB->loadObjectList();
$value=”;
foreach($results as $k=>$v)
{
$value=$value.’,’.$v->title;
}

 

return “<div>”.$title.”- “.substr($value,1,strlen($value)).”</div>”;
}
else
{

$DB->setQuery(“select $fieldName from #__jreviews_content where contentid=$id[0]”);
$results = $DB->loadRow();

return “<div>”.$title.”- “.$results[0].”</div>”;
}

}

Latest Blogs