Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Don't show search infobox on default page


Marc_J

Recommended Posts

Posted

I need to put a check in includes\column_left.php so that my search infobox only shows on the default (home) page.

 

I looked in index.php for a clue, but infortunately that checks for everything else (categories, manufacturers etc) and then shows the default page as an else at the end.

 

The reason is that I've included a search elsewhere on my homepage and I don't want to double up by having another search in the left column, but the one in the left column should be there on all other pages.

Posted

I tried this: -

 

 if ($category_depth != 'top') {
 require(DIR_WS_BOXES . 'search.php');
}

 

Which almost worked, except this doesn't allow for when listing by manufacturer from the top.

Posted

try

 

if( basename($PHP_SELF) == FILENAME_DEFAULT && !count($HTTP_GET_VARS) ) {
require(DIR_WS_BOXES . 'search.php');
}

Posted
try

 

if( basename($PHP_SELF) == FILENAME_DEFAULT && !count($HTTP_GET_VARS) ) {
require(DIR_WS_BOXES . 'search.php');
}

 

Thanks enigma, this does the opposite of what I need - the infobox shows on the default page but not on any others!

 

I tried changing the == to a != but that had undesired results, too...the search infobox never showed at all!

Posted
Thanks enigma, this does the opposite of what I need - the infobox shows on the default page but not on any others!

 

OK, after looking at what I said here I thought I'd try the following: -

if( basename($PHP_SELF) == FILENAME_DEFAULT && !count($HTTP_GET_VARS) ) {
} else { 
require(DIR_WS_BOXES . 'search.php');
}

Which worked! Although I think this may be the 'clumsy' way to do it, and there must be a better way?

Posted
OK, after looking at what I said here I thought I'd try the following: -
if( basename($PHP_SELF) == FILENAME_DEFAULT && !count($HTTP_GET_VARS) ) {
} else { 
require(DIR_WS_BOXES . 'search.php');
}

Which worked! Although I think this may be the 'clumsy' way to do it, and there must be a better way?

 

if( (basename($PHP_SELF) == FILENAME_DEFAULT) and (!isset($HTTP_GET_VARS['cPath'])) ) {

require(DIR_WS_BOXES . 'search.php');

}

Treasurer MFC

Posted
Thanks enigma, this does the opposite of what I need - the infobox shows on the default page but not on any others!

 

I tried changing the == to a != but that had undesired results, too...the search infobox never showed at all!

 

Sorry I thought you wanted the search only on the default page; for the opposite just use

 

if( basename($PHP_SELF) == FILENAME_DEFAULT && count($HTTP_GET_VARS) ) {
require(DIR_WS_BOXES . 'search.php');
}

 

---------------------------------------------

The cpath global is set on many stores I've seen, regardless of the script running (although is set to nothing) so I tend to avoind checking it for set/clear.

Posted
Sorry I thought you wanted the search only on the default page;

 

Thanks again enigma, I just noticed I'd made a mistake in my intitial post! It's handy to have both anyway :)

Posted

ok now the last code I posted theoretically should show the search box on the index.php page if get parameters are present.

Posted
ok now the last code I posted theoretically should show the search box on the index.php page if get parameters are present.

 

Sorry, forgot to say, your last code did exactly what I wanted, thanks :)

  • 2 weeks later...
Posted

I'm trying to do the same thing with my site currently and both of the codes by Enigma work but as he said only if GET parameters are present. Therefore when using

 

if( basename($PHP_SELF) == FILENAME_DEFAULT && count($HTTP_GET_VARS) ) {
require(DIR_WS_BOXES . 'search.php');
}

 

No infobox shows on the product page or contact pages or things like this but all other pages seem to work fine.

 

Is there another way to do this?

Posted

to include your products info page

if( (basename($PHP_SELF) == FILENAME_DEFAULT && count($HTTP_GET_VARS)) || basename($PHP_SELF) == FILENAME_PRODUCT_INFO  ) {
require(DIR_WS_BOXES . 'search.php');
}

Posted

I had never even checked other pages (shipping, privacy, product info etc.) for the search box - thanks for pointing this out, ripthesystem. I was only checking variants of index.php.

 

I don't want to add extra checks for these pages (as your example does for FILENAME_PRODUCT_INFO, enigma), as I have a lot of extra pages added in the information box and might add more in the future, and I don't want to have to update my column_left.php every time I do.

 

So, I went back to my original modification of enigma's code and put this back in: -

 

if( basename($PHP_SELF) == FILENAME_DEFAULT && !count($HTTP_GET_VARS) ) {
} else { 
require(DIR_WS_BOXES . 'search.php');
}

 

which now, I think, turns out to be a better way of doing it. For me, anyway.

Archived

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

×
×
  • Create New...