Forums / Basic Configuration / Disabling right column of template on page by page basis

Disabling right column of template on page by page basis

Views: 2,131

Results 1 to 12 of 12
26 Nov 2012, 8:08 PM
#1
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
949
Plugin Contributions:
3

Disabling right column of template on page by page basis

Going over the documentation , I would like to know how can I configure ZenCart to only show the right column if it is on certain pages?

Column Left Status - Global
Show Column Left, unless page override exists?
0= Column Left is always off
1= Column Left is on, unless page override

How do I access these overrides?

26 Nov 2012, 9:13 PM
#3
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
949
Plugin Contributions:
3

Re: Disabling right column of template on page by page basis

lat9:

Scrolling down to view "Similar Threads" yielded this which might help: http://www.zen-cart.com/showthread.php?190358-Right-column-disable-on-tell_a_friend-page-but-enable-on-product_info_display-page

Okay I See that and that is helpful but where do I edit that in at?

26 Nov 2012, 11:29 PM
#4
balihr avatar

balihr

Totally Zenned

Join Date:
Oct 2008
Location:
Croatia
Posts:
1,807
Plugin Contributions:
22

Re: Disabling right column of template on page by page basis

retched:

Okay I See that and that is helpful but where do I edit that in at?

Take a look at includes/templates/YOUR_TEMPLATE/common/tpl_main_page.php - everything is explained in the very beginning of the file, plus the first active line says it all.

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

So, if you want to disable it on shopping cart page, product page and new products page, you'll have something like this:

if (in_array($current_page_base,explode(",",'shopping_cart,product_info,products_new')) ) {
    $flag_disable_right = true;
  }

If you want to disable the left column, you'll just copy these lines and change $flag_disable_right to $flag_disable_left. If you're not sure what's the page name, take a peek in includes/modules/pages :smile:

My site - Pro ZC Help
My portfolio | My plugins

28 Nov 2012, 5:30 AM
#5
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
949
Plugin Contributions:
3

Re: Disabling right column of template on page by page basis

Thanks for the info. I'm able to get the pages to work fine but I have one SMALL problem. when I use the following code:

  if (in_array($current_page_base,explode(",",'index,product_cfvsingles_info,product_info')) ) {
    $flag_disable_right = true;
  }

It disables it on the home page, product info pages (a custom type and default). Which is what I want. But when you load up a category page, it disables that too. How can I express to allow the page to show on the category page but NOT the index page?

28 Nov 2012, 5:54 AM
#6
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
949
Plugin Contributions:
3

Re: Disabling right column of template on page by page basis

Nevermind I figured it out. This is a patch job but should do the trick:

if (in_array($current_page_base,explode(",",'product_cfvsingles_info,product_info')) || (in_array($current_page_base,"index") && $_GET['cPath'] != '')) {
$flag_disable_right = true;
}

The above interprets as (I hope):

If in the current_page_base array, I find "product_cfvsingles_info OR product_info OR if in the array current_page_base, I find "index" AND the cPath variable does not equal blank, do not shot the right column.

At least if I did it right. If there's a better way, feel free to write.

28 Nov 2012, 10:17 AM
#7
balihr avatar

balihr

Totally Zenned

Join Date:
Oct 2008
Location:
Croatia
Posts:
1,807
Plugin Contributions:
22

Re: Disabling right column of template on page by page basis

retched:

Nevermind I figured it out. This is a patch job but should do the trick:

if (in_array($current_page_base,explode(",",'product_cfvsingles_info,product_info')) || (in_array($current_page_base,"index") && $_GET['cPath'] != '')) {
$flag_disable_right = true;
}

The above interprets as (I hope):

If in the current_page_base array, I find "product_cfvsingles_info OR product_info OR if in the array current_page_base, I find "index" AND the cPath variable does not equal blank, do not shot the right column.

At least if I did it right. If there's a better way, feel free to write.

Actually, there is a better way. :smile: There is a native check for home page ($this_is_home_page) so you should use that where ever applicable.

if (in_array($current_page_base,explode(",",'product_cfvsingles_info,product_info') ) || $this_is_home_page) {
$flag_disable_right = true;
}

My site - Pro ZC Help
My portfolio | My plugins

5 Jan 2013, 6:27 AM
#8
kevin205 avatar

kevin205

Totally Zenned

Join Date:
Dec 2012
Posts:
607
Plugin Contributions:
0

Re: Disabling right column of template on page by page basis

Great topic. Thanks.

Using Zen Cart 1.5.1

7 Jan 2013, 4:21 PM
#9
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
949
Plugin Contributions:
3

Re: Disabling right column of template on page by page basis

Is there a way to test for the category landing page?

7 Jan 2013, 4:35 PM
#10
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Disabling right column of template on page by page basis

If by that you mean a particular category page (whether the category is listing subcats or products), you could use for the category where cPath=2_13

if ($current_page_base == 'index' and $cPath == '2_13') {
  $flag_disable_left = true;
}
7 Jan 2013, 4:38 PM
#11
retched avatar

retched

Totally Zenned

Join Date:
Jun 2007
Location:
Bronx, New York, United States
Posts:
949
Plugin Contributions:
3

Re: Disabling right column of template on page by page basis

gjh42:

If by that you mean a particular category page (whether the category is listing subcats or products), you could use for the category where cPath=2_13

if ($current_page_base == 'index' and $cPath == '2_13') {
$flag_disable_left = true;
}


Close but I mean a general category page. I mean the page that you land on when you click the link to a category.
7 Jan 2013, 5:23 PM
#12
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Disabling right column of template on page by page basis

Since all category pages are "index" pages and almost vice versa (all "index" pages are categories or the homepage), you can use```php
if ($current_page_base == 'index' and !$this_is_home_page) {
$flag_disable_left = true;
}