Forums / Templates, Stylesheets, Page Layout / reviews in left hand column on home page only

reviews in left hand column on home page only

Views: 1,500

Results 1 to 14 of 14
12 Jan 2012, 3:10 PM
#1
ellis200200 avatar

ellis200200

Zen Follower

Join Date:
Jul 2006
Posts:
127
Plugin Contributions:
0

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

12 Jan 2012, 4:28 PM
#3
ellis200200 avatar

ellis200200

Zen Follower

Join Date:
Jul 2006
Posts:
127
Plugin Contributions:
0

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??

12 Jan 2012, 4:35 PM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: reviews in left hand column on home page only

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

<?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!

12 Jan 2012, 5:15 PM
#5
ellis200200 avatar

ellis200200

Zen Follower

Join Date:
Jul 2006
Posts:
127
Plugin Contributions:
0

Re: reviews in left hand column on home page only

Thanks Ajeh, :smile:

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 :blush:

Thanks Again

12 Jan 2012, 5:38 PM
#6
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: reviews in left hand column on home page only

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

Have you an URL to your site that we could perhaps peek at? :unsure:

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!

12 Jan 2012, 5:46 PM
#7
ellis200200 avatar

ellis200200

Zen Follower

Join Date:
Jul 2006
Posts:
127
Plugin Contributions:
0

Re: reviews in left hand column on home page only

Yes Ajeh, thanks again, it's https://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

12 Jan 2012, 6:06 PM
#8
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

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:

// 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!

13 Jan 2012, 12:57 PM
#9
ellis200200 avatar

ellis200200

Zen Follower

Join Date:
Jul 2006
Posts:
127
Plugin Contributions:
0

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 :blink: 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

13 Jan 2012, 2:07 PM
#10
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

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!

24 Jan 2012, 2:18 PM
#11
ellis200200 avatar

ellis200200

Zen Follower

Join Date:
Jul 2006
Posts:
127
Plugin Contributions:
0

Re: reviews in left hand column on home page only

Hey Ajah,

Sorry for the slow response, busy at work, I have tried adding the code but im still getting the same result :dontgetit

Any other ideas?

Again, thanks for all the help.

Andrew

24 Jan 2012, 2:50 PM
#12
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: reviews in left hand column on home page only

Silly, silly me ... I have a typo:

  if (![B]$[/B]this_is_home_page) {
    $flag_disable_left = true;
  }

I forgot the $ on the variable ... :blush:

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!

24 Jan 2012, 3:13 PM
#13
ellis200200 avatar

ellis200200

Zen Follower

Join Date:
Jul 2006
Posts:
127
Plugin Contributions:
0

Re: reviews in left hand column on home page only

Thanks Ajeh,

Sorted, thanks so much for your help

:clap:

Andrew

24 Jan 2012, 3:21 PM
#14
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: reviews in left hand column on home page only

You are most welcome ... sorry about the typo ... :smile:

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!