Showing Custom Fields in Your Categories Review Listing

Guide by NRyan115

After you install and setup / configure the Simple-Review
component your next question will be “How can I add custom fields?”. This is how in Simple Review 3.0.1 and above

  1. Optional but highly Recommended – especially for sites with multiple categories
    navigate to /components/com_simple_review/templates/ using an FTP
    program. Make a copy of the “default” template folder and rename it to
    something meaningful, for example “customtemplate1” (the name of the template
    should be lowercase)
  2. If you have not already created a category then create one now. Alternatively,
    open a category for editing.
  3. Set the category template to the one created in step #1 (customtemplate1)
  4. Under the heading “Additional Fields” click the “Add a new field” button and create
    as many custom fields as are necessary. For example: Custom Field 1, Custom
    Field 2
  5. Set the Default Review Template to your custom template from step #1
    (customtemplate1)
  6. Create some reviews in your category.
  7. In order to make the custom fields show up on the reviews page the custom fields
    must be in the review template. Open the file for editing: /components/com_simple_review/templates/(customtemplate1)/review/template.html.php
    You can use HTML in the file. If you do not feel comfortable on your own then
    try this: Around line 42 you will see {Review:Body}
    You can insert the following placeholders BEFORE that line:

    
    {Category:Field:1}: {Review:Field:1}<br/>
    {Category:Field:2}: {Review:Field:2}<br/><br/>
    

    Again, you are welcome to edit the file in your own custom way. If you have more
    than 2 custom fields just continue adding placeholders.

  8. If you want your custom fields to show up in the LIST of reviews edit the file /components/com_simple_review/template/customtemplate1/category/template_reviewlisting.html.php

    Around line 101 you will see the following line:

    <table id="reviewListingTable">

    Below this line you will see a list where each line begins with <th>. You
    can remove an entire line if you wish to remove a column from the review list
    and/or add a line to make a new column.
    PLEASE NOTE: This section is only the column HEADINGS. If you add or remove
    lines you must continue to make the same changes to the data section (which we
    will do next). If you want to add a custom field try to add this line:

    <th>{Category:Field:1}</th>

    (Note: the order of the lines is the order of the columns)

    Now look around line 117 for the following line:

    <tr class="<?php echo $css;?>">

    Below this line you will see lines beginning with <td>. You MUST remove
    the corresponding lines or add lines in the same location as you did above AND
    they must be in the same order. This time add the following line:

    <td>{Review:Field:1}</td>
  9. You should be done. Make sure the files you edited make it back on the server in
    your custom template. If you are comfortable with HTML you can try your hand
    with other changes. You can see a full list of placeholders available for use in your template here.

One thought on “Showing Custom Fields in Your Categories Review Listing”

Comments are closed.