OSCOMMERCE SUPPORT CALL 702-453-3332

 

Help - Search - Members - Calendar
Full Version: column_right.php add banner image
osCommerce Community Support Forums > osCommerce Online Merchant v2.x > Contributions / Add-Ons > Templates and Images
lindsayanng
I have to admit, i am SLIGHTLY confused about the banner manager. I know that there are some banners already in place in the basic oscommerce site, like the footer has this code:

CODE
<?php
  if ($banner = tep_banner_exists('dynamic', '468x50')) {
?>
<br>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
  <tr>
    <td align="center"><?php echo tep_display_banner('static', $banner); ?></td>
  </tr>
</table>
<?php
  }
?>


So i figured if i put that code in the column_right.php and changed the parameters, like alignment and all and put it inside of an infobox it would work.. BUT IT DIDNT

I am not sure what I did wrong, so i was HOPING someone could help me with this. I really would like to have different banners around my site that link within my own site.

I basically figured out HOW to get the banners from the manager to the page, but i need to figure out how to combine them with the different parts of the site.

If you visit my website, you will see where my EDUCATIONAL LINKS banner is the the bottom of the site, where the footer is. The thing is, i want this banner on the right column somewhere below the cart contents and best sellers. I just put it there because I wanted to play and see how it all worked.

THANKS
lindsayanng
ok yea, and i TRIED this code which was in the contributions section of this site:
Column Banner Contrib.

but when i enter the code in column_right.php, i get a T-STRING error which i KNOW should not happen. Did i put it in the wrong place? there is much for instructions on the contrib.

lindsayanng
can someone PLEASE give me a hand? i really think its such an easy fix, but i can not figure it out
geoffreywalton
It is impossible to debug without something to go on.

Show examples of the code and the exact error you get.
lindsayanng
i ended up taking the code out, but the code that i WAS using was the what i had above, just added to the basic SHELL of the oscommerce. If you view my website, you will see that there was not too much for mods there, so i really wanted to see if the code i had put above was correct or not.. Is it possible that i just put it in the wrong place??

geoffreywalton
Yes.

But without seeing exactly where you put it and the error message, I give up!!
lindsayanng
Ok sorry. I will post everything as soon as I get home. Right now I am posting from my phone so I can't do it now sorry
lindsayanng
Ok this is what i did.

In the public_html/catalog/includes/column_right.php

this is what is there:

CODE
<?php
/*
  $Id: column_right.php,v 1.17 2003/06/09 22:06:41 hpdl Exp $

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

  Copyright (c) 2003 osCommerce

  Released under the GNU General Public License
*/

  require(DIR_WS_BOXES . 'shopping_cart.php');

  if (isset($HTTP_GET_VARS['products_id'])) include(DIR_WS_BOXES . 'manufacturer_info.php');

  if (tep_session_is_registered('customer_id')) include(DIR_WS_BOXES . 'order_history.php');

  if (isset($HTTP_GET_VARS['products_id'])) {
    if (tep_session_is_registered('customer_id')) {
      $check_query = tep_db_query("select count(*) as count from " . TABLE_CUSTOMERS_INFO . " where customers_info_id = '" . (int)$customer_id . "' and global_product_notifications = '1'");
      $check = tep_db_fetch_array($check_query);
      if ($check['count'] > 0) {
        include(DIR_WS_BOXES . 'best_sellers.php');
      } else {
        include(DIR_WS_BOXES . 'product_notifications.php');
      }
    } else {
      include(DIR_WS_BOXES . 'product_notifications.php');
    }
  } else {
    include(DIR_WS_BOXES . 'best_sellers.php');
  }

  if (isset($HTTP_GET_VARS['products_id'])) {
    if (basename($PHP_SELF) != FILENAME_TELL_A_FRIEND) include(DIR_WS_BOXES . 'tell_a_friend.php');
  } else {
    include(DIR_WS_BOXES . 'specials.php');
  }

  require(DIR_WS_BOXES . 'reviews.php');

  if (substr(basename($PHP_SELF), 0, 8) != 'checkout') {
    //include(DIR_WS_BOXES . 'languages.php');
    include(DIR_WS_BOXES . 'currencies.php');
  }
    require(DIR_WS_BOXES . 'payments.php');
?>
<?php



this is what i added first:

CODE
<?php
/*
  $Id: column_right.php,v 1.17 2003/06/09 22:06:41 hpdl Exp $

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

  Copyright (c) 2003 osCommerce

  Released under the GNU General Public License
*/

  require(DIR_WS_BOXES . 'shopping_cart.php');

  if (isset($HTTP_GET_VARS['products_id'])) include(DIR_WS_BOXES . 'manufacturer_info.php');

  if (tep_session_is_registered('customer_id')) include(DIR_WS_BOXES . 'order_history.php');

  if (isset($HTTP_GET_VARS['products_id'])) {
    if (tep_session_is_registered('customer_id')) {
      $check_query = tep_db_query("select count(*) as count from " . TABLE_CUSTOMERS_INFO . " where customers_info_id = '" . (int)$customer_id . "' and global_product_notifications = '1'");
      $check = tep_db_fetch_array($check_query);
      if ($check['count'] > 0) {
        include(DIR_WS_BOXES . 'best_sellers.php');
      } else {
        include(DIR_WS_BOXES . 'product_notifications.php');
      }
    } else {
      include(DIR_WS_BOXES . 'product_notifications.php');
    }
  } else {
    include(DIR_WS_BOXES . 'best_sellers.php');
  }

  if (isset($HTTP_GET_VARS['products_id'])) {
    if (basename($PHP_SELF) != FILENAME_TELL_A_FRIEND) include(DIR_WS_BOXES . 'tell_a_friend.php');
  } else {
    include(DIR_WS_BOXES . 'specials.php');
  }

  require(DIR_WS_BOXES . 'reviews.php');

  if (substr(basename($PHP_SELF), 0, 8) != 'checkout') {
    //include(DIR_WS_BOXES . 'languages.php');
    include(DIR_WS_BOXES . 'currencies.php');
  }
    require(DIR_WS_BOXES . 'payments.php');

  if ($banner = tep_banner_exists('dynamic', '468x50')) {
?>
<br>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
  <tr>
    <td align="right"><?php echo tep_display_banner('static', $banner); ?></td>
  </tr>
</table>
<?php
  }
?>


THEN i tired the contribution where i added the code from the contribution to the above first code.

Now, i am NOT good with php so PLEASE dont give me any lip for making an entirely stupid mistake or being sloppy. I have a feeling i might have just missed a small symbol or something.


this is the EXACT error code i get when i use the first form of the code:
Parse error: syntax error, unexpected '<' in /home/furryfam/public_html/catalog/includes/column_right.php on line 51
lindsayanng
OMG.. ok, now i tried to put it back by copy and pasting the code from above into the oscommece file editor and THIS is the error i am getting

Parse error: syntax error, unexpected $end in /home/furryfam/public_html/catalog/includes/column_right.php on line 50
lindsayanng
I really hope someone can help me out here
lindsayanng
ok.I got the code and everything on the column_right.php back to normal. Everything is the way it SHOULD be, but i still am having and issue integrating the banner into that side of the php code.

If someone can please help, iwould be very greatful. All of the code now looks EXACTLY like it does in my post from 2.22 am (exxcept that pesky little <?php in there is gone)
lindsayanng
haha.. i got it!!!


just for the folks out there who will probably have the same question as myself i added the following code:

CODE
if ($banner = tep_banner_exists('dynamic', '120x600')) {
?>
<br>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
  <tr>
    <td align="center"><?php echo tep_display_banner('static', $banner); ?></td>
  </tr>
</table>
<?php
  }



but where it says :
if ($banner = tep_banner_exists('dynamic', '120x600')) {

you replace the '120x600' with the banner code that you previously set up in the banner manager. Mine was 468x50 for the right column banner. It is a size that fits in the area perfectly.

You place that code before the ending php tage and youre as good as done.. WOO HOO.. i feel accomplished. I am SLOWLY getting there with the help of some books and a LOT of internet searching, and ofcoarse the help of real live people here on the forum!!

these are the two books that have helped me the most.. i TOTALLY suggest buying them if you are having problems like adding banners and such
Deep Inside Oscommerce
Building online stores with oscommerce
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.