Zen Cart Logo
If this is your first visit, check our documentation. To post, register or login.
Forums / Configuring the Zen Cart Admin / Basic Configuration / How to hide sidebox "review" when you open page "Review"

How to hide sidebox "review" when you open page "Review"

Locked

Started by vadimzven on 17 Aug 2009, 2:28 PM · Views: 3,754

Results 1 to 11 of 11
This thread is locked. New replies are disabled.
17 Aug 2009, 2:28 PM
#1
vadimzven avatar

vadimzven

New Zenner

Join Date:
Aug 2009
Posts:
26
Plugin Contributions:
0

Post #1 by vadimzven

I have sidebox "review" on a right of web and I have page "Review", which I can open from top navigation. I don't need double information. Please help me, how to hide sidebox "review" only on page "Review"

17 Aug 2009, 4:35 PM
#2
ajeh avatar

ajeh

Oba-san

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

Post #2 by ajeh

Look at how the currencies.php sidebox turns off for when on pages containing the word:
checkout

You can do something similar for the reviews sidebox using the word:
review

NOTE: be sure to use your templates and overrides for this ... :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!

17 Aug 2009, 5:23 PM
#3
vadimzven avatar

vadimzven

New Zenner

Join Date:
Aug 2009
Posts:
26
Plugin Contributions:
0

Post #3 by vadimzven

Unfortunately, its doesn't work. Maybe i did something wrong. Can you take look, please:

// display 'no reviews' box

// test if box should display
$show_reviews= false;
// don't display on reviews page:
if (substr($current_page, 0, 8) != 'reviews') {
$show_reviews= true;
}

require($template->get_template_dir('tpl_reviews_none.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_reviews_none.php');

}

$title = '<label>' . BOX_HEADING_REVIEWS . '</label>';
$title_link = false;

require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);
?>

17 Aug 2009, 5:24 PM
#4
vadimzven avatar

vadimzven

New Zenner

Join Date:
Aug 2009
Posts:
26
Plugin Contributions:
0

Post #4 by vadimzven

I forgot to tell you, I changed file - includes/modules/sideboxes/reviews.php

17 Aug 2009, 6:39 PM
#5
ajeh avatar

ajeh

Oba-san

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

Post #5 by ajeh

Close ... :smile:

You have multiple pages for Review things ...

This code covers 3 of them:

// test if box should display
$show_reviews= false;
// don't display on reviews page:
if (substr($current_page, 0, 7) != 'reviews' && substr($current_page, 0, 15) != 'product_reviews') {
  $show_reviews= true;
}

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);

}
?>

You need the length being tested to be correct and the page name to be correct ... then, you need to surround the code about to run with the IF statement to run it, only when the "show variable" is 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!

17 Aug 2009, 7:41 PM
#6
vadimzven avatar

vadimzven

New Zenner

Join Date:
Aug 2009
Posts:
26
Plugin Contributions:
0

Post #6 by vadimzven

The page name is product_reviews - correct. But anyway, when I go to "Reviews" page, the sidebox "reviews" - still exist.

17 Aug 2009, 8:02 PM
#7
ajeh avatar

ajeh

Oba-san

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

Post #7 by ajeh

The code I posted is not showing the sidebox on any of the Review Pages that I am seeing on my site ... :unsure:

Edit the module and add this line above the comment:

echo 'I SEE PAGE: ' . $current_page . '<br>';
// test if box should display

Now go to the page where you are seeing this ... what does it say?

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!

17 Aug 2009, 8:32 PM
#8
vadimzven avatar

vadimzven

New Zenner

Join Date:
Aug 2009
Posts:
26
Plugin Contributions:
0

Post #8 by vadimzven

It's said "I SEE PAGE: reviews"

18 Aug 2009, 12:50 AM
#9
vadimzven avatar

vadimzven

New Zenner

Join Date:
Aug 2009
Posts:
26
Plugin Contributions:
0

Post #9 by vadimzven

It's WORKING . Thank you so much! You are the man. It was small syntax error. :clap:

// test if box should display
$show_reviews= false;
// don't display on reviews page:
if (substr($current_page, 0, 7) != 'reviews' && substr($current_page, 0, 15) != 'product_reviews') {
$show_reviews= true;
}

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

}

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);

}
?>

24 Sep 2009, 4:37 PM
#10
jackfarrel avatar

jackfarrel

New Zenner

Join Date:
Sep 2009
Posts:
12
Plugin Contributions:
0

Post #10 by jackfarrel

Ok I've been trying to follow these examples you guys have posted, but I still have this same problem, I can't turn the review sidebox off for specific pages, it either can be turned on, or off completely.
I basically copied and pasted the entire segment that vadimzven listed, and I can't get it to work. I was looking carefully at this one segment, and I put my Ez pages here, the ez-pages that I dont want to show the review sidebox on, and there is no response.
Pages 2 and 3 of my ez-pages I don't want the review sidebox to display on those 2 pages.

// test if box should display
$show_reviews= false;
// don't display on reviews page:
if (substr($current_page, 2, 3) != 'reviews' && substr($current_page, 2, 3) != 'product_reviews') {
$show_reviews= true;
}

What am I missing?? Please help!! I'm new to this. :(

24 Sep 2009, 4:52 PM
#11
jackfarrel avatar

jackfarrel

New Zenner

Join Date:
Sep 2009
Posts:
12
Plugin Contributions:
0

Post #11 by jackfarrel

Here is my complete review.php file

<?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 $ */ echo 'I SEE PAGE: ' . $current_page . '<br>'; // test if box should display // test if box should display $show_reviews= false; // don't display on reviews page: if (substr($current_page, 5, 2) != 'reviews' && substr($current_page, 5, 2) != 'reviews') { $show_reviews= true; } if ($show_reviews == true) { // if review must be approved or disabled do not show review $review_status = " and r.status = 1 "; } 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); } ?>