Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Remove left column on index page


Recommended Posts

Hi

 

I would like to remove the left column from the index page but have still show on other pages. So far no luck. I have tried moving

template_bottom.php to template_top.php

Template_bottom.php
<?php
  if ($oscTemplate->hasBlocks('boxes_column_left')) {
?>

      <div id="columnLeft" class="col-md-<?php echo $oscTemplate->getGridColumnWidth(); ?>  col-md-pull-<?php echo $oscTemplate->getGridContentWidth(); ?>">
        <?php echo $oscTemplate->getBlocks('boxes_column_left'); ?>
      </div>
Template_top.php
<div id="bodyContent" class="col-md-<?php echo $oscTemplate->getGridContentWidth(); ?> <?php echo ($oscTemplate->hasBlocks('boxes_column_left') ? <div id="bodyContent" class="col-md-<?php echo $oscTemplate->getGridContentWidth(); ?> <?php echo ($oscTemplate->hasBlocks('boxes_column_left') ? 'col-md-push-' . $oscTemplate->getGridColumnWidth() : ''); ?>">. $oscTemplate->getGridColumnWidth() : ''); ?>">

And remove 'col-md-push-'  

I guess the code which needs changing maybe somewhere else.

 

Can someone tell me please what I need to do.

 

 

 

Many thanks

Grandpa

 

Link to comment
Share on other sites

@@grandpaj

I think that you to have to make some changing in   /includes/classes/boxes.php, If i am not wrong.

OR

You can hide all the boxes from index page. you have to edit into the box module e.g. bm_information.php ....etc (YOU HAVE TO MAKE THE CHANGING TO ALL THE BOXES SO  THE  LEFT COLUMN WILL NOT SHOWN IN INDEX PAGE )

/includes/modules/boxes/

 function isEnabled() {
      return $this->enabled;
    }

and replace it with

//function isEnabled() {
     // return $this->enabled;
  //  }
	  function isEnabled() {
     global $PHP_SELF, $category_depth;
     if(($PHP_SELF == 'index.php') and ($category_depth == 'top')) {
      $this->enabled = false;
      }else{
      return $this->enabled;
      }
    }

you can read about hide the boxes here http://www.oscommerce.com/forums/topic/402766-remove-categories-box-only-on-home-page/

 

BR

Omar

Get the latest Responsive osCommerce CE (community edition) here .

Link to comment
Share on other sites

You could do something like below in template top and template bottom.

if (basename($PHP_SELF) == 'index.php') {
  // your index layout
} else {
  // every other page
}

I have colums come and go and resize body based on screen size like so in template top

    <div id="bodyContent" class="col-sm-9 col-md-8 col-sm-push-3 col-md-push-2">

and in template bottom

<?php
  if ($oscTemplate->hasBlocks('boxes_column_left')) {
?>

      <div id="columnLeft" class="col-sm-3 col-md-2 col-sm-pull-9 col-md-pull-8">
        <?php echo $oscTemplate->getBlocks('boxes_column_left'); ?>
      </div>

<?php
  }

  if ($oscTemplate->hasBlocks('boxes_column_right')) {
?>

      <div id="columnRight" class="col-md-2 hidden-sm hidden-xs">
        <?php echo $oscTemplate->getBlocks('boxes_column_right'); ?>
      </div>

<?php
  }
?>

I don't know if this helps with your ideas or gives you new ones.

I'm not really a dog.

Link to comment
Share on other sites

@@John W

 

Hi John

 

I think Im rather thick, couldn't get the above to work.Maybe I was inserting the code into the wrong places.

However I seem to remember sometime ago (a few years) that there was something about not showing the left column on the index page but on all others and I think there was a reference to modifying a little piece of code in function>html_output.php.

 

Cheers and thanks

Grandp

Link to comment
Share on other sites

Hi Grandpa,

 

That code wasn't ready to go but a reference as an idea.  If I have time in the morning I'll try and work this out for you that you can insert.  I wasn't sure how far along you've come with Bootstrap. 

I'm not really a dog.

Link to comment
Share on other sites

@@grandpa Something like this should work. Change as follows. You would need to change both template_top and bottom. While changing the module function will work, this way would result in less checking so the page load times would be better. Also, you said you wanted to prevent them from showing on the index page. If you meant that, then this will work. But if you meant the home page, then you would have to add the check for $category_depth == 'top'.

  if ($oscTemplate->hasBlocks('boxes_column_left')) {
  $ok = (basename($PHP_SELF) == 'index.php') ? false : true);
  if ($ok && $oscTemplate->hasBlocks('boxes_column_left')) {

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

@@Jack_mcs

Hi Jack

 

I did mean "top"

 

I guess Im just an expert in copy and paste.

This is what I have tried (and other combo's) in template_bottom.php, to no avail, as you will probably guess, it just "screws" the page

    </div> <!-- bodyContent //-->

<?php
  if ($oscTemplate->hasBlocks('boxes_column_left')) {
  $ok = (basename($PHP_SELF) == 'index.php') ? false : true);
  if ($ok && $oscTemplate->hasBlocks('boxes_column_left')) {
?>

      <div id="columnLeft" class="col-md-<?php echo $oscTemplate->getGridColumnWidth(); ?>  col-md-pull-<?php echo $oscTemplate->getGridContentWidth(); ?>">
        <?php echo $oscTemplate->getBlocks('boxes_column_left'); ?>
      </div>

<?php

In template_top.php I have this.

Released under the GNU General Public License
*/

  $oscTemplate->buildBlocks();

  if (!$oscTemplate->hasBlocks('boxes_column_left')) {
    $oscTemplate->setGridContentWidth($oscTemplate->getGridContentWidth() + $oscTemplate->getGridColumnWidth());
 $ok = (basename($PHP_SELF) == 'index.php') ? false : true);
  if ($ok && $oscTemplate->hasBlocks('boxes_column_left')) { 
  }

  if (!$oscTemplate->hasBlocks('boxes_column_right')) {
    $oscTemplate->setGridContentWidth($oscTemplate->getGridContentWidth() + $oscTemplate->getGridColumnWidth());
  }
?>
<!DOCTYPE html>

Look forward to any comments.

 

Many thanks

Grandp

Link to comment
Share on other sites

Remove the changes you made and then replace this

if (!$oscTemplate->hasBlocks('boxes_column_left')) {

with this

 $ok = (basename($PHP_SELF) == 'index.php') ? false : true);
  if ($ok && $oscTemplate->hasBlocks('boxes_column_left')) { 

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

@@Jack_mcs

 

Hi Jack

 

Many thanks

 

Replaced as above, but now get this error

Parse error: syntax error, unexpected ')' in /home/xxxx/dev.grandpas.co.nz/includes/template_top.php on line 15

 

Line 15 is, $ok = (basename($PHP_SELF) == 'index.php') ? false : true);

 

Cheers

Grandp

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...