Jump to content
DiamondSea

[contribution] Simple Template System (sts)

Recommended Posts

Hey Runweb, that's the EXACT same question I asked here http://forums.oscommerce.com/index.php?sho...81&st=3440# last week, am still waiting for a coherant answer ...

 

Good luck.

There are so many cross-posts I'm about to go cross-eyed. :blink:

 

I answered this post in the STSv4 thread (thread that was started for all STSv4.x versions of STS)

This thread (Simple Template System) is supposed to be for STS versions prior to STSv4.


Bill Kellum

 

Sounds Good Productions

STS Tutorials & more: STSv4.6, STS Add-ons (STS Power Pack), STS V4 Forum STS Forum FREE TEMPLATE

Share this post


Link to post
Share on other sites

I need to add a row of 3 products for every category in my store to the main page.

 

Something like the attached image but the blank squares would have 3 products from the category listed to the left of it.

 

front.jpg

 

I apologize for not going into extensive detail but I have been up for 24 hrs and beating my head against the wall over the problem for days!

 

 

If you can help in any way . . . . . . . the beer is on me!

 

 

Thanks,

 

Snikle

Share this post


Link to post
Share on other sites

I also have the same problem as the post above. I only need the pictures of the products on the products page, plus the buy now and add to cart buttons below every picture of the product. The question is, I've tried using sts to lay out everything since im new with php, how do you get the links or the urls of the products (if there is such a thing) so I could lay them out on a table on my products page. I've added the products on oscommerce and have made the necessary layout changes in sts. but I can't find a way to just post the products or post a specific product on the site.

 

Hope you guys could help.

Thanks,

Paolo

Share this post


Link to post
Share on other sites

Hi,

I installed STS v4.5.8 on osCommerce v2.2 RC2. I don't know how the default template looks like, because after the installation nothing changes. I make a folder "ida" in sts_templates and put there index.html file with my template. I tried calling mysite.com/index.php?sts_templates=ida, but ... nothing change. I tried this in bulgarian and english languages.

Share this post


Link to post
Share on other sites
Hi,

I installed STS v4.5.8 on osCommerce v2.2 RC2. I don't know how the default template looks like, because after the installation nothing changes. I make a folder "ida" in sts_templates and put there index.html file with my template. I tried calling mysite.com/index.php?sts_templates=ida, but ... nothing change. I tried this in bulgarian and english languages.

Ivan,

 

After you copy the STS files and then make the modifications to the existing osCommerce files, you still need to "enable" the template system in the admin. Take a look at each one of the documents in the "docs" folder that came with the contribution.

 

Also, read the following post that I just made in the STSv4 support thread:

http://forums.oscommerce.com/index.php?s=&...t&p=1213827

 

Hope this helped,


Bill Kellum

 

Sounds Good Productions

STS Tutorials & more: STSv4.6, STS Add-ons (STS Power Pack), STS V4 Forum STS Forum FREE TEMPLATE

Share this post


Link to post
Share on other sites

EDIT: I did it. But now has another problem. The template has images in folder images and uses default.css file in its directory. When I open the HTML file it shows it correctly, but when I open my index page it shows me only the text and links.

Edited by iturtev

Share this post


Link to post
Share on other sites

I forgot to say that I have this in my HTML:

<!--$extracss-->

<link rel="stylesheet" type="text/css" href="default.css">

 

EDIT: I did it this way:

<link rel="stylesheet" type="text/css" href="$temaplatedir/default.css">

Edited by iturtev

Share this post


Link to post
Share on other sites

How do I create a new placeholder?

 

I want to take the 4 items in the Information box, give them each a placeholder so that I can position then in the footer area.

 

I would also like to do the same and replace the Quick Find box - ptting it is a single line.

Share this post


Link to post
Share on other sites
How do I create a new placeholder?

 

I want to take the 4 items in the Information box, give them each a placeholder so that I can position then in the footer area.

 

I would also like to do the same and replace the Quick Find box - ptting it is a single line.

If you know basic html, just create a simple link to each file using absolute urls and you will be golden. You are not confined to php and STS, once you create a STS template it is basically like creating a regular web page with the few exceptions where you need osC to produce content. Most links, images and overall design of the of the template can be done with simple html.


Powered By osC 2.2RC2a STS 4.5.8 - HTC 2.6.3 - FP 1.5.9 - BCH 1.0.0

Share this post


Link to post
Share on other sites
I m looking for a better php editor. The one recomnded is free but can anyone name some more easy to use php editors?

 

Thanks.

 

 

__________

Webkinz Recipes

I like to use PHP Designer 2007 (well, now it is PHP Designer 2008).

http://www.mpsoftware.dk/

It color codes tags, HTML, etc. to make it very simple to edit osCommerce PHP pages.

They offer a free trial so it is worth a look. :thumbsup:


Bill Kellum

 

Sounds Good Productions

STS Tutorials & more: STSv4.6, STS Add-ons (STS Power Pack), STS V4 Forum STS Forum FREE TEMPLATE

Share this post


Link to post
Share on other sites

Hello.

 

I'm running osc RC2.2 and STS v4.5.8. I looked through the user manual, but I'm not too good at coding.. Are there any template sets already made that I can just install on my shop?

Share this post


Link to post
Share on other sites
Hello.

 

I'm running osc RC2.2 and STS v4.5.8. I looked through the user manual, but I'm not too good at coding.. Are there any template sets already made that I can just install on my shop?

 

Yes, the contribution comes with two separate template folders: "full" and "test".

I suggest that you use the "full" template folder to get your feet wet and see how STS uses the tags to bring osCommerce funtions to your template.

 

Once you get comfortable, you can use any web template and just save them according to the naming syntax that STS uses. See chapter 3 in the STS User Manual for more details on how to name your templates as well as look through each one of the HTML files in the "doc" folder. Each one goes into details on the procedure STS uses to pick which template to use.

 

:thumbsup: Keep in mind, STS allows you to use only one template page for every osC page in your store or use specific template pages for individual pages, infoboxes, home page, etc. in your osC shop.

 

Hope this helped,


Bill Kellum

 

Sounds Good Productions

STS Tutorials & more: STSv4.6, STS Add-ons (STS Power Pack), STS V4 Forum STS Forum FREE TEMPLATE

Share this post


Link to post
Share on other sites
How do I create a new placeholder?

 

I want to take the 4 items in the Information box, give them each a placeholder so that I can position then in the footer area.

 

I would also like to do the same and replace the Quick Find box - ptting it is a single line.

Alan,

There are examples in the file catalog/includes/modules/sts_inc/sts_user_code.php .

A sure way to add an sts infobox is to follow examples in that file:

 

Example Code for creating a tag for the reviews.php file (reviews infobox)

$sts->start_capture();
  require(DIR_WS_BOXES . 'reviews.php');
  $sts->stop_capture('reviewbox', 'box');

 

Generally the user's modifications are put into sts_user_code.php . An easy way to create new tag is as follows:

 

$sts->template['mynewtag'] = 'MyCode';

 

and place $mynewtag in the template to display 'MyCode'.

 

Using the syntax above, you could create a tag for the shipping.php file link: $urlshipping

Created like so (save this in the catalog/includes/modules/sts_inc/sts_user_code.php file):

$sts->template['urlshipping'] = tep_href_link(FILENAME_SHIPPING, '', 'NONSSL');

This will keep the session IDs in place so your customer doesn't lose the contents of their shopping cart when they click on the link. :thumbsup:

 

Hope this helped you out,


Bill Kellum

 

Sounds Good Productions

STS Tutorials & more: STSv4.6, STS Add-ons (STS Power Pack), STS V4 Forum STS Forum FREE TEMPLATE

Share this post


Link to post
Share on other sites

Hi there,

 

I've been working on a website with OSCommerce in combination with STS. I'm very satisfied about this golden combination and I've customized the layout very strongly. But the last weeks I got some problems. There are actually two questions I want to solve:

 

First question:

Is it possible to place a rating (stars) in the product_info.php.html just as it is used in the reviews? So the rating is related to a specific product instead of a review?

 

Second question:

I'm using my template in Dutch? But I would like to use my product discription in both Dutch and English. Is there a possibility to use both placeholders on one page?

 

I would be very glad if someone could help me out.

 

Kind regards,

 

Jeffrey

Share this post


Link to post
Share on other sites

Hi,

 

First answer

Nothing ready for that. You need to calculate the average number of stars to display, then choose the right graphic, then create a new STS tag to dispay this graphic on your template. Good exercise.

 

Second answer (or first answer to the second question)

You can use both placeholders, as long as the dutch is empty when english is selected, and vice versa. The best solution would be to follow the osCommerce structure and place all the language-dependent texts inside the language files, using "define". You can then create STS tags or directly echo the defined variable from within your template.

 

- Chris


STS v4.5 SP5 is out, and check the STS Power Pack contribution too!

New thumbnailer using phpThumb: oscThumb. Works great.

Share this post


Link to post
Share on other sites
Hi,

 

First answer

Nothing ready for that. You need to calculate the average number of stars to display, then choose the right graphic, then create a new STS tag to dispay this graphic on your template. Good exercise.

 

Second answer (or first answer to the second question)

You can use both placeholders, as long as the dutch is empty when english is selected, and vice versa. The best solution would be to follow the osCommerce structure and place all the language-dependent texts inside the language files, using "define". You can then create STS tags or directly echo the defined variable from within your template.

 

- Chris

 

Thanx for your quick reaction. The first problem could be easier I guess. It is not neccesary to calculate the average number. What I want to do is rank a product in the Admin panel. So it is the ranking of a product inserted by the administrator without any calculation.

 

My programming skills are not that good, some help would be great...

 

Jeffrey

Share this post


Link to post
Share on other sites

Has anyone got tracking on redirect.php working with STS and Google Analytics?

 

I have the code in STS and everything tracks fine but redirect.php as this does not use the template file, where and what should I post into redirect.php to get Analytics tracking any redirects:

 

Redirect.php

 

<?php

/*

$Id: redirect.php,v 1.10 2003/06/05 23:31:31 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

require('includes/application_top.php');

 

switch ($HTTP_GET_VARS['action']) {

case 'banner':

$banner_query = tep_db_query("select banners_url from " . TABLE_BANNERS . " where banners_id = '" . (int)$HTTP_GET_VARS['goto'] . "'");

if (tep_db_num_rows($banner_query)) {

$banner = tep_db_fetch_array($banner_query);

tep_update_banner_click_count($HTTP_GET_VARS['goto']);

 

tep_redirect($banner['banners_url']);

}

break;

 

case 'url':

if (isset($HTTP_GET_VARS['goto']) && tep_not_null($HTTP_GET_VARS['goto'])) {

$check_query = tep_db_query("select products_url from " . TABLE_PRODUCTS_DESCRIPTION . " where products_url = '" . tep_db_input($HTTP_GET_VARS['goto']) . "' limit 1");

if (tep_db_num_rows($check_query)) {

tep_redirect('http://' . $HTTP_GET_VARS['goto']);

}

}

break;

 

case 'manufacturer':

if (isset($HTTP_GET_VARS['manufacturers_id']) && tep_not_null($HTTP_GET_VARS['manufacturers_id'])) {

$manufacturer_query = tep_db_query("select manufacturers_url from " . TABLE_MANUFACTURERS_INFO . " where manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and languages_id = '" . (int)$languages_id . "'");

if (tep_db_num_rows($manufacturer_query)) {

// url exists in selected language

$manufacturer = tep_db_fetch_array($manufacturer_query);

 

if (tep_not_null($manufacturer['manufacturers_url'])) {

tep_db_query("update " . TABLE_MANUFACTURERS_INFO . " set url_clicked = url_clicked+1, date_last_click = now() where manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and languages_id = '" . (int)$languages_id . "'");

 

tep_redirect($manufacturer['manufacturers_url']);

}

} else {

// no url exists for the selected language, lets use the default language then

$manufacturer_query = tep_db_query("select mi.languages_id, mi.manufacturers_url from " . TABLE_MANUFACTURERS_INFO . " mi, " . TABLE_LANGUAGES . " l where mi.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and mi.languages_id = l.languages_id and l.code = '" . DEFAULT_LANGUAGE . "'");

if (tep_db_num_rows($manufacturer_query)) {

$manufacturer = tep_db_fetch_array($manufacturer_query);

 

if (tep_not_null($manufacturer['manufacturers_url'])) {

tep_db_query("update " . TABLE_MANUFACTURERS_INFO . " set url_clicked = url_clicked+1, date_last_click = now() where manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and languages_id = '" . (int)$manufacturer['languages_id'] . "'");

 

tep_redirect($manufacturer['manufacturers_url']);

}

}

}

}

break;

}

 

tep_redirect(tep_href_link(FILENAME_DEFAULT));

?>

Share this post


Link to post
Share on other sites

Hello,

 

I need help, please.

 

Fatal error: Call to a member function trail() on a non-object in /var/www/html/catalog/includes/sts_display_output.php on line 232

 

In sts_display_output.php on line 232

$template['breadcrumbs'] = $breadcrumb->trail(' » ');

 

What can i Do?

 

Sorry vor my English.

 

Thanks Alfred

Share this post


Link to post
Share on other sites

I did everything the install told me to do manually and when I go to the /shop/admin it leads me to the login page but on top of the oscommerce logo on that page, there is...

//START STS 4.1 define('BOX_MODULES_STS', 'STS'); //END STS 4.1

 

I thought that was part of the install, but when I input my username and password it gives me this error...

 

//START STS 4.1 define('BOX_MODULES_STS', 'STS'); //END STS 4.1

Warning: Cannot modify header information - headers already sent by (output started at /home/my_domain/public_html/shop/admin/includes/languages/english.php:305) in /home/my_domain/public_html/shop/admin/includes/functions/general.php on line 22

 

How do I fix this please? Did I do something wrong?

Share this post


Link to post
Share on other sites
I did everything the install told me to do manually and when I go to the /shop/admin it leads me to the login page but on top of the oscommerce logo on that page, there is...

//START STS 4.1 define('BOX_MODULES_STS', 'STS'); //END STS 4.1

 

I thought that was part of the install, but when I input my username and password it gives me this error...

 

//START STS 4.1 define('BOX_MODULES_STS', 'STS'); //END STS 4.1

Warning: Cannot modify header information - headers already sent by (output started at /home/my_domain/public_html/shop/admin/includes/languages/english.php:305) in /home/my_domain/public_html/shop/admin/includes/functions/general.php on line 22

 

How do I fix this please? Did I do something wrong?

Yes, you did. It looks like you placed that line in some HTML of your page and that is why it is being echoed like that. Use a File Comparison tool such as Beyond Compare to compare your files with those in the contribution to help figure out where you went wrong.

Bill Kellum

 

Sounds Good Productions

STS Tutorials & more: STSv4.6, STS Add-ons (STS Power Pack), STS V4 Forum STS Forum FREE TEMPLATE

Share this post


Link to post
Share on other sites

Ok, my apoligies as I'm sure this has been answered elsewhere...I've been searching & searching, but cannot get the specific answer to this...

How do i create different background colors on just the $content box, but also I want to change the backgrounds so each catagory has a different color

I know it's a css tag, but if I change the :

 

BODY {

background: #ffffff;

color: #000000;

margin: 0px;

}

 

that changes it on all the pages. Should I create a seperate stylesheet.css for each catagory?..ie: catagory01.css, catagory02.css, etc?, and what would be the code for just the $content box?, and if I made seperate catagory.css files, do I need to remove the call to the main stylesheet.css file?

 

Please Help..I need to clean up my store!

thanks so much :thumbsup::rolleyes:

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×