Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Show/Hide Columns Infoboxes Support


Guest

Recommended Posts

Show or Hide Left or Right columns

Basically a simple hack

If you want to hide your left column edit the index.php page like this..

<!-- left_navigation //-->
<?php
if($PHP_SELF == '/index.php' AND $HTTP_GET_VARS[cPath] == NULL){
}else{
require(DIR_WS_INCLUDES . 'column_left.php');
}; ?>
<!-- left_navigation_eof //-->

 

You can change the cPath part of it to hide the left column if it's in a certain category. or you can hide the right column instead or you can just go into your left or right column php file and show/hide specific infoboxes based on whether your on a specific page or not.

by just putting

if($PHP_SELF =='/index.php' AND $HTTP_GET_VARS[cPath]==NULL){
}else{
require(DIR_WS_INCLUDES . 'theinfobox.php');

 

You can change the cPath value to show or hide based on a specific path also.

 

If any of you master programmers out there can tweak this more feel free.

 

This is my first contrib guys so go easy on me..

Oh, I almost forgot link to the contrib is Show/Hide Columns/Infoboxes

Edited by imintrouble
Link to comment
Share on other sites

Update:

Anyone want to try and see if this also works?

<?php if ( basename($_SERVER['PHP_SELF']) == FILENAME_DEFAULT && $current_category_id == 'NULL' ){ }else{ require(DIR_WS_INCLUDES . 'column_left.php'); }; ?>

instead of this?

<?php
if($PHP_SELF == '/index.php' AND $HTTP_GET_VARS[cPath] == NULL){
}else{
require(DIR_WS_INCLUDES . 'column_left.php');
}; ?>

Link to comment
Share on other sites

Actually, what imintrouble is referring to would only help you if you wanted to hide certain boxes or columns under specific conditions and show them at other times. It sounds like you want to eliminate the right column completely. Is that correct?

 

If so, you'll need to edit every root level file (index, product_info, shopping_cart, account_info, reviews, etc, etc, etc, etc, etc). There are about 40 files to edit (every page that shows a right column).

 

To eliminate the right column, find:

 

<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">

<!-- right_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>

<!-- right_navigation_eof //-->

</table></td>

 

in each of those files and remove it. It's about 2/3 of the way down, if my memory is correct.

 

Can you give a little bit more info about where the code goes in index.php?

 

I'm trying to have only column_left and eliminate the right column

Edited by choosealogin
Link to comment
Share on other sites

Choose a login is right in order to hide the right column entirely you'll have to edit about 40 pages, unless you use one of the template systems. Like STS or BTS

Link to comment
Share on other sites

I have a catalog being shown in i-frames on 2 different sites, and on one site I would like the left column to never appear.

Do you know a way to detect the location of the catalog, so that the php will hide the left column if the catalog is being viewed in site 1 and show the left column if the catalog is being viewed in site 2?

Thanks for any help with this,

sj

Link to comment
Share on other sites

  • 3 months later...
Can you give a little bit more info about where the code goes in index.php?

 

I'm trying to have only column_left and eliminate the right column

You wrap the code around the column_right php if that's where you want to use it. In other words.. Find this code..

<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- right_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
<!-- right_navigation_eof //-->
</table></td>

On your index.php page.

Replace it with..

<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- right_navigation //-->
<?php if ( basename($_SERVER['PHP_SELF']) == FILENAME_DEFAULT && $current_category_id == 'NULL' ){ }else{ require(DIR_WS_INCLUDES . 'column_right.php'); }; ?>
<!-- right_navigation_eof //-->
</table></td>

Unless you want to entirely remove just edit all of the pages by commenting out the column right like this.. <?php //require(DIR_WS_INCLUDES . 'column_right.php'); } ?>

Link to comment
Share on other sites

  • 1 year later...

i hope this thread is still active :)

ok, what if i want an info box to show in the left column called animals.php (custom infobox) but i dont want it to show on any other pages? i dont want an infobox to replace it on any other page, i just want this one box to only show on the index.php

Link to comment
Share on other sites

haha, the most obvious always gos unnoticed doesnt it?

 

i was able to get my desired result by simply adding an includes tag to the index.php file for the one info box i wanted to show on only that page ;)

Link to comment
Share on other sites

got it

 

in includes/colum_left.php

 

// bof infobox on index only

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

} else {

if (isset($cPath) && tep_not_null($cPath)) {

} else {

include(DIR_WS_BOXES . 'animals.php');

}

}

//eof infobox on index only

Link to comment
Share on other sites

  • 2 months later...

Sort of on same topic, I don't want to eliminate entitre side just the information box and its contents i tried in information .php to remove the contents by removing the lines after href but this removed evertything except the catalog so i had to reinstall information.php from my backup.

 

Anyhelp would be greatly appreciated.

koalaphil

Link to comment
Share on other sites

  • 2 months later...

Hi,

 

I have a problem with quite the same contribution, i.e. lemme show you the code I did put to hide the right column in the index when cPath is not selected :

 

[b]<?php if (isset($cPath_array)) {
  if ($cPath_array[0] == 1)?>[/b]  

<td class="colonnedroite" width="<?php echo BOX_WIDTH; ?>" valign="top">
  <table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
 <!-- right_navigation //-->
 <?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
 <!-- right_navigation_eof //-->
 [b]<?php  } ?>[/b]
</table>

 

But I did not think about the manufacturers ! I mean the column doesn't show when I select only a manufacturer since cPath "does not exist". Can someone tell me how to complete the code in order to have the column on both cPath and manufacturers selection ?

 

Thanks a lot.

Link to comment
Share on other sites

  • 4 weeks later...

Also looking for code what display box on the certan page only.

The code below removes box only in categories but it still display on the contact_us, shippment, conditions ets pages.

 

Any help, please!

 

Sergei

 

got it

 

in includes/colum_left.php

 

// bof infobox on index only

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

} else {

if (isset($cPath) && tep_not_null($cPath)) {

} else {

include(DIR_WS_BOXES . 'animals.php');

}

}

//eof infobox on index only

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...