Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

how to make the main banner disappear


younmever

Recommended Posts

Hello forum members,

 

I have installed a template. There are three banners on the first page.

When I click on any, two sub banners disappear, but the main one remains.

 

I found out that the main banner belongs to header.php and two sub banners are in new_product.php.

 

I'd like to make the main banner disappear when I click on any so that I can see only product listings.

 

Could you guys help me out please?

 

Thanks a lot

Link to comment
Share on other sites

Not meaning to be rude, crude, or obnoxious but the answer to your question is in your first post:

 

Hello forum members,

 

I have installed a template. There are three banners on the first page.

When I click on any, two sub banners disappear, but the main one remains.

 

I found out that the main banner belongs to header.php and two sub banners are in new_product.php.

 

I'd like to make the main banner disappear when I click on any so that I can see only product listings.

 

Could you guys help me out please?

 

Thanks a lot

No one can answer your question because we don't have that template code to look at.

 

All we have is "standard" osC code.

:blush:

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

Since the header.php is getting included in every file, and since header.php includes the banner, it's obvious that the banner will appear on every page.

 

What you could do is to add a if/else so that the banner shows only under specified conditions, that can be specific files, or on index.php (that "serves" all product listings etc) depending on the category depth. You can look how the statements are done in file index.php

 

You need to take care about how you want your header to look like if the banner is not there

Link to comment
Share on other sites

Thanks a lot for your advise, George.

 

Your advice sounds easy but it is acturally extremely difficult for ma as of a newbee in this field.

Also like you explained below, I will have to take care what is replacing in the banner's place when the banner doesn't exist too.

 

Does anyone wanna give it a try?

I'll pay for that.

Link to comment
Share on other sites

Thanks a lot for your advise, George.

 

Your advice sounds easy but it is acturally extremely difficult for ma as of a newbee in this field.

Also like you explained below, I will have to take care what is replacing in the banner's place when the banner doesn't exist too.

 

Does anyone wanna give it a try?

I'll pay for that.

 

As Jim said, since you have a template, nobody can tell you exactly what to do, because nobody knows exactly how your template is structured. Only the template maker, but I guess that he doesn't offer any support.

 

Anyway, to start somewhere, the best would be you provide a link to your site and post here the contents of file [catalog]/includes/header.php

 

PS1 Please use the "code tags" to place the filecontents into, to apply them use the symbol "<>" on the top of the reply menu

this text is in code tags

PS2 Do not offer payment, it's against the forum rules and also it doesn't increase your chances for useful responses, more likely for spam in your mailbox IMHO

Link to comment
Share on other sites

Thank you very much for your kind advise, George.

I didn't know about the rule, so I'll take it back if I could.

 

Here is the header.php

Could you please check where I have to look at?

 

 

<?php
/*
 $Id: header.php,v 1.42 2003/06/10 18:20:38 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

// check if the 'install' directory exists, and warn of its existence
 if (WARN_INSTALL_EXISTENCE == 'true') {
   if (file_exists(dirname($HTTP_SERVER_VARS['SCRIPT_FILENAME']) . '/install')) {
     $messageStack->add('header', WARNING_INSTALL_DIRECTORY_EXISTS, 'warning');
   }
 }

// check if the configure.php file is writeable
 if (WARN_CONFIG_WRITEABLE == 'true') {
   if ( (file_exists(dirname($HTTP_SERVER_VARS['SCRIPT_FILENAME']) . '/includes/configure.php')) && (is_writeable(dirname($HTTP_SERVER_VARS['SCRIPT_FILENAME']) . '/includes/configure.php')) ) {
     $messageStack->add('header', WARNING_CONFIG_FILE_WRITEABLE, 'warning');
   }
 }

// check if the session folder is writeable
 if (WARN_SESSION_DIRECTORY_NOT_WRITEABLE == 'true') {
   if (STORE_SESSIONS == '') {
     if (!is_dir(tep_session_save_path())) {
       $messageStack->add('header', WARNING_SESSION_DIRECTORY_NON_EXISTENT, 'warning');
     } elseif (!is_writeable(tep_session_save_path())) {
       $messageStack->add('header', WARNING_SESSION_DIRECTORY_NOT_WRITEABLE, 'warning');
     }
   }
 }

// check session.auto_start is disabled
 if ( (function_exists('ini_get')) && (WARN_SESSION_AUTO_START == 'true') ) {
   if (ini_get('session.auto_start') == '1') {
     $messageStack->add('header', WARNING_SESSION_AUTO_START, 'warning');
   }
 }

 if ( (WARN_DOWNLOAD_DIRECTORY_NOT_READABLE == 'true') && (DOWNLOAD_ENABLED == 'true') ) {
   if (!is_dir(DIR_FS_DOWNLOAD)) {
     $messageStack->add('header', WARNING_DOWNLOAD_DIRECTORY_NON_EXISTENT, 'warning');
   }
 }

 if ($messageStack->size('header') > 0) {
   echo $messageStack->output('header');
 }
?>
<!--




<?   // ---- MANUFACTURERS


 $manufacturers_query = tep_db_query("select manufacturers_id, manufacturers_name from " . TABLE_MANUFACTURERS . " order by manufacturers_name");
 if ($number_of_rows = tep_db_num_rows($manufacturers_query)) {

     echo '<table cellspacing=0 cellpadding=0 width=177 align=center> '.
             tep_draw_form('manufacturers', tep_href_link(FILENAME_DEFAULT, '', 'NONSSL', false), 'get')
            .' <tr><td colspan=2><b>Search by manufacturers:</b></td></tr>
               <tr><td height=2 colspan=2></td></tr>
               <tr><td colspan=2>
          ';      

     $manufacturers_array = array();
     while ($manufacturers = tep_db_fetch_array($manufacturers_query)) {
       $manufacturers_name = ((strlen($manufacturers['manufacturers_name']) > MAX_DISPLAY_MANUFACTURER_NAME_LEN) ? substr($manufacturers['manufacturers_name'], 0, MAX_DISPLAY_MANUFACTURER_NAME_LEN) . '..' : $manufacturers['manufacturers_name']);
       $manufacturers_array[] = array('id' => $manufacturers['manufacturers_id'],
                                      'text' => $manufacturers_name);
     }

     echo tep_draw_pull_down_menu('manufacturers_id', $manufacturers_array, (isset($HTTP_GET_VARS['manufacturers_id']) ? $HTTP_GET_VARS['manufacturers_id'] : ''), 'onChange="this.form.submit();" size="' . MAX_MANUFACTURERS_LIST . '" class=se1') . tep_hide_session_id();
     echo ' </td>
         </form>
        </table>
          ';
 }

?>


-->



 <table cellspacing=0 cellpadding=0 width=742 height=100% align=center>
  <tr><td valign=top>
   <table cellspacing=0 cellpadding=0>
    <tr><td width=211><a href=<?=tep_href_link('index.php')?>><img src=images/m01.gif width=211 height=85 border=0></a></td>
    <td colspan=2 width=531 valign=top>
     <table cellspacing=0 cellpadding=0 width=531>
      <tr><td height=21></td></tr>
      <tr><td align=right><a href=<?=tep_href_link('specials.php')?> class=ml1>Specials</a><span class=ch1></span><img src=images/m02.gif width=1 height=11 align=absmiddle><span class=ch1></span><a href=<?=tep_href_link('advanced_search.php')?> class=ml1>Site Search</a><span class=ch1></span><img src=images/m02.gif width=1 height=11 align=absmiddle><span class=ch1></span><a href=<?=tep_href_link('contact_us.php')?> class=ml1>Contact Us</a><span class=ch1></span><img src=images/m02.gif width=1 height=11 align=absmiddle><span class=ch1></span><?php if (tep_session_is_registered('customer_id')) { 
?><a class=ml1 href="<?php echo tep_href_link('account.php')?>"><?php echo HEADER_TITLE_MY_ACCOUNT ;?></a><?php } else 
{ ?><a class=ml1 href="<?php echo tep_href_link('create_account.php')?>"><?php echo HEADER_TITLE_CREATE_ACCOUNT ;?></a><?php } 
?><span class=ch1></span><img src=images/m02.gif width=1 height=11 align=absmiddle><span class=ch1></span>
<?php if (tep_session_is_registered('customer_id')) { 
?><a class=ml1 href="<?php echo tep_href_link('logoff.php')?>"><?php echo HEADER_TITLE_LOGOFF ;?></a><?php } else 
{ ?><a class=ml1 href="<?php echo tep_href_link('login.php')?>"><?php echo HEADER_TITLE_LOGIN  ;?></a><?php } 
?><span style="padding-left: 5px"></span></td></tr>
      <tr><td height=15></td></tr>
      <tr><td align=right><a href=<?=tep_href_link('index.php')?>><img src=images/b01.gif width=104 height=35 border=0></a><span class=ch2></span><a href=<?=tep_href_link('products_new.php')?>><img src=images/b02.gif width=104 height=35 border=0></a><span class=ch2></span><a href=<?=tep_href_link('account.php')?>><img src=images/b03.gif width=104 height=35 border=0></a><span class=ch2></span><a href=<?=tep_href_link('shopping_cart.php')?>><img src=images/b04.gif height=35 border=0></a><span class=ch2></span><a href=<?=tep_href_link('checkout_shipping.php')?>><img src=images/b05.gif width=104 height=35 border=0></a></td></tr>
     </table>
    </td></tr>
    <tr><td height=1></td></tr>
    <tr><td bgcolor=#DCDFE0 width=211 height=34 align=center> 
     <table cellspacing=0 cellpadding=0>
      <tr><td width=65 class=ch3>Currencies:</td>
      <td width=109>
<? // CURRENCIES

   echo tep_draw_form('currencies', tep_href_link(basename($PHP_SELF), '', $request_type, false), 'get');

   reset($currencies->currencies);
   $currencies_array = array();
   while (list($key, $value) = each($currencies->currencies)) {
     $currencies_array[] = array('id' => $key, 'text' => $value['title']);
   }

   $hidden_get_variables = '';
   reset($HTTP_GET_VARS);
   while (list($key, $value) = each($HTTP_GET_VARS)) {
     if ( ($key != 'currency') && ($key != tep_session_name()) && ($key != 'x') && ($key != 'y') ) {
       $hidden_get_variables .= tep_draw_hidden_field($key, $value);
     }
   }

   echo tep_draw_pull_down_menu('currency', $currencies_array, $currency, 'onChange="this.form.submit(); "class=se  ') . $hidden_get_variables . tep_hide_session_id();
   echo '</form>';

?>               

      </td></tr>
     </table>
    </td>
    <td bgcolor=#EFF2F3 width=273 height=35 align=center>
     <table cellspacing=0 cellpadding=0 align=center>
      <tr><td width=138 class=ch3>Choose your language:</td>
      <td>
<? // LANGUAGES

 if (!isset($lng) || (isset($lng) && !is_object($lng))) {
   include(DIR_WS_CLASSES . 'language.php');
   $lng = new language;
 }

 $languages_string = '';
 reset($lng->catalog_languages);
 while (list($key, $value) = each($lng->catalog_languages)) {
   $languages_string .= ' <a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('language', 'currency')) . 'language=' . $key, $request_type) . '">' . tep_image(DIR_WS_LANGUAGES .  $value['directory'] . '/images/' . $value['image'], $value['name']) . '</a> ';
 }

 echo $languages_string;

?>     


      </td></tr>  
     </table> 
    </td>
    <td bgcolor=#E6E9E9 width=258 align=center>
     <table cellspacing=0 cellpadding=0 align=center>
      <tr><td width=24><a href=<?=tep_href_link('shopping_cart.php')?>><img src=images/m06.gif border=0></a></td>
      <td width=83 class=ch3>Shopping cart:</td>
      <td class=ch4>now in your cart <a class=ml2 href=<?=tep_href_link('shopping_cart.php')?>><?=$cart->count_contents()?> items</a></td></tr>
     </table>
    </td></tr>
   </table>
  </td></tr>
  <tr><td height=100% valign=top>
   <table cellspacing=0 cellpadding=0 width=742>
    <tr><td width=211 valign=top style="padding-right: 5px">
     <table cellspacing=0 cellpadding=0 width=211>
      <tr><td height=3></td></tr>
      <tr><td background=images/m07.gif width=211 height=30><span style="padding-left: 10px"></span><span class=ch5>Browse by category</span></td></tr>  

<?   // ---- CATEGORIES

 function tep_show_category($counter) {
   global $tree, $categories_string, $cPath_array;

  if(!$tree[$counter]['level']){               

   $categories_string .= $categories_string ? '' : '';             

   $categories_string .= '<tr><td background=images/m08.gif width=211 height=20><span class=ch6></span><a class=ml3 href=';

   if ($tree[$counter]['parent'] == 0) {
     $cPath_new = 'cPath=' . $counter;
   } else {
     $cPath_new = 'cPath=' . $tree[$counter]['path'];
   }
   $categories_string .= tep_href_link('index.php', $cPath_new) . '>';
// display categry name
   $categories_string .= $tree[$counter]['name'];
   $categories_string .= '</a></td></tr> ';

  }else{  // SUBCATEGORY

   $categories_string .= '<tr><td background=images/m08.gif width=211 height=20><span class=ch6></span>  ';

   for($i=0;$i<$tree[$counter]['le vel'];$i++)
    $categories_string .= '     ';

   $categories_string .= '     <a class=ml3 style="font-weight:normal;" href=';   
   if ($tree[$counter]['parent'] == 0) {
     $cPath_new = 'cPath=' . $counter;
   } else {
     $cPath_new = 'cPath=' . $tree[$counter]['path'];
   }
   $categories_string .= tep_href_link('index.php', $cPath_new) . '>-';
// display category name
   $categories_string .= $tree[$counter]['name'];
   $categories_string .= '</a></td></tr>';
  }  

   if ($tree[$counter]['next_id'] != false) {
     tep_show_category($tree[$counter]['next_id']);
   }  
 }



 define(TABLE_CATEGORIES, "categories");
 define(TABLE_CATEGORIES_DESCRIPTION, "categories_description");
 $categories_string = '';
 $tree = array();

 $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '0' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name");
 while ($categories = tep_db_fetch_array($categories_query))  {
   $tree[$categories['categories_id']] = array('name' => $categories['categories_name'],
                                               'parent' => $categories['parent_id'],
                                               'level' => 0,
                                               'path' => $categories['categories_id'],
                                               'next_id' => false);

   if (isset($parent_id)) {
     $tree[$parent_id]['next_id'] = $categories['categories_id'];
   }

   $parent_id = $categories['categories_id'];

   if (!isset($first_element)) {
     $first_element = $categories['categories_id'];
   }
 }

 //------------------------
 if ($cPath) {
   $new_path = '';
   reset($cPath_array);
   while (list($key, $value) = each($cPath_array)) {
     unset($parent_id);
     unset($first_id);
     $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$value . "' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name");
     if (tep_db_num_rows($categories_query)) {
       $new_path .= $value;
       while ($row = tep_db_fetch_array($categories_query)) {
         $tree[$row['categories_id']] = array('name' => $row['categories_name'],
                                              'parent' => $row['parent_id'],
                                              'level' => $key+1,
                                              'path' => $new_path . '_' . $row['categories_id'],
                                              'next_id' => false);

         if (isset($parent_id)) {
           $tree[$parent_id]['next_id'] = $row['categories_id'];
         }

         $parent_id = $row['categories_id'];

         if (!isset($first_id)) {
           $first_id = $row['categories_id'];
         }

         $last_id = $row['categories_id'];
       }
       $tree[$last_id]['next_id'] = $tree[$value]['next_id'];
       $tree[$value]['next_id'] = $first_id;
       $new_path .= '_';
     } else {
       break;
     }
   }
 }
 $categories_string .=  '';
 tep_show_category($first_element); 
 $categories_string .=  '';

 echo $categories_string;
?>



       <tr><td background=images/m09.gif width=211 height=30><span style="padding-left: 10px"></span><span class=ch7>Browse by brand</span></td></tr>  
<?   // ---- MANUFACTURERS STRING OUTPUT


 $manufacturers_query = tep_db_query("select manufacturers_id, manufacturers_name from " . TABLE_MANUFACTURERS . " order by manufacturers_name");
 if ($number_of_rows = tep_db_num_rows($manufacturers_query)) {

     $manufacturers_array = array();
     while ($manufacturers = tep_db_fetch_array($manufacturers_query)) {
       $output .= $output ? '' : '';             
       $output .= '<tr><td background=images/m08.gif width=211 height=20><span class=ch6></span><a class=ml3 href=';
       $manufacturers_name = ((strlen($manufacturers['manufacturers_name']) > MAX_DISPLAY_MANUFACTURER_NAME_LEN) ? substr($manufacturers['manufacturers_name'], 0, MAX_DISPLAY_MANUFACTURER_NAME_LEN) . '..' : $manufacturers['manufacturers_name']);
       $output .= tep_href_link('index.php', 'manufacturers_id='.$manufacturers['manufacturers_id']). '>'.$manufacturers_name;
       $output .= '</a></td></tr>';
     }

   echo $output;
 }

?>


       <tr><td background=images/m10.gif width=211 height=112 style="padding-left: 19px" valign=top>
<? // SEARCH ?> 
       <table cellspacing=0 cellpadding=0 width=174>
       <?=tep_draw_form('quick_find', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get')?>
        <tr><td height=12</td></tr>
        <tr><td class=ch8>Site Search</td></tr>
        <tr><td height=22></td></tr>
        <tr><td width=146>
        <?=tep_draw_input_field('keywords', '', 'size="20" maxlength="50"    onclick="this.value=\'\'" value="keyword"   class=se2') . ' ' . tep_hide_session_id()?></td><td><input type=image src=images/m12.gif></td></tr>
         </form>
       </table>

<? // END SEARCH ?>

         </td></tr>
     </table>
    </td>
    <td valign=top width=526 valign=top align=right> 
     <table cellspacing=0 cellpadding=0 width=526>
      <tr><td height=3></td></tr>
      <tr><td><a href=<?=tep_href_link('index.php')?>><img src=images/m13.jpg width=281 height=226 border=0><img src=images/m14.jpg width=245 height=226 border=0></a></td></tr> 
      <tr><td background=images/m15.gif height=1></td></tr>
     </table>


Link to comment
Share on other sites

Hi, holiday is over :(

 

So, ok, what I understood is that you want this "top banner" to appear only on the "home page" and on no other pages

 

To do so, find following lines at the bottom of your file includes/header.php

 <table cellspacing=0 cellpadding=0 width=526>
      <tr><td height=3></td></tr>
      <tr><td><a href=<?=tep_href_link('index.php')?>><img src=images/m13.jpg width=281 height=226 border=0><img src=images/m14.jpg width=245 height=226 border=0></a></td></tr> 
      <tr><td background=images/m15.gif height=1></td></tr>
     </table>

and replace them with

     <?php if((basename($PHP_SELF) == FILENAME_DEFAULT) && !$cPath) { ?>
     <table cellspacing=0 cellpadding=0 width=526>
      <tr><td height=3></td></tr>
      <tr><td><a href=<?=tep_href_link('index.php')?>><img src=images/m13.jpg width=281 height=226 border=0><img src=images/m14.jpg width=245 height=226 border=0></a></td></tr> 
      <tr><td background=images/m15.gif height=1></td></tr>
     </table>
    <?php }?>

The table that contains the 2 images your banner consist of, is wrapped now into a "if" condition. This can be altered to show or not this banner on some pages. Right now it says to show the banner only on index.php and only if there is no category selected (=> homepage)

Link to comment
Share on other sites

George,

 

First of all, I'm truely appreciated for being back on my issue.

 

And it was amazing when I saw the results.

Change a little bit code you provided makes my site look totally different in a good way.

Actully you know what?

I didn't feel very good because I felt like I'm a dummy and you are a genious. :P

 

Again, thank you very very much and you have a wonderful one today

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...