Difference between revisions of "Adding related listings to listing detail page"
(→Customizations) |
|||
Line 27: | Line 27: | ||
== Customizations == | == Customizations == | ||
− | To | + | To see the different settings that can be passed in the related listings call, view this file: |
*<span style="color: blue">\com_jreviews\jreviews\views\themes\default\elements\related_listings.thtml</span> | *<span style="color: blue">\com_jreviews\jreviews\views\themes\default\elements\related_listings.thtml</span> | ||
− | + | Since Related listings module is an extension of the Listings module, it uses the same theme file: | |
− | Since Related listings module is | + | |
*<span style="color: blue">\com_jreviews\jreviews\views\themes\default\modules\listings.thtml</span> | *<span style="color: blue">\com_jreviews\jreviews\views\themes\default\modules\listings.thtml</span> | ||
− | + | ===Modifying the related listings theme file=== | |
− | To use that | + | To modify the theme for related listings output only, create a copy and add a suffix to the file, for example: <span style="color: blue">listings_related.thtml</span> |
+ | |||
+ | To use that theme add '_related' suffix into the code: | ||
<source lang="php"> | <source lang="php"> | ||
<?php echo $this->element('related_listings',array('field'=>'jr_name','suffix'=>'_related'));?> | <?php echo $this->element('related_listings',array('field'=>'jr_name','suffix'=>'_related'));?> | ||
Line 45: | Line 46: | ||
[[Category:Themes]] | [[Category:Themes]] | ||
[[Category:Listing Detail Page]] | [[Category:Listing Detail Page]] | ||
+ | |||
+ | ===Passing additional settings to the related listings call=== | ||
+ | |||
+ | Additional settings can be passed in 2nd parameter array of the $this->element class method. | ||
+ | |||
+ | ====Limiting results to a single category==== | ||
+ | |||
+ | <source lang="php"> | ||
+ | <?php echo $this->element('related_listings',array('field'=>'jr_name','category'=>'10'));?> | ||
+ | </source> | ||
+ | |||
+ | ====Limiting results to several categories==== | ||
+ | |||
+ | <source lang="php"> | ||
+ | <?php echo $this->element('related_listings',array('field'=>'jr_name','category'=>'10,11,12'));?> | ||
+ | </source> | ||
+ | |||
+ | ====Changing the size of the thumbnail==== | ||
+ | |||
+ | <source lang="php"> | ||
+ | <?php echo $this->element('related_listings',array('field'=>'jr_name','tn_width'=>'200'));?> | ||
+ | </source> | ||
+ | |||
+ | ====Enabling ajax pagination==== | ||
+ | |||
+ | <source lang="php"> | ||
+ | <?php echo $this->element('related_listings',array('field'=>'jr_name','ajax'=>1));?> | ||
+ | </source> | ||
+ | |||
+ | ====Changing the number of listings and columns==== | ||
+ | |||
+ | <source lang="php"> | ||
+ | <?php echo $this->element('related_listings',array('field'=>'jr_name','module_limit'=>9,'columns'=>3));?> | ||
+ | </source> |
Revision as of 15:19, 15 February 2010
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:
Contents
Customizations
To see the different settings that can be passed in the related listings call, view this file:
- \com_jreviews\jreviews\views\themes\default\elements\related_listings.thtml
Since Related listings module is an extension of the Listings module, it uses the same theme file:
- \com_jreviews\jreviews\views\themes\default\modules\listings.thtml
To modify the theme for related listings output only, create a copy and add a suffix to the file, for example: listings_related.thtml
To use that theme add '_related' suffix into the code:
<?php echo $this->element('related_listings',array('field'=>'jr_name','suffix'=>'_related'));?>
Additional settings can be passed in 2nd parameter array of the $this->element class method.
Limiting results to a single category
<?php echo $this->element('related_listings',array('field'=>'jr_name','category'=>'10'));?>
Limiting results to several categories
<?php echo $this->element('related_listings',array('field'=>'jr_name','category'=>'10,11,12'));?>
Changing the size of the thumbnail
<?php echo $this->element('related_listings',array('field'=>'jr_name','tn_width'=>'200'));?>
Enabling ajax pagination
<?php echo $this->element('related_listings',array('field'=>'jr_name','ajax'=>1));?>
Changing the number of listings and columns
<?php echo $this->element('related_listings',array('field'=>'jr_name','module_limit'=>9,'columns'=>3));?>