Zen Cart Logo
Forums / General Questions / Show/Hide sideboxes based on page

Show/Hide sideboxes based on page

Views: 43,781

Results 161 to 180 of 189
29 Oct 2010, 5:10 PM
#161
byoriginaldesign avatar

byoriginaldesign

New Zenner

Join Date:
Apr 2009
Posts:
84
Plugin Contributions:
0

Show/Hide sideboxes based on page

I confirmed it was on, and no I apparently selected admin in the search. The following is the info you originally requested:

/home2/wholesf3/public_html/printdealz/includes/modules/sideboxes/blank_sidebox.php

Line #12 : $show_blank_sidebox = true;

Line #15 : $show_blank_sidebox = true;

Line #17 : $show_blank_sidebox = false;

Line #20 : if ($show_blank_sidebox == true) {

/home2/wholesf3/public_html/printdealz/includes/modules/sideboxes/printdealz/blank_sidebox.php

Line #12 : $show_blank_sidebox = true;

Line #15 : $show_blank_sidebox = true;

Line #17 : $show_blank_sidebox = false;

Line #20 : if ($show_blank_sidebox == true) {

29 Oct 2010, 5:41 PM
#162
ajeh avatar

ajeh

Oba-san

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

Re: Show/Hide sideboxes based on page

From what you are displaying I would think it would work just like my test for a sidebox on these pages ...

30 Oct 2010, 6:10 AM
#163
byoriginaldesign avatar

byoriginaldesign

New Zenner

Join Date:
Apr 2009
Posts:
84
Plugin Contributions:
0

Re: Show/Hide sideboxes based on page

I agree that the code you suggested looks as though it should work, so that's why I'm baffled as to why it's not. Is it at all possible that an add-on such as multisite module that reconfigures how the site cpath is read could be causing the problem?

30 Oct 2010, 12:40 PM
#164
ajeh avatar

ajeh

Oba-san

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

Re: Show/Hide sideboxes based on page

Which site is this for?

The one in your signature has issues with the URL containing a double slash in it ...

This leads me to believe you have errors in the configure.php files:
/includes/configure.php
/admin/includes/configure.php

if you could post those files, from the server, without your username, password and secret /admin directory name, perhaps we can help you resolve that ...

1 Nov 2010, 6:25 AM
#165
byoriginaldesign avatar

byoriginaldesign

New Zenner

Join Date:
Apr 2009
Posts:
84
Plugin Contributions:
0

Re: Show/Hide sideboxes based on page

I've been curious about the //, but I've been under the "if it aint broke, don't fix it" mindset. :blush:

We got the sideboxes working on the appropriate pages with the following:

<?php
/**
 * blank sidebox - allows a blank sidebox to be added to your site
 *
 * @package templateSystem
 * @copyright 2007 Kuroi Web Design
  * @copyright Portions Copyright 2003-2007 Zen Cart Development Team
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: blank_sidebox.php 2007-05-26 kuroi $
 */

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

if ($current_page_base == 'index' and $cPath == '' ) {

$show_blank_sidebox = false;

}
else if($current_page_base == 'index' and $cPath != '' )
{
$show_blank_sidebox = true;

}

  if ($show_blank_sidebox == true and  $current_page_base='index' and $cPath != '') {
      require($template->get_template_dir('tpl_blank_sidebox.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_blank_sidebox.php');
      //$title =  BOX_HEADING_BLANK_SIDEBOX;
        $title='Category Option';
      $title_link = false;
      require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);
 }
?>

Thanks for your help, as always, and if I find I need to figure out the reason for the // in the url, I'll post that in a separate thread.

1 Nov 2010, 1:37 PM
#166
ajeh avatar

ajeh

Oba-san

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

Re: Show/Hide sideboxes based on page

I am not quite sure what you are trying to do with your test ...

If you test the conditions in the IF statements ... but then you go on to use:

  if ($show_blank_sidebox == true and  $current_page_base='index' and $cPath != '') {

and the single equal is incorrect and should be a double equal in an IF ... and the extra testing on that IF is more or less the same thing you tested for in the initial IF test ...

The idea is to set the $show_blank_sidebox and only need to use it to know whether or not to run the sidebox ...

As to the double // in the URL, I would venture to guess that you have either trailing slashes in the configure.php or double slashes ...

1 Nov 2010, 3:14 PM
#167
byoriginaldesign avatar

byoriginaldesign

New Zenner

Join Date:
Apr 2009
Posts:
84
Plugin Contributions:
0

Re: Show/Hide sideboxes based on page

Lack of sleep... I assumed the fix was in the file we were working on, but you're right, now that I actually read that code, that does not cause the sideboxes to work as intended. I'll find out how it was done, and follow up with the real answer.

P.S. I decided to track down the extra / since you weren't the only one who mentioned it today, and it was in the multisite mod config file having the trailing /.

Anyway, I'm going to try this all on a fresh install of zen, fix a few things, and write a tutorial of the new sidebox add-on this whole thing was for. Wish me luck. :bigups:

12 Nov 2010, 12:31 AM
#168
joyjoy avatar

joyjoy

Totally Zenned

Join Date:
Sep 2010
Posts:
611
Plugin Contributions:
0

Re: Show/Hide sideboxes based on page

How do I hide the Reviews sidebox when on a product page? Thank you!

6 Jan 2011, 1:49 AM
#169
joyjoy avatar

joyjoy

Totally Zenned

Join Date:
Sep 2010
Posts:
611
Plugin Contributions:
0

Re: Show/Hide sideboxes based on page

How do I have a sidebox that only appears on the main page? I don't want it anywhere else...

Thank you!

6 Jan 2011, 2:14 AM
#170
joyjoy avatar

joyjoy

Totally Zenned

Join Date:
Sep 2010
Posts:
611
Plugin Contributions:
0

Re: Show/Hide sideboxes based on page

Nevermind. :smile:

Found the answer in FAQ.

6 Apr 2011, 10:52 AM
#171
joyjoy avatar

joyjoy

Totally Zenned

Join Date:
Sep 2010
Posts:
611
Plugin Contributions:
0

Re: Show/Hide sideboxes based on page

I've seen a few posts about hiding boxes at checkout...it's still Greek to me. One was close but then it looks like they went with the css route.

I don't understand the if and array code in the sidebox files...can someone help? Thank you.

For starters I'd like to get the Best Sellers, Who's Online and Reviews boxes hidden.

2 May 2011, 4:44 PM
#172
ryanb4614 avatar

ryanb4614

Totally Zenned

Join Date:
Feb 2008
Posts:
556
Plugin Contributions:
0

Re: Show/Hide sideboxes based on page

I have read over this forum, I have got it mostly to work but not 100%. The categories sidebox I want to show on EVERY page except the main page. I also would like the Blank Sidebox to ONLY show on the main page.

:frusty:

2 May 2011, 4:56 PM
#173
ryanb4614 avatar

ryanb4614

Totally Zenned

Join Date:
Feb 2008
Posts:
556
Plugin Contributions:
0

Re: Show/Hide sideboxes based on page

Got it heres how I did it:
Blank sidebox in: blank_sidebox.php

 // test if box should display

  if ($this_is_home_page) {
    $show_blank_sidebox = true;
  } else {
    $show_blank_sidebox = false;
  }



  if ($show_blank_sidebox == true) {
      require($template->get_template_dir('tpl_blank_sidebox.php',DIR_WS_TEMPLATE, $current_page_base,'sideboxes'). '/tpl_blank_sidebox.php');
      $title =  BOX_HEADING_blank_SIDEBOX;
      $title_link = false;
      require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);
 }
?>

For Categories:

$show_categories= true;

if ($this_is_home_page) {
$show_categories= false;
}


if ($show_categories == true) {
$main_category_tree = new category_tree;
$row = 0;
$box_categories_array = array();

// don't build a tree when no categories
$check_categories = $db->Execute("select categories_id from " . TABLE_CATEGORIES . " where categories_status=1 limit 1");
if ($check_categories->RecordCount() > 0) {
$box_categories_array = $main_category_tree->zen_category_tree();
}

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

$title = BOX_HEADING_CATEGORIES;
$title_link = false;

require($template->get_template_dir($column_box_default, DIR_WS_TEMPLATE, $current_page_base,'common') . '/' . $column_box_default);
}
?> 
10 Jun 2011, 7:22 PM
#174
samhughey avatar

samhughey

New Zenner

Join Date:
Aug 2010
Posts:
24
Plugin Contributions:
0

Re: Show/Hide sideboxes based on page

kuroi:

Create an over-ride file for common/tpl_main_page.php and insert the following block of code at around line 45-46

Would someone please tell me what I'm doing wrong. I've done the above explicitly and it doesn't work. I used product_info instead of main_page. Is my verbiage incorrect? Should I use the following instead:

if ($this_is_product_info_page == true) {
$flag_disable_left = true;
$flag_disable_right = true;
}

Thanks,
Sam

10 Jun 2011, 9:09 PM
#175
ajeh avatar

ajeh

Oba-san

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

Re: Show/Hide sideboxes based on page

This is not a real variable:
$this_is_product_info_page

You might try:

  if (isset($_GET['products_id'])) {
11 Jun 2011, 2:10 AM
#176
samhughey avatar

samhughey

New Zenner

Join Date:
Aug 2010
Posts:
24
Plugin Contributions:
0

Re: Show/Hide sideboxes based on page

Ajeh:

This is not a real variable:
$this_is_product_info_page

You might try:

if (isset($_GET['products_id'])) {


UREEKA!!! It worked. Thank you Thank you Thank you Thank you :clap:
11 Jun 2011, 2:22 AM
#177
ajeh avatar

ajeh

Oba-san

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

Re: Show/Hide sideboxes based on page

You are most welcome ... thanks for the update that this worked for you ...

5 Aug 2011, 9:51 AM
#178
anthony_h avatar

anthony_h

New Zenner

Join Date:
May 2007
Posts:
16
Plugin Contributions:
0

Re: Show/Hide sideboxes based on page

Hello,

Does anybody know the code to show certain sideboxes on the manufacturers pages?

Thank you.

Anthony

:smile:

15 Jul 2012, 3:24 AM
#179
astarkley avatar

astarkley

New Zenner

Join Date:
Nov 2006
Posts:
72
Plugin Contributions:
0

Re: Show/Hide sideboxes based on page

I'm using version 1.3.9 and would like to know how to remove all side boxes as well as the header and footer from this page https://letsseethemenu.com/index.php?main_page=subscribe so that I am left with only "Receive Special Offers & Coupons:HTMLTEXT-Only" any assistance is greatly appreciated.

18 May 2015, 5:54 PM
#180
marton_1 avatar

marton_1

Totally Zenned

Join Date:
Apr 2013
Location:
eglisau switzerland
Posts:
568
Plugin Contributions:
0

Re: Show/Hide sideboxes based on page

Sorry to drag up an old thread.

I have been experimenting with not showing side columns on certain pages.

I used the prepared code in tpl_main_page.php to stop columns on the home page which works fine.

But does not stop columns for other pages, I assume the page name is this guy? <title>Accessories</title>
So the code to I used is
if (in_array($current_page_base,explode(",",'Accessories')) ) {
$flag_disable_right = true;
}

Probably I did something dumb :(

<title>Accessories</title>