Adding related listings to listing detail page

From JReviews Documentation
Revision as of 23:36, 28 October 2009 by Jreviews (Talk | contribs) (Created page with 'You can add a Related listings "module" to your listing detail page to display related listings based on a common custom field. This is a hack of the Listings Module. The c…')

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

You can add a Related listings "module" to your listing detail page to display related listings based on a common custom field. This is a hack of the Listings Module.


The code you need to enter in detail.thtml file to display related listings is:

<?php echo $this->element('related_listings',array('field'=>'jr_name','suffix'=>''));?>

Replace jr_name with the name of your custom field.


Example:

For a hotel/restaurant listings, you can use jr_city custom field to display related listings based on City:

<h2>Related Listings</h2>
<?php echo $this->element('related_listings',array('field'=>'jr_city','suffix'=>''));?>

When viewing a certain New York listing, the above code will display the related New York listings:

RelatedListings.png


Customizations

To change the settings of the module, modify this file:

  • \com_jreviews\jreviews\views\themes\default\elements\related_listings.thtml


Since Related listings module is a hack of a Listings module, it uses the same theme file:

  • \com_jreviews\jreviews\views\themes\default\modules\listings.thtml


To modify the file for the Related module only, create a copy and add a suffix to the file, for example: listings_related.thtml

To use that file add '_related' suffix into the code:

<?php echo $this->element('related_listings',array('field'=>'jr_name','suffix'=>'_related'));?>