Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

[contribution] Simple Template System (sts)


Recommended Posts

I need help with a little dilema I'm having. Please visit my store at http://www.domyownpestcontrol.com/catalog


Click on the Ants tab at the top of the page. If you scroll down past the "How to Control Ants" you'll see the list of ant-related products. I'm trying to figure out how to split that product table in two so that one table just diplays products for the interior of the home, and then another table below that will display products for the exterior of the home. I would like both tables to display on the same page. How can I do that? What php file do I need to edit? Also how can I remove the word "Products" above the product table and the picture of the ant to the right of it?


By the way, everything on this site is being done with STS and the help of this forum. Thanks everyone. B)

Link to comment
Share on other sites

What I searched for here on the forums and in the contribution section

is a tool that can make the cart info box dissappear when it's empty and

to pop up when the first item has been added.



Posted on Mar 7 2004, 11:06 PM



Ok fixed it myself here is the code for in column_right.php :


$cart_contents_string = '';

if ($cart->count_contents() > 0) {


require(DIR_WS_BOXES . 'shopping_cart.php');



Thats all... show the shopping cart infobox only when needed ...


Maybe admins could move this topic to tips and tricks?


regards, erik.


This exactly waht I need!! Is there any way to implement this feature if you us the STS contribution? Any help would be great!! I even tried to remove STS in order to get this to work but no...my site design is a bit to advanced for me so I couldn't re-create the same design without STS... Please, anyone?! :(

Link to comment
Share on other sites

Hi everyone! :D


I?m about to put a flash-file in the header instead of the "logo.gif", and I?m also going to remove the "my account", "shoppingcart" and "checkout" image buttons in the header. How can this be done? The button graphic "my account" have to become a textlink instead of a button, and is going to be displayed at the same line as the other texlinks ("logg off", "shopping cart" and "checkout").

I?m using the latest STS version!

I have to write some new code to the header.php file, but I don?t know how to write it :( I?m not a php programmer ;)

Can somebody help me? Any ideas? I now that this can be done, just don?t know how <_<

Link to comment
Share on other sites

Never Mind The Above Replay :D


I did get it fixed myself :D :D


This in sts_display_output.php:


  if (tep_session_is_registered('customer_id')) {
   $template['myaccount'] = '<a href=' . tep_href_link(FILENAME_LOGOFF, '', 'SSL')  . ' class="headerNavigation">' . HEADER_TITLE_LOGOFF . '</a>';
   $template['urlmyaccount'] = tep_href_link(FILENAME_LOGOFF, '', 'SSL');
   $template['preemmyaccount'] = '<a href=' . tep_href_link(FILENAME_ACCOUNT, '', 'SSL') . ' class="headerNavigation">' . HEADER_TITLE_MY_ACCOUNT . '</a> |';
   $template['preemurlmyaccount'] = tep_href_link(FILENAME_ACCOUNT, '', 'SSL');

 } else {
   $template['myaccount'] = '<a href=' . tep_href_link(FILENAME_ACCOUNT, '', 'SSL') . ' class="headerNavigation">' . HEADER_TITLE_MY_ACCOUNT . '</a>';
   $template['urlmyaccount'] = tep_href_link(FILENAME_ACCOUNT, '', 'SSL');
   $template['preemmyaccount'] = '';
   $template['preemurlmyaccount'] = tep_href_link(FILENAME_ACCOUNT, '', 'SSL');


This in sts_template.html:


      <table width="780" height="28" border="0" cellpadding="3" cellspacing="0">
         <td class="headerNavigationBarLink">$breadcrumbs</td>
         <td class="headerNavigationBarLink"><div align="right">$preemmyaccount $myaccount
               | $cartcontents | $checkout</div>

Link to comment
Share on other sites

can someone help me figure out how to fix this problem



Warning: main(STS_START_CAPTURE): failed to open stream: No such file or directory in /home/somedomain/public_html/store/includes/application_top.php on line 510


Fatal error: main(): Failed opening required 'STS_START_CAPTURE' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/somedomain/public_html/store/includes/application_top.php on line 510


I tried searching but couldn't find anything through 89 pages of posts in this thread




Link to comment
Share on other sites

w00t got it to work


define('STORE_SESSIONS', 'mysql'); // leave empty '' for default handler or set to 'mysql'

// STS: ADD: Define Simple Template System files

define('STS_START_CAPTURE', DIR_WS_INCLUDES . 'sts_start_capture.php');

define('STS_STOP_CAPTURE', DIR_WS_INCLUDES . 'sts_stop_capture.php');

define('STS_RESTART_CAPTURE', DIR_WS_INCLUDES . 'sts_restart_capture.php');

define('STS_TEMPLATE_DIR', DIR_WS_INCLUDES . 'sts_templates/');

define('STS_DEFAULT_TEMPLATE', DIR_WS_INCLUDES . 'sts_template.html');

define('STS_DISPLAY_OUTPUT', DIR_WS_INCLUDES . 'sts_display_output.php');

define('STS_USER_CODE', DIR_WS_INCLUDES . 'sts_user_code.php');

define('STS_PRODUCT_INFO', DIR_WS_INCLUDES . 'sts_product_info.php');




word wrap wasnt on before so it was getting messed up


:rolleyes: '

Link to comment
Share on other sites



Hi, this is my first post here, so be gentle....... :blink:


I am very new to all this but I am learning loads through the best teaching method - DOING IT. Still at the moment I am fumbling around in the dark, so please would someone out there lend me their touch of experience?


The STS seems like just what I was after to set up my first osc website. Having a bit of trouble with it though. I followed the installation instructions but now have a blank contents area on all my pages. It is a fresh installation of osc, but I have installed EasyPopulate as well. Also I have yet to play around with the template so it is all as standard. Please could someone point me in the right direction to solve this $content problem.


Quick query about the "readme.txt" file that may, or may not be related. For the easy installation should I copy across the "sts_product_info.php" to the "includes" directory. It doesn't mention it but does for the advanced installation (but this time the "sts_restart_capture.php" is left out). I have tried it with and without "sts_product_info.php" still no success.




Link to comment
Share on other sites



Can I switch (and how) to your latest STS contrib from my current OSC version, MS2-MAX, which I think runs on BTS (another template system)? My web site has not gone "public" yet, so I have fear no valuable data loss e*xcept* for the many hours I have spent hacking away from the traditional OSC look to make my site look the way it does now ( with a bit more needed tweeking). Anyway, is it worth my while to switch?


I have run into a problem with LOGIN buttons calling advance_search.php and I have no idea how in the world to trace the hack that has caused this, so I was wondering if STS would be easier in diagnostic aspect.




Regards, and Thank You for sharing your brilliance




Link to comment
Share on other sites

Newbie Update


Late last night I gave up trying to recover my $content area and reinstalled osc and sts. It all seemed to work apart from the following error messages at the top of the page.


Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /home/ladsroom/public_html/includes/configure.php:59) in /home/ladsroom/public_html/includes/functions/sessions.php on line 67


Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/ladsroom/public_html/includes/configure.php:59) in /home/ladsroom/public_html/includes/functions/sessions.php on line 67


This was a bit easier to sort out. If anyone runs into similar trouble have a look at this.


Think the extra space is added when editing the configure.php file in Windows. Though I could be very wrong! :(


Brian, thanks for contributing this extremely useful programme.

Link to comment
Share on other sites

I just wanted everyone to now how glad I am that i can use the simple Template System. I am nearly a Newbie to php, but I was able to setup a fully functional Shop using OSC MS1. The only thing that bothered me was that I was not able to fit the layout of OSC into the rest of our hardly developed website. Therefore I had to open up our shop, which is currently selling Records of our small company, in a separate Browserwindow. Thanks to the STS I am now able to integrate the whole shop section fully into the rest of the website-layout. I apreciate the obiously hard work of the contributor of this wonderfull addon to OSCommerce, wich made it absolute easy for me to get this ready. I even was able to change the logon/logoff routine to work well with images, because of the absolutely well-documented code. Thanks again, be shure, i am totally grateful.

Excuse me, if this text is not well translated, I am from germany, but I truly felt the urge to make this announcement.

Link to comment
Share on other sites

Hi, i installed STS v2.01. Everything was ok, but the Multiple Template thing wasnt working...UNTIL... i commented this line from 'sts_display_output.php':


$scriptname = getenv('SCRIPT_NAME');


I commented that line and the multiple Template start working.


Is this normal? Is it going to affect anything else?


Please, if someone knows something about this, please let me know.



Link to comment
Share on other sites

Hello I installed STS exactly like the way it was written in the manual yet I keep on getting this error!? What does it mean? What should I do? Please help, thanks in advance.


Fatal error: Failed opening required 'STS_START_CAPTURE' (include_path='.:/home/users/popilka:/usr/local/lib/php') in /home/users/popilka/www/shop/catalog/includes/application_top.php on line 511


my site www.popilka.cz/shop/catalog

Edited by paranpipa
Link to comment
Share on other sites



I am using STS for almost a half year and it works very fine. But now I want to change the layout and there a some problems:


1.) I installed the newest Version 2.01 (before 1.8) - but now the Loginbox is not visible any longer. I changed the file "sts_user_code" and the Loginbox was not visible - so I changed it back - but the Loginbox did not come back. Why?


2.) When I use the box $reviewsbox on the right side. The Boxes are visible on the right side - but moreover all boxes from the right side are now visible on the left side too - under the normal boxes of the left side.

And I am very confused because now the Loginbox is visible. When I delete the $reviewsbox the boxes were normal visible and the Loginbox is away...


3.) I want to use a template for the main page and an other template for the category sites. But the new function in version 2.01 does not work. There is alwas the template of the main page visible and not the one of the categories.

I added the sts_template.html in /category/includes for the main page and index.php.html in /category/includes/sts_templates but it always use the template for the main page.


(P.S. Other templates in the folder "sts_template" work fine)


Thanks for your help...

Link to comment
Share on other sites



I have been reading these threads and am very impressed with what you are doing here. I have to say one issue has me troubled though. The guy who set my site up has told me from the start that it was more important to get the site fully functional and to worry about the design components later.


If I am reading these threads correctly though, it has to be a fresh install which would mean a loss of all work already done?


I would like to know this before I go any further.... Sorta feeling like I was steered wrong and I sure can't afford to hire someone else to redo the work that has already been done.


I would appreciate all thoughts here.



Link to comment
Share on other sites

I would like to change the catagory menu so that "catalog" is either not a link (first choice) or links to the index page(second choice) The code for the menu seems to be in the STS_user_code.php and I have tried a few things but not succesfully. Any help would be great.



$sts_block_name = 'catmenu';


echo "\n<!-- Start Category Menu -->\n";

echo tep_draw_form('goto', FILENAME_DEFAULT, 'get', '');

echo tep_draw_pull_down_menu('cPath', tep_get_category_tree(), $current_category_id, 'onChange="this.form.submit();"');

echo "</form>\n";

echo "<!-- End Category Menu -->\n";


$template['catmenu'] = $sts_block['catmenu'];


function tep_get_category_tree($parent_id = '0', $spacing = '', $exclude = '', $category_tree_array = '', $include_itself = false) {

global $languages_id;


if (!is_array($category_tree_array)) $category_tree_array = array();

if ( (sizeof($category_tree_array) < 1) && ($exclude != '0') ) $category_tree_array[] = array('id' => '0', 'text' => "Catalog");


if ($include_itself) {

$category_query = tep_db_query("select cd.categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " cd where cd.language_id = '" . (int)$languages_id . "' and cd.categories_id = '" . (int)$parent_id . "'");

$category = tep_db_fetch_array($category_query);

$category_tree_array[] = array('id' => $parent_id, 'text' => $category['categories_name']);



$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.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' and c.parent_id = '" . (int)$parent_id . "' order by c.sort_order, cd.categories_name");

while ($categories = tep_db_fetch_array($categories_query)) {

if ($exclude != $categories['categories_id']) $category_tree_array[] = array('id' => $categories['categories_id'], 'text' => $spacing . $categories['categories_name']);

$category_tree_array = tep_get_category_tree($categories['categories_id'], $spacing . '   ', $exclude, $category_tree_array);



return $category_tree_array;




The Knowledge Base is a wonderful thing.

Do you have a problem? Have you checked out Common Problems?

There are many very useful osC Contributions

Are you having trouble with a installed contribution? Have you checked out the support thread found Here

BACKUP BACKUP BACKUP!!! You did backup, right??

Link to comment
Share on other sites



That's it. Just a simple question. This is all I need to get my store up - I need the right gateway. My choice is between Linkpoint or authorize.

Link to comment
Share on other sites

MysticBlues, I'm not sure I understand your question completely. If STS is installed as part of the "functionality" that your developer referred to, then you should be ok. You can just build your templates (that's not 100% true, it would have been better to setup a basic layout first...). However, in general I would have to agree with your developer. I'm still working out technical issues and holding off on my graphics. Just doing the basics to make sure my templates, etc. are working. It's no good to have an incredible looking web site if you can't sell through it, right? :)

Edited by JABevan
Link to comment
Share on other sites

Yes, but... now my Add to Cart button does not work. I don't think it has anything to do with it, but I'm not sure. You can check it out here... kinda* ...  ???




I wasn't sure who you are responding to....


I am having the same problem. It only seems to affect items that have attributes. If I create an item with no options it works fine. As soon as I add an option, the add to cart button no longer puts things in the cart.


Did we miss something?

while (!succeed) {try()};


GMT -6:00

Link to comment
Share on other sites

I've heard that on the boards too, but this item does have attributes and did before my test. Worked without any problems until the other morning. I'll delete the attributes, see if works, and post again...

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.

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...