Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

PHP - simple code change??


olimits7

Recommended Posts

Posted

Hello,

 

I'm using the "banner manager" contribution and I'm having a problem with a case statement within one of the files.

 

This is the code:

// define banner group per page
// add new case statement for additional pages
switch (true) {
case ( (strstr($_SERVER['PHP_SELF'],'default') or strstr($PHP_SELF,'default')) ):
$use_banner_group = '125x125';
break;
case ( (strstr($_SERVER['PHP_SELF'],'product_info') or strstr($PHP_SELF,'product_info')) ):
$use_banner_group = 'product_info 125x125';
break;
default:
$use_banner_group = '125x125';
break;
}

 

I know the above code will show the banner on the "product_info.php" page, but I'm trying to figure out how to change the code so the banner will only display on the index.php?cPath=10 category page.

 

Does anybody know what code I have to write to make this happen??

 

Thank you,

 

olimits7

Posted

you will have to change the banner manager so it takes into account categories. If you want to hard-code you could check the cpath setting

 

if( isset($HTTP_GET_VARS['cPath']) && $HTTP_GET_VARS['cPath'] == 10 ) {

//display banner

}

 

but that will not work well with sub-categories as the cpath may include parent categories.

Posted

Thank you for your reply.

 

It seems to work fine, what you posted above. I added it to where the banner is called on the "column_right.php" file. I inserted the code you provide like you see right below.

 

if( isset($HTTP_GET_VARS['cPath']) && $HTTP_GET_VARS['cPath'] == 10 ) {

// BOF: WebMakers.com Added: Banner Manager - Column Banner
require(DIR_WS_BOXES . 'column_banner3.php');
// EOF: WebMakers.com Added: Banner Manager - Column Banner

}

 

This seems to work fine on the parent category as well as the sub-categories. I still want to show the banner even on the sub-categoriers and it seems like this works for it. The sub-categories cPath's are 10_35 and 10_32.

 

The only problem I have now is that I have the "age-page.php" contribution installed which is just a Yes/No page to see if you are over 18. The think is that it has /age-page.php?cPath=10 attached to it, so it is showing the banner on this age verification page.

 

Is there anything I can do so it doesn't show on this age-page.php page??

 

Thank you, again.

 

olimits7

Archived

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

×
×
  • Create New...