osCommerce Community Support Forums: Thema Modification - osCommerce Community Support Forums

Jump to content

Corporate Sponsor


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Thema Modification Rate Topic: -----

#1 User is offline   Player0 Icon

  • Find Posts
  • Group: Community Member
  • Posts: 64
  • Joined: 15-April 03
  • Real Name:Tom Lamay
  • Location:Hudson Valley, NY, USA

Posted 22 April 2003 - 07:42 PM

Hi folks, I'm still new here, but I've been coding for osC now for the past couple weeks, and wanted to share some of the things I have done since all of you have helped me out in the same ways. I'm not good enough to be making official contributions yet, but I wanted to share a few snippets here and there.

Anyway, I installed the Thema contribution on my site which really works well and makes theming my various stores much much simpler. But I wanted the ability to add static images as headers for the info boxes. There are contributions out there, but they really didn't jive with the whole 'Thema' raison d'etre. So I modified /classes/thema_boxes.php, replacing one of the tablebox functions with this:

  class infoBoxHeading extends tableBox {

    function infoBoxHeading($contents, $left_corner = true, $right_corner = true, $right_arrow = false) {

      // *** Modified by TRL 20030421 - Adds Static Image Header Functionality on Switch basis:

      $this->table_cellpadding = '0';

      

      $trl_img_pre = '<table border="0" width="100%" cellspacing="0" cellpadding="0"><tr><td>';

      $trl_img_suf = '</td></tr></table>';

      

      if ($right_arrow) {

     	 $trl_img_pre .= '<a href="' . $right_arrow . '">';

     	 $trl_img_suf = '</a>' . $trl_img_suf;

      }

      

      switch ($contents[0]['text']) {

      case BOX_HEADING_CATEGORIES:

     	 echo $trl_img_pre . tep_image(DIR_WS_IMAGES . 'infobox/thema/' . SITE_THEMA . '/tit_categories.gif', BOX_HEADING_CATEGORIES, BOX_WIDTH_LEFT_IS, BOX_HEADER_HEIGHT_IS) . $trl_img_suf;

      break;

      

      case BOX_HEADING_MANUFACTURERS:

        echo $trl_img_pre . tep_image(DIR_WS_IMAGES . 'infobox/thema/' . SITE_THEMA . '/tit_manufact.gif', BOX_HEADING_MANUFACTURERS, BOX_WIDTH_LEFT_IS, BOX_HEADER_HEIGHT_IS) . $trl_img_suf;

      break;

      

      case BOX_HEADING_SEARCH:

        echo $trl_img_pre . tep_image(DIR_WS_IMAGES . 'infobox/thema/' . SITE_THEMA . '/tit_search.gif', BOX_HEADING_SEARCH, BOX_WIDTH_LEFT_IS, BOX_HEADER_HEIGHT_IS) . $trl_img_suf;

      break;

      

      case BOX_HEADING_INFORMATION:

        echo $trl_img_pre . tep_image(DIR_WS_IMAGES . 'infobox/thema/' . SITE_THEMA . '/tit_information.gif', BOX_HEADING_INFORMATION, BOX_WIDTH_LEFT_IS, BOX_HEADER_HEIGHT_IS) . $trl_img_suf;

      break;

      

      case BOX_HEADING_SHOPPING_CART:

        echo $trl_img_pre . tep_image(DIR_WS_IMAGES . 'infobox/thema/' . SITE_THEMA . '/tit_shopcart.gif', BOX_HEADING_SHOPPING_CART, BOX_WIDTH_LEFT_IS, BOX_HEADER_HEIGHT_IS) . $trl_img_suf;

      break;

      

      case BOX_HEADING_BESTSELLERS:

        echo $trl_img_pre . tep_image(DIR_WS_IMAGES . 'infobox/thema/' . SITE_THEMA . '/tit_bestseller.gif', BOX_HEADING_BESTSELLERS, BOX_WIDTH_LEFT_IS, BOX_HEADER_HEIGHT_IS) . $trl_img_suf;

      break;  

      

      case BOX_HEADING_SPECIALS:

        echo $trl_img_pre . tep_image(DIR_WS_IMAGES . 'infobox/thema/' . SITE_THEMA . '/tit_special.gif', BOX_HEADING_SPECIALS, BOX_WIDTH_LEFT_IS, BOX_HEADER_HEIGHT_IS) . $trl_img_suf;

      break;



      case BOX_HEADING_WHATS_NEW:

        echo $trl_img_pre . tep_image(DIR_WS_IMAGES . 'infobox/thema/' . SITE_THEMA . '/tit_new.gif', BOX_HEADING_WHATS_NEW, BOX_WIDTH_LEFT_IS, BOX_HEADER_HEIGHT_IS) . $trl_img_suf;

      break;

      

      case BOX_HEADING_CUSTOMER_ORDERS:

        echo $trl_img_pre . tep_image(DIR_WS_IMAGES . 'infobox/thema/' . SITE_THEMA . '/tit_history.gif', BOX_HEADING_CUSTOMER_ORDERS, BOX_WIDTH_LEFT_IS, BOX_HEADER_HEIGHT_IS) . $trl_img_suf;

      break;



      default:

   	 if ($left_corner) {

       	 $left_corner = tep_image(DIR_WS_IMAGES . 'infobox/thema/' . SITE_THEMA . '/corner_left.gif');

     	 } else {

       	 $left_corner = tep_image(DIR_WS_IMAGES . 'infobox/thema/' . SITE_THEMA . '/corner_right_left.gif');

     	 }

     	 if ($right_arrow) {

       	 $right_arrow = '<a href="' . $right_arrow . '">' . tep_image(DIR_WS_IMAGES . 'infobox/thema/' . SITE_THEMA . '/arrow_right.gif', ICON_ARROW_RIGHT) . '</a>';

      } else {

       	 $right_arrow = '';

      }

     	 if ($right_corner) {

       	 $right_corner = $right_arrow . tep_image(DIR_WS_IMAGES . 'infobox/thema/' . SITE_THEMA . '/corner_right.gif');

     	 } else {

       	 $right_corner = $right_arrow . tep_draw_separator('pixel_trans.gif', '11', '14');

     	 }



     	 $info_box_contents = array();

     	 $info_box_contents[] = array(array('params' => 'height="14" class="infoBoxHeading"', 'text' => $left_corner),

                                   array('params' => 'width="100%" height="14" class="infoBoxHeading"', 'text' => $contents[0]['text']),

                                   array('params' => 'height="14" class="infoBoxHeading"', 'text' => $right_corner));

     	 $this->tableBox($info_box_contents, true);

      }

    }

  }


As you can follow from the code, I basically just added a big SWITCH command. Whatever infobox is being called for being drawn will have a 'text' parameter named something like BOX_HEADING_CUSTOMER_ORDERS. As long as there is a CASE for each info box that might show up, it will load the appropriate image (which is stored in the standard Thema images folder). The beauty of this is though, if a box DOESNT have a CASE assigned here, it will default to displaying the standard looking Thema header. So you dont HAVE to have images for every possible headerbox that might show up.

To make this work, you will also need to define the following somewhere. This just stores the header-image height. I set this to 20 for my site, which means all the header images need to be 20 pixes high. Pre-setting this makes image loading much cleaner as pages load:
BOX_HEADER_HEIGHT_IS

It ain't pretty, and requires a bit of manual editing, but it does work and is pretty flexible. I just thought someone out there might be looking for something similar :) I dont have an example of the site up yet, as the webserver isn't live on the net yet, but I will keep anyone interested updated :)
0

#2 User is offline   karcher Icon

  • Find Posts
  • Group: Community Member
  • Posts: 89
  • Joined: 13-November 02
  • Real Name:karen

Posted 25 April 2003 - 10:04 PM

Thanks Tom

Are you using a MS1 or CVS build?
K
.....................................................................
When the going get's tough,
the tough get going.
0

#3 User is offline   Player0 Icon

  • Find Posts
  • Group: Community Member
  • Posts: 64
  • Joined: 15-April 03
  • Real Name:Tom Lamay
  • Location:Hudson Valley, NY, USA

Posted 28 April 2003 - 01:33 PM

Im using MS1. I had problems with the CVS build.
0

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic