Page 1 of 2 12 LastLast
Results 1 to 10 of 17
  1. #1
    Join Date
    Jul 2009
    Posts
    48
    Plugin Contributions
    0

    Default Remove product reviews on main page only

    How could you remove the product review option on the right column but only on the main page.

    I still want it to show on the product info page, just not on the main page. Turning off under admin shuts it completely off.

    Ideas?

    http://www.bloomfieldsportsshop.com/store

  2. #2
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,459
    Plugin Contributions
    6

    Default Re: Remove product reviews on main page only

    Using your templates and overrides, copy the:
    /includes/modules/sideboxes/reviews.php

    to your custom directory:
    /includes/modules/sideboxes/your_template_dir/reviews.php

    and change this line from:
    Code:
    if ($show_reviews == true) {
    to read:
    Code:
    // do not show on home page
    if ($this_is_home_page) {
      $show_reviews= false;
    }
    
    if ($show_reviews == true) {
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  3. #3
    Join Date
    Jul 2009
    Posts
    48
    Plugin Contributions
    0

    Default Re: Remove product reviews on main page only

    Thanks Linda! Any idea on how to make the editable box show only on the front page and not on the product pages?

  4. #4
    Join Date
    Jul 2009
    Posts
    48
    Plugin Contributions
    0

    Default Re: Remove product reviews on main page only

    Quote Originally Posted by Ajeh View Post
    Using your templates and overrides, copy the:
    /includes/modules/sideboxes/reviews.php

    to your custom directory:
    /includes/modules/sideboxes/your_template_dir/reviews.php

    and change this line from:
    Code:
    if ($show_reviews == true) {
    to read:
    Code:
    // do not show on home page
    if ($this_is_home_page) {
      $show_reviews= false;
    }
    
    if ($show_reviews == true) {
    That line is not in /includes/modules/sideboxes/reviews.php
    Code:
    <?php
    /**
     * reviews sidebox - displays a random product-review 
     *
     * @package templateSystem
     * @copyright Copyright 2003-2005 Zen Cart Development Team
     * @copyright Portions Copyright 2003 osCommerce
     * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
     * @version $Id: reviews.php 2718 2005-12-28 06:42:39Z drbyte $
     */
    
    // if review must be approved or disabled do not show review
      $review_status = " and r.status = 1 ";
    
      $random_review_sidebox_select = "select r.reviews_id, r.reviews_rating, p.products_id, p.products_image, pd.products_name
                        from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd, "
                               . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
                        where p.products_status = '1'
                        and p.products_id = r.products_id
                        and r.reviews_id = rd.reviews_id
                        and rd.languages_id = '" . (int)$_SESSION['languages_id'] . "'
                        and p.products_id = pd.products_id
                        and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'" .
                        $review_status;
    
      if (isset($_GET['products_id'])) {
        $random_review_sidebox_select .= " and p.products_id = '" . (int)$_GET['products_id'] . "'";
      }
      $random_review_sidebox_select .= " limit " . MAX_RANDOM_SELECT_REVIEWS;
      $random_review_sidebox_product = zen_random_select($random_review_sidebox_select);
      if ($random_review_sidebox_product->RecordCount() > 0) {
    // display random review box
        $review_box_text_query = "select substring(reviews_text, 1, 60) as reviews_text
                         from " . TABLE_REVIEWS_DESCRIPTION . "
                         where reviews_id = '" . (int)$random_review_sidebox_product->fields['reviews_id'] . "'
                         and languages_id = '" . (int)$_SESSION['languages_id'] . "'";
    
        $review_box_text = $db->Execute($review_box_text_query);
    
    //    $review_box_text = zen_break_string(zen_output_string_protected($review_box_text->fields['reviews_text']), 15, '-<br />');
        $review_box_text = zen_break_string(nl2br(zen_output_string_protected(stripslashes($review_box_text->fields['reviews_text']))), 60, '-<br />');
    
        require($template->get_template_dir('tpl_reviews_random.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_reviews_random.php');
      } elseif (isset($_GET['products_id']) and zen_products_id_valid($_GET['products_id'])) {
    // display 'write a review' box
        require($template->get_template_dir('tpl_reviews_write.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_reviews_write.php');
      } else {
    // display 'no reviews' box
        require($template->get_template_dir('tpl_reviews_none.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_reviews_none.php');
      }
      $title =  BOX_HEADING_REVIEWS;
      $title_link = FILENAME_REVIEWS;
      require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);
    ?>

  5. #5
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,459
    Plugin Contributions
    6

    Default Re: Remove product reviews on main page only

    Sorry ... I had a customized box ... use this for the file:
    Code:
    <?php
    /**
     * reviews sidebox - displays a random product-review
     *
     * @package templateSystem
     * @copyright Copyright 2003-2005 Zen Cart Development Team
     * @copyright Portions Copyright 2003 osCommerce
     * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
     * @version $Id: reviews.php 2718 2005-12-28 06:42:39Z drbyte $
     */
    
    // test if box should display
    $show_reviews= true;
    
    // do not show on home page
    if ($this_is_home_page) {
      $show_reviews= false;
    }
    
    if ($show_reviews == true) {
    // if review must be approved or disabled do not show review
      $review_status = " and r.status = 1 ";
    
      $random_review_sidebox_select = "select r.reviews_id, r.reviews_rating, p.products_id, p.products_image, pd.products_name
                        from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd, "
                               . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
                        where p.products_status = '1'
                        and p.products_id = r.products_id
                        and r.reviews_id = rd.reviews_id
                        and rd.languages_id = '" . (int)$_SESSION['languages_id'] . "'
                        and p.products_id = pd.products_id
                        and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'" .
                        $review_status;
    
      if (isset($_GET['products_id'])) {
        $random_review_sidebox_select .= " and p.products_id = '" . (int)$_GET['products_id'] . "'";
      }
      $random_review_sidebox_select .= " limit " . MAX_RANDOM_SELECT_REVIEWS;
      $random_review_sidebox_product = zen_random_select($random_review_sidebox_select);
      if ($random_review_sidebox_product->RecordCount() > 0) {
    // display random review box
        $review_box_text_query = "select substring(reviews_text, 1, 60) as reviews_text
                         from " . TABLE_REVIEWS_DESCRIPTION . "
                         where reviews_id = '" . (int)$random_review_sidebox_product->fields['reviews_id'] . "'
                         and languages_id = '" . (int)$_SESSION['languages_id'] . "'";
    
        $review_box_text = $db->Execute($review_box_text_query);
    
    //    $review_box_text = zen_break_string(zen_output_string_protected($review_box_text->fields['reviews_text']), 15, '-<br />');
        $review_box_text = zen_break_string(nl2br(zen_output_string_protected(stripslashes($review_box_text->fields['reviews_text']))), 60, '-<br />');
    
        require($template->get_template_dir('tpl_reviews_random.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_reviews_random.php');
      } elseif (isset($_GET['products_id']) and zen_products_id_valid($_GET['products_id'])) {
    // display 'write a review' box
        require($template->get_template_dir('tpl_reviews_write.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_reviews_write.php');
      } else {
    // display 'no reviews' box
        require($template->get_template_dir('tpl_reviews_none.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_reviews_none.php');
      }
      $title =  BOX_HEADING_REVIEWS;
      $title_link = FILENAME_REVIEWS;
      require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);
    
    }
    ?>
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  6. #6
    Join Date
    Jul 2009
    Posts
    48
    Plugin Contributions
    0

    Default Re: Remove product reviews on main page only

    Thanks again! I was struggling with this.

  7. #7
    Join Date
    May 2009
    Posts
    416
    Plugin Contributions
    0

    Default Re: Remove product reviews on main page only

    Would it be possible to apply the above modified code to display the product reviews sidebox on JUST the Product Info page only?

  8. #8
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,459
    Plugin Contributions
    6

    Default Re: Remove product reviews on main page only

    In the IF statement you could use:
    $_GET['main_page']

    and when it is == to 'product_info' then it would allow the sidebox to display ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  9. #9
    Join Date
    May 2009
    Posts
    416
    Plugin Contributions
    0

    Default Re: Remove product reviews on main page only

    I tried the following but it removed the review sidebox completely :

    <?php
    /**
    * reviews sidebox - displays a random product-review
    *
    * @package templateSystem
    * @copyright Copyright 2003-2005 Zen Cart Development Team
    * @copyright Portions Copyright 2003 osCommerce
    * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
    * @version $Id: reviews.php 2718 2005-12-28 06:42:39Z drbyte $
    */

    // test if box should display
    $show_reviews= true;

    // do not show on home page
    if $_GET('main_page') {
    $show_reviews= false;
    }

    if ($show_reviews == true) {
    // if review must be approved or disabled do not show review
    $review_status = " and r.status = 1 ";

    $random_review_sidebox_select = "select r.reviews_id, r.reviews_rating, p.products_id, p.products_image, pd.products_name
    from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd, "
    . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
    where p.products_status = '1'
    and p.products_id = r.products_id
    and r.reviews_id = rd.reviews_id
    and rd.languages_id = '" . (int)$_SESSION['languages_id'] . "'
    and p.products_id = pd.products_id
    and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'" .
    $review_status;

    if (isset($_GET['products_id'])) {
    $random_review_sidebox_select .= " and p.products_id = '" . (int)$_GET['products_id'] . "'";
    }
    $random_review_sidebox_select .= " limit " . MAX_RANDOM_SELECT_REVIEWS;
    $random_review_sidebox_product = zen_random_select($random_review_sidebox_select);
    if ($random_review_sidebox_product->RecordCount() > 0) {
    // display random review box
    $review_box_text_query = "select substring(reviews_text, 1, 60) as reviews_text
    from " . TABLE_REVIEWS_DESCRIPTION . "
    where reviews_id = '" . (int)$random_review_sidebox_product->fields['reviews_id'] . "'
    and languages_id = '" . (int)$_SESSION['languages_id'] . "'";

    $review_box_text = $db->Execute($review_box_text_query);

    // $review_box_text = zen_break_string(zen_output_string_protected($review_box_text->fields['reviews_text']), 15, '-<br />');
    $review_box_text = zen_break_string(nl2br(zen_output_string_protected(stripslashes($review_box_text->fields['reviews_text']))), 60, '-<br />');

    require($template->get_template_dir('tpl_reviews_random.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_reviews_random.php');
    } elseif (isset($_GET['products_id']) and zen_products_id_valid($_GET['products_id'])) {
    // display 'write a review' box
    require($template->get_template_dir('tpl_reviews_write.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_reviews_write.php');
    } else {
    // display 'no reviews' box
    require($template->get_template_dir('tpl_reviews_none.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_reviews_none.php');
    }
    $title = BOX_HEADING_REVIEWS;
    $title_link = FILENAME_REVIEWS;
    require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);

    }
    ?>

  10. #10
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,459
    Plugin Contributions
    6

    Default Re: Remove product reviews on main page only

    Change your code:
    Code:
    // do not show on home page
    if $_GET('main_page') {
    $show_reviews= false;
    }
    to read:
    Code:
    // do not show on home page
    if ($_GET('main_page') != 'product_info') {
      $show_reviews= false;
    }
    Note: if you use multiple product types, you may need to alter this code ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Reviews box only on the product page
    By attroll in forum General Questions
    Replies: 0
    Last Post: 12 Jun 2009, 06:20 PM
  2. Product page - how to show a link to the reviews page and reviews count?
    By Ronson in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 26 Mar 2009, 11:45 PM
  3. category tabs to only display on product info page, not main page
    By fa11s in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 20 Feb 2009, 08:33 PM
  4. Remove Main Page Image Only
    By Divalicious Chocolat in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 14 Oct 2008, 05:06 PM
  5. I want to remove the reviews option from the main page?
    By nagmier in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 20 Aug 2007, 07:33 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR