Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Turn Off Columns Except for Product Page

Turn Off Columns Except for Product Page

Views: 1,140

Results 1 to 5 of 5
5 Nov 2012, 5:19 PM
#1
sph avatar

sph

Totally Zenned

Join Date:
Jan 2006
Posts:
1,556
Plugin Contributions:
0

Turn Off Columns Except for Product Page

Normally people want to turn off a column, usually the right, for the product pages.

I'd like to turn off all columns EXCEPT for the right column on the product page, so I can keep the mfr info sidebox:

http://www.prommart.com/b-dazzle-35422-p-980.html

I know how to turn off both columns for homepage only in tpl_main_page. And I can just globally turn off the left column.

Last night I managed to use the tpl_main_page "explode cpath" to turn off the columns for the categories and subcategories. Unfortunately, that also turned off the right column for the products.

But how to turn off right column for categories/subcategories but leave right column for product?

Any help appreciated, thanks.

Steve

PS: Site currently returned to default three columns.

5 Nov 2012, 6:09 PM
#2
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,091
Plugin Contributions:
56

Re: Turn Off Columns Except for Product Page

If I'm understanding you correctly, you want your "normal" (i.e. as set by your admin) left/right columns to show on all pages except for product_info, where you want only the right sidebox to show. If that's correct, you can edit your /includes/templates/YOUR_TEMPLATE/common/tpl_main_page.php (around line 80 on an unedited v1.5.1 version) to add the lines in red:

if (COLUMN_LEFT_STATUS == 0 || (CUSTOMERS_APPROVAL == '1' and $_SESSION['customer_id'] == '') || (CUSTOMERS_APPROVAL_AUTHORIZATION == 1 && CUSTOMERS_AUTHORIZATION_COLUMN_LEFT_OFF == 'true' and ($_SESSION['customers_authorization'] != 0 or $_SESSION['customer_id'] == ''))) {
  // global disable of column_left
  $flag_disable_left = true;
}
if ($current_page_base == 'product_info') {
  $flag_disable_left = true;
  $flag_disable_right = false;
}
if (!isset($flag_disable_left) || !$flag_disable_left) {
5 Nov 2012, 6:40 PM
#3
sph avatar

sph

Totally Zenned

Join Date:
Jan 2006
Posts:
1,556
Plugin Contributions:
0

Re: Turn Off Columns Except for Product Page

I wanted to ideally turn off ALL columns EXCEPT for the product page. And using your code with my code worked!

http://www.prommart.com/b-dazzle-35422-p-980.html

So now only the product page has a column (right) insofar as I yet see. It even turned off the columns for the shipping, conditions, contact us pages, etc.

Thanks!

Here is what I have, in case anyone else wants this, all in common/tpl_main_page.php:

Turned off columns for homepage and my categories and subcategories (at top of tpl main page):

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

if (in_array($cPath,explode(",",'1,33,32,10,13,29,9,16,7,3,3_18,3_23,16_17,3_5,29_30,29_31,7_28,13_25,13_26,13_27,3_21,13_14,10_11,3_4,10_15,7_8,10_12,7_24,1_2,19_20,1_6,19,')) ) {
    $flag_disable_left = true;
    $flag_disable_right = true;
  }

But above also takes out the right column on my product page, which I wanted to leave.

So I then applied Lat9's code in the place he indicated, which now leaves the right column on for product pages only...what I was looking for:

if ($current_page_base == 'product_info') {
  $flag_disable_left = true;
  $flag_disable_right = false;
}

Lat9, thanks again!

Steve

5 Nov 2012, 7:24 PM
#4
gjh42 avatar

gjh42

Black Belt

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

Re: Turn Off Columns Except for Product Page

Since you only want the right column on product info pages, and can turn off the left column globally in admin, you can simplify all of this code to```php
if ($current_page_base == 'product_info') {
$flag_disable_right = false;
}else{
$flag_disable_right = true;
}

5 Nov 2012, 9:10 PM
#5
sph avatar

sph

Totally Zenned

Join Date:
Jan 2006
Posts:
1,556
Plugin Contributions:
0

Re: Turn Off Columns Except for Product Page

gjh42:

Since you only want the right column on product info pages, and can turn off the left column globally in admin, you can simplify all of this code to```php
if ($current_page_base == 'product_info') {
$flag_disable_right = false;
}else{
$flag_disable_right = true;
}


Yes, that works too! 

<http://www.prommart.com/b-dazzle-35422-p-980.html>

I guess it is the little else in green.

Much simpler than my method, and now I don't have to keep adding new categories to the code.

I did globally turn off the left column in the admin.

Thanks!

Steve