Page 1 of 2 12 LastLast
Results 1 to 10 of 14
  1. #1
    Join Date
    Jul 2006
    Posts
    134
    Plugin Contributions
    0

    Default reviews in left hand column on home page only

    Hi all, OK this is what i'm trying to achieve. I would like product reviews to appear in the left hand column and have banner adverts in the right hand column on the home page, I would like the right hand column to continue to be active throughout the rest of the pages showing the banner adds but the reviews only on the home page, I have looked through the forum and can seem to find an answer, any help will be greatly appreciated.

    I am using a new install of v1.5.0

    Thanks in advance

  2. #2
    Join Date
    Feb 2005
    Location
    Lansing, Michigan USA
    Posts
    20,021
    Plugin Contributions
    3

    Default Re: reviews in left hand column on home page only


  3. #3
    Join Date
    Jul 2006
    Posts
    134
    Plugin Contributions
    0

    Default Re: reviews in left hand column on home page only

    Thanks for the swift response stevesh.
    Read that one and tried it, but I still have the same problem. The code reads..
    <?php
    /**
    * reviews sidebox - displays a random product-review
    *
    * @package templateSystem
    * @copyright Copyright 2003-2010 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 16044 2010-04-23 01:15:45Z 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,
    substring(reviews_text, 1, 70) as reviews_text
    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_product = $db->ExecuteRandomMulti

    ($random_review_sidebox_select, MAX_RANDOM_SELECT_REVIEWS);
    if ($random_review_sidebox_product->RecordCount() > 0) {
    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);
    if ($this_is_home_page) {
    $show_featured = true;
    } else {
    $show_featured = false;
    }
    ?>

    I've put in my template file, I must be missing something??

  4. #4
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: reviews in left hand column on home page only

    You might try this on the file:
    /includes/modules/sideboxes/reviews.php

    Code:
    <?php
    /**
     * reviews sidebox - displays a random product-review
     *
     * @package templateSystem
     * @copyright Copyright 2003-2010 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 16044 2010-04-23 01:15:45Z drbyte $
     */
    
      if ($this_is_home_page) {
        $show_reviews = true;
      } else {
        $show_reviews = false;
      }
    
    if ($show_reviews) {
    // 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,
                        substring(reviews_text, 1, 70) as reviews_text
                        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_product = $db->ExecuteRandomMulti($random_review_sidebox_select, MAX_RANDOM_SELECT_REVIEWS);
      if ($random_review_sidebox_product->RecordCount() > 0) {
        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);
    }
    NOTE: you should use your templates and overrides for this ...
    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!]
    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!

  5. #5
    Join Date
    Jul 2006
    Posts
    134
    Plugin Contributions
    0

    Default Re: reviews in left hand column on home page only

    Thanks Ajeh,

    That removed it, but now there's a 550px empty space on the other pages, and now I have no idea how to get rid of it

    Thanks Again

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

    Default Re: reviews in left hand column on home page only

    Thanks for the update that this worked for you ...

    Have you an URL to your site that we could perhaps peek at?
    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!]
    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!

  7. #7
    Join Date
    Jul 2006
    Posts
    134
    Plugin Contributions
    0

    Default Re: reviews in left hand column on home page only

    Yes Ajeh, thanks again, it's www.equineadvisor.co.uk

    I only started on it this morning so not that much going on, the site will be as much about the reviews as the products.

    Thanks again

    Andrew

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

    Default Re: reviews in left hand column on home page only

    You have your left column on and it has something in it for the Home page but nothing for the other pages ... but the column is still on ...

    You could customize the tpl_main_page.php in your templates and overrides with something like the code in RED:
    Code:
    // the following IF statement can be duplicated/modified as needed to set additional flags
      if (in_array($current_page_base,explode(",",'list_pages_to_skip_all_right_sideboxes_on_here,separated_by_commas,and_no_spaces')) ) {
        $flag_disable_right = true;
      }
    
      if (!this_is_home_page) {
        $flag_disable_left = 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!]
    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
    Jul 2006
    Posts
    134
    Plugin Contributions
    0

    Default Re: reviews in left hand column on home page only

    Thanks again Ajeh,

    I've had a play with the code, the only problem is the number of pages on the site will be quite high so listing each one would be very labor intensive, as i am quite lazy I was trying to think of another way around it. I have come up with this idea, please excuse my crude explanation...

    In Admin you can set the width of the left hand column in Admin/config/layout settings/Column Width - Left Boxes. Is there any way I can code this to make it apply to only the home page with a 'if (!this_is_home_page)' command or something like it to make the width only apply to the home page? therefor not show on all the additional pages?

    Possibly in the includes/modules/column_left.php file around the Line #24 : $column_width = BOX_WIDTH_LEFT; area?

    could this work?

    Again thanks for all the help

    Andrew

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

    Default Re: reviews in left hand column on home page only

    Why would you need to list a lot of pages?

    If you only want the left column on the home page, then the IF I gave you in red turns off the left column on all pages except the home page ...
    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!]
    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. Overriding so that the left hand column dosn't appear on main/home page
    By HelenSama in forum Templates, Stylesheets, Page Layout
    Replies: 28
    Last Post: 22 Oct 2009, 06:28 PM
  2. Stylizing EZ Page Headings in Left Hand Column/Sidebox
    By HelenSama in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 25 Oct 2008, 05:05 PM
  3. Best way to add text to the left column on only the home page?
    By pocweb01 in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 22 Oct 2008, 12:28 PM
  4. Only Show Sub Categories in Left Hand Column
    By HelenSama in forum Setting Up Categories, Products, Attributes
    Replies: 3
    Last Post: 21 Apr 2008, 04:36 PM
  5. Missing left hand column
    By tianakaesha in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 14 Nov 2007, 05:14 AM

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