Jump to content
DiamondSea

[contribution] Simple Template System (sts)

Recommended Posts

My page name is not being used, its staying as Untiteled Page


++++++++++++++++++++

Im just a guy, Nothing more

++++++++++++++++++++

Share this post


Link to post
Share on other sites

Excellent contribution.

 

I am however stuck !

 

I have searched the forums and come across the problem, but no solution posted yet.

 

I have a clean install and have installed sts, but the click to enlarge gives an error and does not open up.

 

any ideas ?

Share this post


Link to post
Share on other sites

could anyone help me i read that for creating a template for a page just create the ...php.html file but now i created the shopping cart.php.html nothing happens to my shopping cart site could any1 help me please?!? :blush:

Share this post


Link to post
Share on other sites

I had read that using CoolMenu with STS is an issue, however I have also read in some post that users have got coolmenu to work with STS- but they do not say how. One user said he would even create a contrib specifically for coolmenu and STS but I was unable to find it.

 

Can anyone point me to where I might find out the details of getting the two to work together?

 

Many man kisses will be given.

Share this post


Link to post
Share on other sites

Has anyone successfully installed STS on store with "multi-store" contribution?

 

I tried but this error came up on my site :

 

Template file doesn't exist: []Can't open Template file: []

Warning: fread(): supplied argument is not a valid stream resource in /home/nadashop/public_html/mainshop/includes/sts_display_output.php on line 178

 

Warning: fclose(): supplied argument is not a valid stream resource in /home/nadashop/public_html/mainshop/includes/sts_display_output.php on line 179

 

Fatal error: main(): Failed opening required '' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/nadashop/public_html/mainshop/includes/sts_display_output.php on line 198

Edited by martmax

Share this post


Link to post
Share on other sites
Yes, that's it meaning that you can use the same template for both languages. You don't have to name them in any special way... the default sts templates that come along with the contrib. will do.

You just have to change the image names as the examples I posted before:

yourenglishimage1.gif

yourswedishimage4.gif

... and so on.

That's all.

 

Ok, thanks. However, it would be great to use a template for each langauge (at least in some parts of the store). I really miss that feature..

Share this post


Link to post
Share on other sites

In have the pre beta release 2.01 running. Had it for some time now.

 

I am editing the products page. The only issue I see is the $addtocartbutton. The button shows fine but it does nothing while clicked.

 

The $reviewbutton also has an issue. It shows the button but is not clickable.

 

What is the issue?

Share this post


Link to post
Share on other sites

Got one question,

 

I am using the latest STS version and I am editing the different pages fine with product_info.php_cPath=22, no problems there.

 

but now I have a question, this is of course only effecting items within one categories. The layout of the first page when clicking on the category still lists the items in a list with price and all the usual stuff.

 

Is it also possible to edit this page separately??

 

any input would be greatly appreciated...

 

 

Espen


Espen Falkenhaug

Share this post


Link to post
Share on other sites

I need a litttle help here...

 

I seem to have everything work fine, except the product_info.php.html...

 

can anyone here fill me in on hte secret in making custom product_info pages???

 

What am I missing? :blink: :blink:

 

Here is the config file info I am currently using:

 

// STS: ADD: Define Simple Template System files

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

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_DEFAULT_TEMPLATE', STS_TEMPLATE_DIR . 'chocolate.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');

define('STS_FUNCTIONS', DIR_WS_INCLUDES . 'sts_functions.php');

// STS: EOADD

 

and the URL in debug mode, at least for the moment: http://www.chocolatebeyondreason.com/store...&products_id=34

Share this post


Link to post
Share on other sites

i am trying to create a manufacturers dropdown box variable, $mfgrmenu, which is similar to that of the category dropdown box variable, $catmenu.

 

inside of my file sts_user_code.php, I have added this. Im pretty certain that my mysql query is bad, and I am hoping someone can point me in the right direction of where I am going wrong.

 

// good category drop down menu code

$sts_block_name = 'catmenu';
require(STS_START_CAPTURE);
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";
require(STS_STOP_CAPTURE);
$template[$sts_block_name] = $sts_block[$sts_block_name];

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' => "Browse By 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;
}


// begin buggy manufacturer drop down menu
$sts_block_name = 'mfgrmenu';
require(STS_START_CAPTURE);
echo "\n<!-- Start Manufacturer Menu -->\n";
echo tep_draw_form('goto', FILENAME_DEFAULT, 'get', '');
echo tep_draw_pull_down_menu('cPath', tep_get_mfgr_tree(),
 $current_manufacturer_id, 'onChange="this.form.submit();"');
echo "</form>\n";
echo "<!-- End Manufacturer Menu -->\n";
require(STS_STOP_CAPTURE);
$template[$sts_block_name] = $sts_block[$sts_block_name];

function tep_get_mfgr_tree($parent_id = '0', $spacing = '', $exclude = '', $manufacturer_tree_array = '',
 $include_itself = false) 
{
 global $languages_id;

 if (!is_array($manufacturer_tree_array))
 {
$manufacturer_tree_array = array();
 }

 if ( (sizeof($manufacturer_tree_array) < 1) && ($exclude != '0') )
 {
$manufacturer_tree_array[] = array('id' => '0', 'text' => "Browse By Manufacturer");
 }

 if ($include_itself) 
 {
$manufacturer_query = tep_db_query("select mi.manufacturers_id, mi.languages_id,
  mi.manufacturers_url from " . TABLE_MANUFACTURERS_INFO . " mi left join " .
  TABLE_MANUFACTURERS . " m on (m.manufacturers_id = mi.manufacturers_id and
  mi.languages_id), " . TABLE_PRODUCTS . " p where p.products_id = '" . 
  (int)$HTTP_GET_VARS['products_id'] . "' and p.manufacturers_id = m.manufacturers_id");

$manufacturer = tep_db_fetch_array($manufacturer_query);
$manufacturer_tree_array[] = array('id' => $parent_id, 'text' => 
  $manufacturer['manufacturers_name']);
}

$manufacturers_query = tep_db_query("select mi.manufacturers_id, m.manufacturers_name,
  m.manufacturers_image, mi.manufacturers_url from " . TABLE_MANUFACTURERS . " m left join " .
  TABLE_MANUFACTURERS_INFO . " mi on (m.manufacturers_id = mi.manufacturers_id and 
  mi.languages_id = '" . (int)$languages_id . "'), " . TABLE_PRODUCTS . " p where products_id = '" . 
  (int)$HTTP_GET_VARS['products_id'] . "' and p.manufacturers_id = m.manufacturers_id");

while ($manufacturers = tep_db_fetch_array($manufacturers_query)) 
{
  if ($exclude != $manufacturers['manufacturers_id'])
  {
	$manufacturer_tree_array[] = array('id' => $manufacturers['manufacturers_id'], 'text' => $spacing .
	  $manufacturers['manufacturers_name']);
  }
  $manufacturer_tree_array = tep_get_mfgr_tree($manufacturers['manufacturers_id'], 
	$spacing . '???', $exclude, $manufacturer_tree_array);
}
return $manufacturer_tree_array;
 }

Share this post


Link to post
Share on other sites
Hi there,

 

I'm pretty new to osCommerce. I installed

it and also installed STS so I can easily

change the look of my shop.

 

But when I run the shop, after a clean installation

including STS it already gives me an error.

 

I guess in the index.php

 

I have installed osCommerce without STS before

and it ran error free.

 

I included a screenshot of the error box, maybe

somebody could help me.. Would be ace!

 

Grtz Chris

 

error.jpg

 

Piece of code from index.php:

 

<?php
/*
$Id: index.php,v 1.1 2003/06/11 17:37:59 hpdl Exp $

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

Copyright (c) 2003 osCommerce

Released under the GNU General Public License
*/

require('includes/application_top.php');

// the following cPath references come from application_top.php
$category_depth = 'top';
if (isset($cPath) && tep_not_null($cPath)) {
$categories_products_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id = '" . (int)$current_category_id . "'");
$cateqories_products = tep_db_fetch_array($categories_products_query);
if ($cateqories_products['total'] > 0) {
$category_depth = 'products'; // display products
} else {
$category_parent_query = tep_db_query("select count(*) as total from " . TABLE_CATEGORIES . " where parent_id = '" . (int)$current_category_id . "'");
$category_parent = tep_db_fetch_array($category_parent_query);
if ($category_parent['total'] > 0) {
$category_depth = 'nested'; // navigate through the categories
} else {
$category_depth = 'products'; // category has no products, but display the 'no products' message
}
}
}

 

I have same problem with my store.

 

any ideas ?

Share this post


Link to post
Share on other sites

I posted this in another forum and almost got some help. I am VERY frutrated with simply trying to modify the $content varibale's output. Look at this page: http://www.lulakate.com/catalog/index.php?cPath=21

 

My goal is taht when you are on this page, http://www.lulakate.com/catalog/index.php , you can click on an image or text, to go into a category, such as Coats! When you click on coats, you go to this page: http://www.lulakate.com/catalog/index.php?cPath=21 I am TRYING to make this page be JUST a list of products. I cannot for the life of me remove the "Lulakate Catalog" text. I have uploaded a 1x1 shim gif to hold teh catgory image space. I am getting awful spacing issues in the middle of teh page and all the products are listed way down the page!! I have laid the page out using STS and tried it using t he sts_template.html and the index.php.html methods. The problems seems to be that the only was I can figure out how to lay out a list of all the products for a category is to insert $content into a template. Whenever I use the variable $content I get an awful spacing issue. I have looked in catalog>index.php extensively, but I can't for the life of me figure out how to remove the "LulaKate Catalog" text or the 1x1 image that is invisibke so i can have JUST MY PRODUCTS listed. :-) Also i need to format the "Product Name+" "Price" and "Buy NOw" verbiage that is down there, too. It is ALL in the $content variable.... Is teh $content variabe dynamically defined in the catalog>index.php file? I am afraid to muck with it as I feel I am missing some very obvious way to display my products by category. If you click on a product you will see I am not a cokmplete moroon and have the page laid out more or less how I want. The catalog index page i can figure out using the STS template "index.php_0.html" but to modify the $content variable I feel like I am about to give birth. Any help is greatly appreciated. I have been looking for 5 days honestly and am not lazily looking for help I promise!

Share this post


Link to post
Share on other sites

I hope this is the best place for this query...

 

I've installed the latest version of STS, which BTW looks like it will simplify my web dev a whole lot - so a million thanks.

 

So, STS appears to be working fine - I can create a new html template and it works - however the changes I make in stylesheet.css don't materialise.

 

(I wasn't sure where the stylesheet.css that came with STS was supposed to be placed, so i just replaced the original in the CATALOG dir.)

 

Essentially I'm trying to change the font and font size of all text that appears on my web site - and I understood the best way to go about this was to manipulate the stylesheet.css

 

In the stylesheet all I've I've done so far is change the font size e.g. 12px to 8px - but nothing happens.

 

Any help is really appreciated.

Thanks in advance

LCS

Share this post


Link to post
Share on other sites

I am not a master, but I THINK you need to manipulate the stylesheet in the "mysite" folder inside the sts template folder you created when installing the STS templatye contrib. I am KIND of guessing, but i THINK the stylesheet you modified is being overwritten by the STS template stylesheet and that is why you are not seeing t he changes. Go to catalog>includes>sts_templates>mysite>stylesheet.css and manipulate THAT .css and see what happens!

 

If that doesn;t work post back up so somebody more experienced can help. I am in the process of giving birth to my STS OSC site right now and learning about 5 seconds ahead of you!

 

Dig the forum!

 

 

 

I hope this is the best place for this query...

 

I've installed the latest version of STS, which BTW looks like it will simplify my web dev a whole lot - so a million thanks.

 

So, STS appears to be working fine - I can create a new html template and it works - however the changes I make in stylesheet.css don't materialise.

 

(I wasn't sure where the stylesheet.css that came with STS was supposed to be placed, so i just replaced the original in the CATALOG dir.)

 

Essentially I'm trying to change the font and font size of all text that appears on my web site - and I understood the best way to go about this was to manipulate the stylesheet.css

 

In the stylesheet all I've I've done so far is change the font size e.g. 12px to 8px - but nothing happens.

 

Any help is really appreciated.

Thanks in advance

LCS

Share this post


Link to post
Share on other sites

Hi Brian

 

Are you able to offer any advice on using more than I STS template?

 

I have a good understanding of using the 'sts_template.html'

 

I have installed the QUICK VERSION for 3.00 Beta: and it is running smoothly, but I am trying to set up a category specific template as per the user instructions. Example:

 

index.php_22.html

 

However, the pages for that category do not use the template.

 

Furthermore, is it possible to create a template ONLY for the home page?

 

regards

 

mc

Share this post


Link to post
Share on other sites

Hi guys

 

has anyone good some good experience of using more than I STS template?

 

I have a good understanding of using the 'sts_template.html'

 

I have installed the QUICK VERSION for 3.00 Beta: and it is running smoothly, but I am trying to set up a category specific template as per the user instructions. Example:

 

index.php_22.html

 

However, the pages for that category do not use the template.

 

Furthermore, is it possible to create a template ONLY for the home page?

 

regards

 

mc

Share this post


Link to post
Share on other sites

mental_cube,

 

Try using index.php_0.html for a home page template.

 

The index.php_22.html sure looks like it should work as long as the Category ID is 22.

Share this post


Link to post
Share on other sites

How do I make a separate template for (for example) policy.php.. i would then like to have sts_templates/policy.html... I believe that must be done in sts_display_output.php but could someone please give me some advise how to do that. Thanks!

Edited by Fredrik.r

Share this post


Link to post
Share on other sites

ok sts_template.html controls the outer shell of the online store, the header, the fotter, and right & left column. How do I control how the content pages look? especifically, how do I customize the layout and styling of content box for:

 

the store front

specific category pages

policy

shipping

log in/new accounts

etc.

 

 

thx,deano

Share this post


Link to post
Share on other sites

All files will be located in the sts_templates folder.

 

the store front: index.php_0.html

specific category pages :index.php_22.html <--- Category ID =22. Change of course.

 

If it is a php page that is default to osCommerce you should be able to do like the following in the sts_templates folder.

shipping: shipping.php.html

Shopping car: shopping_cart.php.html

 

If for some reason you need different product info pages you can do such:

product_info.php_40.html <--- specific to an item with ID of 40

 

or

 

product_info.php_c25.html <---- specific product info page for all items in a category with and ID of 25.

 

if you want to create pages that are not default to osc I found this from a post, but saved it because I use it very often.

many

 

there are a few techniques though...

 

what I've done, mind you while using STS template (which makes this much easier because you just remove the content from the page, but it still has loaded all the application_top files etc), is to take a simple page, like conditions strip out all the code that displays stuff the actual "conditions" language text.

 

first, I would find the line of code, somewhere near the top...

 

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CONDITIONS);

 

now change it to something related to the page you want to add.. say:

 

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_DANCE_FEVER);

 

save it as 'dance_fever.php' (this should be in the main catalog directory BTW)

 

now, go into include>languages>(your language)>conditions.php

 

copy all the code, and rename it to "dance_fever.php"

 

go into the new "dance_fever.php" (in languages, not the one in main catalog) file and add or change whatever text calls you want to make.

 

ok, now go into includes>filenames.php

 

add a line, anywhere you want really that says this:

 

define('FILENAME_DANCE_FEVER', 'dance_fever.php');

 

thats pretty much it, now when you go to store.com/dance_fever.php, you will have a page that retains all the correct sessions vars, etc.

 

Taking the given example, you can then put a dance_fever.php.html in the sts_template folder.

 

Hope that helps,

Share this post


Link to post
Share on other sites

hopefully some one could finally help me i'm using osc for a while now and like to use sts too but now i want to use flash for my site!

But now the problem comes every time i hit one of the buttons my cart is empty again and my session is gone what can i do about it PLEASE help me the guys of the dutch forum couldn't help me or just didn't! :P

 

thanks in forward P_angel0

Share this post


Link to post
Share on other sites

Thanks for the tip. I currently have a single sts_templates.html file and its relevant .css file located under server/catalog/includes folder

 

let me make sure I understand the file structure then, create the following folder:

 

1. server/catalog/includes/sts_templates

2. place the content of the specific pages in the above folder.

3. Name those pages as follows

 

	  the store front:													index.php_0.html
  specific category id xx pages:							   index.php_xx.html
  specific product info page in category id xx:		   product_info.php_cxx.html
  specific product id yy info page:							product_info.php_yy.html  
  shipping:															 shipping.php.html
  shopping cart:													 shopping_cart.php.html

 

4. Where do u place the file.css to control styling of the content in the above pages?

Share this post


Link to post
Share on other sites

avail1now,

 

Mine is directly in the catalog folder. I am not the greatest stylesheet.css person, so I usually have to modify a section upload it, see if it changes what I want.

Share this post


Link to post
Share on other sites

I absolutely love this conribution. It has made extremely easy for me to "dumb down" OSC per client requirements. I am stuck on one thing that may be answered by STS or in relation to STS.... how on earth do I change the catalogbox/informationbox <a> settings. I have searched the last two days through the forum's search and google and haven't been able to find anything. The site is on a white background; however, the nav menu is on a blue background.... so I need two seperate link colors. I either need to know how to change the catalogbox/infobox <a> or the content and footer areas <a> I tried to create a clas referenced by the <td>s that contain each item for each area and that still doesn't work.

 

The site is www.preciousbabydesigns.com. I installed great categories trying to solve this issue but haven't been able to figure it out through it either. I am prepared to backlevel to straight STS again.

 

Thank you,

Jen

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

×