Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

BTSv1.2 Support


paulm2003

Recommended Posts

  • Replies 377
  • Created
  • Last Reply

Top Posters In This Topic

Hi,

 

I'm using BTS version "23 Nov 2004 - BTSv1.4" , and needing to add this code:

 

<tr>
 <td background="images/greenbar.gif" height="23">
	 <p align="center"><b><font size="1" face="Tahoma" color="#FFFFFF">
	 <a href="http://example.com" class="headerNavigation">Top</a> » <a href="http://example.com/index.php?osCsid=e892ca75c4d4a3c3f9de0d6ce3b305df" class="headerNavigation">Catalog</a></font></b></td>
</tr>

 

just after this table definition:

 

<table border="0" width="100%" cellspacing="0" cellpadding="0">

 

which is at the very start of every template. Surely there is an easy way to do it, I'm no doubt missing something, but from what I can see:

 

main_page.tpl.php calls select_template_content.php

 

<td id="contentLT"><?php
       include(DIR_WS_INCLUDES . 'select_template_content.php'); // BTSv1.4

 

select_template_content.php only loads your own, and if not present, loads the 'fallback' template, of which there are some 40 templates to possibly modify. This is all select_template_content.php does.

 

<?php
 /* BTSv1.4 */   
 if (isset($content_template)) {
   // load special dynamic template from "templates/yourtemplatedir/content/" or else from "templates/fallback/content/"
   if(is_file(DIR_WS_CONTENT . $content_template)) { require(DIR_WS_CONTENT . $content_template); } else { require(DIR_WS_CONTENT_FALLBACK . $content_template); }
 } else {
   // load default/static template from "templates/yourtemplatedir/content/" or else from "templates/fallback/content/"
   if(is_file(DIR_WS_CONTENT . $content . '.tpl.php')) { require(DIR_WS_CONTENT . $content . '.tpl.php'); } else { require(DIR_WS_CONTENT_FALLBACK . $content . '.tpl.php'); }
 }
?>

 

the resulting code has to be changed from this:

 

<td id="contentLT">    <table border="0" width="100%" cellspacing="0" cellpadding="0">
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
           <td class="pageHeading"><h1>What's New Here?</h1></td>
           <td class="pageHeading" align="right"><img src="images/table_background_default.gif" border="0" alt="What's New Here?" title=" What's New Here? " width="57" height="40"></td>
         </tr>
       </table></td>
     </tr>

 

to this .............

 

<td id="contentLT">    <table border="0" width="100%" cellspacing="0" cellpadding="0">

[COLOR=blue]
<tr>
 <td background="images/greenbar.gif" height="23">
	 <p align="center"><b><font size="1" face="Tahoma" color="#FFFFFF">
	 <a href="http://example.com" class="headerNavigation">Top</a> » <a href="http://example.com/index.php?osCsid=e892ca75c4d4a3c3f9de0d6ce3b305df" class="headerNavigation">Catalog</a></font></b></td>
</tr>
[/COLOR]

     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
           <td class="pageHeading"><h1>What's New Here?</h1></td>
           <td class="pageHeading" align="right"><img src="images/table_background_default.gif" border="0" alt="What's New Here?" title=" What's New Here? " width="57" height="40"></td>
         </tr>
       </table></td>
     </tr>

 

The code to be added is in blue. You can no doubt see the dilema, this line

 

<td id="contentLT">

 

is in main_page.tpl.php , and .......

 

<table border="0" width="100%" cellspacing="0" cellpadding="0">

 

is in every "content" template. :D

 

There must be an easy way to do this. I guess the row to be added could be wrapped inside another table, and then I would only need to change either main_page.tpl.php OR select_template_content.php

 

What have other people done in this situation ?

 

Thanks,

 

Peter

Link to comment
Share on other sites

The update was a year ago, the message you quoted says it's jan 2004 i.s.o jan 2005 :D

 

You are trying to add something to the middle content area, which is partly the same but mostley different for all pages, that's why every page uses it's own template for this area.

(b.t.w. using a CSS layout you could simple put the code anywhere, and absoluteley position the output anywhere you want it)

 

 

But I see you are adding it inside the content area while it looks like you want it to appear just above the content area.

 

Can't you add somehthing like this

 <td background="images/greenbar.gif" height="23">
 <p align="center"><b><font size="1" face="Tahoma" color="#FFFFFF">
 <a href="http://example.com" class="headerNavigation">Top</a> » <a href="http://example.com/index.php" class="headerNavigation">Catalog</a></font></b></td>

inside main_page.tpl.php ? just tbefore the content is loaded.

 

So just before:

<td id="contentLT"><?php
      include(DIR_WS_INCLUDES . 'select_template_content.php'); // BTSv1.4

 

b.t.w. you know you better don't post and/or add to you code any osCsid'd ? and you need to use the tep_href_link function for links ?

 

 

edit: but please don't add it to the select_template_content.php file! That's only to be used to select the right template, becomes very confusing if you are going to add other things there. If you really need to include it, better write a new/separate include line for your own added code.

Edited by PandA.nl
Link to comment
Share on other sites

oops I see I made a little mistake: this would add a unwanted column to your layout!

 

you can add </tr><tr> for example at the end of the code, that would make a new row i.s.o. column. Or even better add the code you posted just befor the previous row starts in main_page.tpl.php

Edited by PandA.nl
Link to comment
Share on other sites

  • 3 weeks later...

Hi Paul,

 

Thanks for your replies, after a few weeks down the track, we have found BTS unsuitable, because we need to add lots of contributions. As you know most contribs have ither instructions or 'loaded' PHP files that line up to standard osCommerce files. Unfortunately, because BTS has been extensively modified, this does make adding contributions a much more difficult task.

 

Thanks,

 

Peter

Link to comment
Share on other sites

after a few weeks down the track, we have found BTS unsuitable, because we need to add lots of contributions. As you know most contribs have ither instructions or 'loaded' PHP files that line up to standard osCommerce files. Unfortunately, because BTS has been extensively modified, this does make adding contributions a much more difficult task.

TRUE of course. Allthough most contributions aren't too difficult (only applying changes to the template file instead, for example), but it won't speed up, adding lots of contributions that's for sure.

 

It's such a pitty osC still hasn't got a template stucture :( we can only wait for MS3

 

/*******************************************/

 

B.t.w. I've been playing a little with the BTS and made another version called the JTS (Just The Same template structure). It's (allmost) the same, only the files have been moved, and templates renamed and I also removed some bloat. The idea is to make it a little bit more MS3 compatible (allthough it's just guessing at the moment, I don't really know how the MS3 templatestucture will be of course).

http://www.oscommerce.com/forums/index.php?showtopic=141239

 

(adding MS2 contri's to the JTS will be exactly as "difficult" as with the BTS btw)

Edited by PandA.nl
Link to comment
Share on other sites

Hi,

 

It's such a pitty osC still hasn't got a template stucture :( we can only wait for MS3

 

Yes, I wonder if the business logic will be completely seperated from the design/layout/template side of things. Having used XOOPS on a few sites, it is so nice and easy to add a 'module', no code changes, just upload the file/s, go into admin, .. install.

 

It would be good if the osC developers could "take a leaf out of the XOOPS book", research into how XOOPS does it (it's GNU/GPL also), and design the templating system in a similar methodology. XOOPS uses the Smarty engine.

 

Regards,

 

Peter

Link to comment
Share on other sites

WARNING: severe security issue with all BTS versions:

 

****** Begin Vulnerability Fix ********

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

In main_page.tpl.php find:

 

<?php if ($javascript) { require(DIR_WS_JAVASCRIPT . $javascript); } ?>

 

Replace with:

<?php if (isset($javascript) && file_exists(DIR_WS_JAVASCRIPT . basename($javascript))) { require(DIR_WS_JAVASCRIPT . basename($javascript)); } ?>

 

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

 

Find:

if (isset($content_template)) {

 

Replace with:

if (isset($content_template) && file_exists(DIR_WS_CONTENT . basename($content_template))) {

 

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

 

Find:

require(DIR_WS_CONTENT . $content_template);

 

Replace with:

require(DIR_WS_CONTENT . basename($content_template));

 

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

In popup.tpl.php find:

 

<?php if ($javascript) { require(DIR_WS_JAVASCRIPT . $javascript); } ?>

 

Replace with:

<?php if (isset($javascript) && file_exists(DIR_WS_JAVASCRIPT . basename($javascript))) { require(DIR_WS_JAVASCRIPT . basename($javascript)); } ?>

 

******* End Vulnerability Fix ********

the above applies to all BTS versions up to v1.4

 

There is a small difference with the BTS1.4, you need to update the includes/select_template*.php files to apply the above mentioned $content_template fixes (the $javascript problem/fix is as mentioned above for all versions)

Link to comment
Share on other sites

ADDITIONAL security fix:

 

The ability to switch templates "through the url" should only be used for testing (on your local server for example). For safety I recommend to turn in off in admin, certainly on live shops!

 

If you really want to leave it on, I suggest (there are other ways to do it, this only allows alfanumeric characters and underscores in the template names, if you never echo $tplDir that's probably overkill):

 

Using the BTSv1.4 change (includes/configure_bts.php):

  define('DIR_WS_TEMPLATES', $tplDir . '/' );

to:

// BOF security fix!
// define('DIR_WS_TEMPLATES', $tplDir . '/' );
$tplDir = basename($tplDir);
if (ereg('^[[:alnum:]|_]+$', $tplDir)) {
 // 'Input Validated' only allow alfanumeric characters and underscores in template name
 define('DIR_WS_TEMPLATES', DIR_WS_TEMPLATES_BASE . $tplDir . '/' ); 
} else {
 exit('Illegal template directory!');
}
// EOF security fix!

 

Using the BTSv1.3x you can change (includes/configure_bts.php):

  define('DIR_WS_TEMPLATES', $tplDir . '/' );

// BOF security fix!
// define('DIR_WS_TEMPLATES', $tplDir . '/' );
$tplDir = basename($tplDir);
if (ereg('^[[:alnum:]|_]+$', $tplDir)) {
 // 'Input Validated' only allow alfanumeric characters and underscores in template name
 define('DIR_WS_TEMPLATES', $tplDir . '/' ); 
} else {
 exit('Illegal template directory!');
}
// EOF security fix!

(the BTSv1.3 version is untested)

Link to comment
Share on other sites

Hi there, :o

I just installed BTS 1.4 and got the following error when started the catalog:

 

Warning: main(DIR_WS_TEMPLATES_FALLBACKTEMPLATENAME_MAIN_PAGE): failed to open stream: No such file or directory in /home2/sinoi/public_html/catalog/includes/select_template.php on line 6

 

I'm a newbie here, Help Please!

Link to comment
Share on other sites

I just installed BTS 1.4 and got the following error when started the catalog:

 

Warning: main(DIR_WS_TEMPLATES_FALLBACKTEMPLATENAME_MAIN_PAGE): failed to open stream: No such file or directory in /home2/sinoi/public_html/catalog/includes/select_template.php on line 6

 

I'm a newbie here, Help Please!

You've made an error installing (or you've had ftp errors), better just re?nstall, it's less work/time than figuring out what's exactly wrong now.

(DIR_WS_TEMPLATES_FALL and TEMPLATENAME_MAIN_PAGE means that these contants aren't defined, so probably the bts_configure.php file isn't being loaded for some reason)

You are using it on ms2 I assume?

 

B.t.w. the BTSv1.5 will be released soon (within a couple of days I think), it will include some optimisations and security fixes. Maybe you better wait for that version?

 

/*********************************************/

 

And while i'm posting now anyway: I think I've found an easyer and better security fix for the $javascript and $content_template issue.

Add this:

unset($javascript,$content,$content_template,$boxLink,$box_id,$box_base_name);

to the top of your configure_bts.php file (and use the .htaccess protection too!)

 

feedback welcome :)

Link to comment
Share on other sites

You've made an error installing (or you've had ftp errors), better just re?nstall, it's less work/time than figuring out what's exactly wrong now.

(DIR_WS_TEMPLATES_FALL and TEMPLATENAME_MAIN_PAGE means that these contants aren't defined, so probably the bts_configure.php file isn't being loaded for some reason)

You are using it on ms2 I assume?

 

B.t.w. the BTSv1.5 will be released soon (within a couple of days I think), it will include some optimisations and security fixes. Maybe you better wait for that version? I'm comparing BTS and STS to see which one is best for me.

 

 

feedback welcome :)

Hi Paul, thanks for the help.

Yes, I'm working with ms2. I just reinstalled OSC and BTSv 1.4, but the same problem still there. I just realized that I ran the bts.sql file before I upload the BTS package files, could this be the cause? Anyway, I'm doing another install, now.

I'll let you know the outcome.

Thanks.

Link to comment
Share on other sites

I got it right this time. You're right, something must be wrong with the ftp upload.

Thanks.

glad you got it working :)

 

The new version (BTSv1.5) is available now:

http://www.oscommerce.com/community/contributions,1263

 

It includes some security fixes, and the template switching code has been optimized.

 

Basic upgrade instructions are included (for upgrading from v1.4 to 1.5), full upgrade instructions will follow soon. Also two new help templates are included, it's work in progress, but I hope it will allready make it easyer to understand how the BTS works.

Link to comment
Share on other sites

Where (which url, online/offline) do you go to modify the template?

If you've installed the latest BTS version, the best place to create your new/modified template would be "catalog/includes/templates/new/" (where "catalog" is the place where you've installed your cart).

 

Do really want to modify one of the included templates? If so, just take one of the main_page.tpl.php files from the other templates directories (If you like nested tables, use the stock osC template which you can find in the templates/fallback dir. If you like less tables, use the so called OneTable. You like CSS layouts, use the one from the CSS template dir.), copy it to the "new" template directory and edit it as you like. You can do the same with the stylesheet.css file, just copy one of the stylesheet.css file from another template dir to your new template dir, and start editting (or even better start with a totally new empty stylesheet, or a stylesheet that belongs to a template you bought for example).

 

I only use plain text editors myself, but I think you could use dreamweaver (for example, I've never used it myself btw) too, as long as you do not edit anything between the <?php ?> tags, unles you know what you're doing.

Edited by PandA.nl
Link to comment
Share on other sites

I'm trying to use Dreamweaver pop up menus in my template. I know javascript is working, because the mouseovers work, but in my browser's status bar I see the error symbol next to the words 'Building Menu' When I look at the error it says:

 

Error

'Menu1' is undefined

Code: 0

 

Any idea why this is happening?

Link to comment
Share on other sites

Just a really simple and quick question here. How can I solve it so the main part on a few of my pages fits inbetween the 2 side bars I have on my page.

 

Here's a link to the site:

 

http://www.djclifton.com/catalog/

 

You'll see what I mean. I know it's something to do with CSS, but i've not really used it that much in the past.

 

Cheers

 

Humet

Link to comment
Share on other sites

Just a really simple and quick question here. How can I solve it so the main part on a few of my pages fits inbetween the 2 side bars I have on my page.

 

Here's a link to the site:

 

http://www.djclifton.com/catalog/

 

You'll see what I mean. I know it's something to do with CSS, but i've not really used it that much in the past.

 

Cheers

 

Humet

Well, since no one can answer my question, I might as well help you with yours. By default, all of the tables on the main page template are auto-sized, meaning they stretch to fit the space available. You are trying to do a fixed layout, so you have to find those tables that are width="100%", and change them to a pixel value.

Link to comment
Share on other sites

Well, sorry to say, but, that didn't work! It just stayed the same, even after changing all the table widths to a fixed pixel size.

 

Is it something to do with it being a floating table?? Is it a floating table? I don't really know much about this. I just noticed it's overlapping the table that it's meant to be in.

 

thanks

 

humet

Link to comment
Share on other sites

Right,

 

I figured out it was because it actually couldn't fit all the contents on in the space i've made.

 

Now I need to fix the products info page because on lots of the products the right column stretches really wide and it doesn't fit on.

 

Check it out: http://djclifton.com/catalog/product_info.php?products_id=5

 

Any ideas what is causing it to stretch like this?

 

Cheers

 

humet

Link to comment
Share on other sites

It looks like it's a problem with how the box headings are setup. The box heading text only has a a small space assigned, so if a heading text contains a long word (like "Manufacturer" for example), the middle part is stretched, and together with the images next to both sides of the heading text the total box-witch becomes too large.

Link to comment
Share on other sites

That would explain the left column of boxes, but what about the right? Those boxes are stretched way further than any of the box headings. And also why do some of the products fit perfectly on the page:

 

http://djclifton.com/catalog/product_info....e925a0e025f0134

 

Can you spot any differences between the two product descriptions?

 

humet

Hi,

 

I was checking with FireFox and it didn't look bad. Now I checked with IE, and then the right column is far too wide indeed :blink:

 

Maybe the difference between FF and IE could help to find the problem? Isn't it just a missing tag or something for example? Did you already check for HTML syntax errors?

 

( edit: btw, posting links with sid's attached isn't a good idea )

Edited by PandA.nl
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...