Jump to content
DiamondSea

[contribution] Simple Template System (sts)

Recommended Posts

Hello Bill,

I finally created several templates for different pages. They are named contact_us.php.html, conditions.php.html... basing on the name of the script executed like explained in section 3.6.

But now I'm looking for having 2 index pages, one in french and one in english.

I have some hyperlinked pictures with french words on my index page, that's why I need 2 index pages.

I copied index.php and renamed it to index_en.php and then I made a template called index_en.php.html

Is there a better way to do that ?

I don't like referring STS related questions to other threads but I think the following thread will help you out with this. Please post all replies back in this thread. (thanks)

 

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

 

Hope this helps,


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
Thanks Bill...sorry but just one more question!!

 

Is it possible to use this contribution? http://www.oscommerce.com/community/contributions,2058

 

I tried to install it, but once I upload the provided english.php file, it completely ruins my layout. Is there a way around this?

 

Thanks so much for your help :D

Yusuf,

 

You should not have any problems using that contribution along with STS. Keep in mind though, you will need to add a STS tag for the loginbox.php so that you can place the box where you want it in your template.

 

Add this code to sts_user_code.php

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

 

The above would create a STS user tag called $loginbox which you could place anywhere in your STS Template where you want the login box to be displayed.

 

:thumbsup: I believe your troubles with the english.php file is that you just copied the one from the login box contribution over your existing english.php file. DO NOT DO THIS. You should just ADD the addition defines listed from the loginbox english.php version to your existing english.php version.

 

:thumbsup: :thumbsup: NOTE: To anyone who is interested...there is an alternative to adding a custom login box to your STS template.

Deano provided this addon some time back:

 

<!--  add this to your sts template file. --->
<div id="login">
<form action="http://path_to_yourstore/login.php?action=process" method="post" name="login" >
Login:<input type="text" name="email_address"/><br/>
Password:<input type="password" name="password"/><br/>
<a id="sign_in" onclick="login.submit()">Sign in</a>
<a id="sign_up" href="/create_account.php">Sign up</a>
<a id="forgot" href="/password_forgotten.php">Forgot?</a><br/>
$logoff
</form>
</div> <!-- end of login -->

 

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
Hello Bill,

I finally created several templates for different pages. They are named contact_us.php.html, conditions.php.html... basing on the name of the script executed like explained in section 3.6.

But now I'm looking for having 2 index pages, one in french and one in english.

I have some hyperlinked pictures with french words on my index page, that's why I need 2 index pages.

I copied index.php and renamed it to index_en.php and then I made a template called index_en.php.html

Is there a better way to do that ?

 

Actually, here is the link I wanted you to look at (over in the STSv4 Forum):

 

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


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 don't like referring STS related questions to other threads but I think the following thread will help you out with this. Please post all replies back in this thread. (thanks)

 

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

 

Hope this helps,

I thank you for this Bill.... but I can't make it work.

When I click on the flags the language of the page change (as before), but not the images, there's no images displayed...

I copied and pasted your codes and renamed my images to m1.gif and m4.gif then moved them to /catalog/images

But it still doesn't work :(

Share this post


Link to post
Share on other sites
I thank you for this Bill.... but I can't make it work.

When I click on the flags the language of the page change (as before), but not the images, there's no images displayed...

I copied and pasted your codes and renamed my images to m1.gif and m4.gif then moved them to /catalog/images

But it still doesn't work :(

The problem is solved,

I simply added $ after $langid.... but in the template, not in the general.php like I did before

Sorry.

Share this post


Link to post
Share on other sites

Here's my situation at the moment,

I added this code in general.php :

$sts->template['langc'] = $language_code; // new tag for country code

And this code in /catalog/includes/application_top.php :

$language_code = (isset($HTTP_GET_VARS['language']) && tep_not_null($HTTP_GET_VARS['language'])) ? $HTTP_GET_VARS['language'] : DEFAULT_LANGUAGE;

And I modified my links consequently like this :

<a href="/catalog/shopping_cart.php?language=$langc$">

This solution isn't perfect because it doesn't work in case of redirection.

For example when I click on the link "/catalog/account.php?language=$langc$" and I'm a new client or not connected.

I arrive on the login.php page and, in the address there's "http://localhost/catalog/login.php" instead of "http://localhost/catalog/login.php?language=fr" (or en)

The language for this page is correctly selected but it's after, when I click on any other link of the page that the default language is selected. The link are as this one "http://localhost/catalog/login.php?language=" instead of "http://localhost/catalog/login.php?language=fr" (or en)

Share this post


Link to post
Share on other sites

I have a somewhat urgent problem.

 

I need to have the manufacturer field appear on my /content/product info pages. This is a bookseller, and I am using the manufacturer field to hold publishers, of which I have about fifty.

 

To be truthful, I don't have time to practice and learn the techniques for adding custom fields as described in the documentation. (Yes, that's very bad, I know.) I am wondering if someone has worked this out already and would be willing to share, or if perhaps there's a contribution that will do it for me.

 

You can have a look at the site-in-progress here:

 

http://www.stbedesbooks.com

 

Select any of the new books from the front page, and you'll see immediately why this variable is so important. Site is under construction, and top links do not yet work--infoboxes work if you want to have a look.

 

Thanks in advance, and in much haste,

 

Anne

Share this post


Link to post
Share on other sites
I have a somewhat urgent problem.

 

I need to have the manufacturer field appear on my /content/product info pages. This is a bookseller, and I am using the manufacturer field to hold publishers, of which I have about fifty.

 

To be truthful, I don't have time to practice and learn the techniques for adding custom fields as described in the documentation. (Yes, that's very bad, I know.) I am wondering if someone has worked this out already and would be willing to share, or if perhaps there's a contribution that will do it for me.

 

You can have a look at the site-in-progress here:

 

http://www.stbedesbooks.com

 

Select any of the new books from the front page, and you'll see immediately why this variable is so important. Site is under construction, and top links do not yet work--infoboxes work if you want to have a look.

 

Thanks in advance, and in much haste,

 

Anne

Anne,

Actually, using the Manufacturer as "Auther" is quite "normal" for a bookstore. :thumbsup:

 

Now regarding your issue...

If you are actually using product info templates, then you could easily add the $manufacturerbox tag where you want your Auther info to be. As long as you have configured your products (books) to the proper manufacturer (author) in your store's admin, the manufacturer's box will dynamically populate with the correct manufacturer (author) for the product (book) being displayed.

 

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

Can I edit the administration sections sections to fit my design in oscommerce? If so someone give me some insight on this?

Share this post


Link to post
Share on other sites
Can I edit the administration sections sections to fit my design in oscommerce? If so someone give me some insight on this?

Tyler,

Yes, you can change the admin style but you will not be able to use STS to do it. Poke around the files within yourstore.com/admin/includes folder for the admin stylesheet, box files, etc.


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
Anne,

Actually, using the Manufacturer as "Auther" is quite "normal" for a bookstore. :thumbsup:

 

Now regarding your issue...

If you are actually using product info templates, then you could easily add the $manufacturerbox tag where you want your Auther info to be. As long as you have configured your products (books) to the proper manufacturer (author) in your store's admin, the manufacturer's box will dynamically populate with the correct manufacturer (author) for the product (book) being displayed.

 

Hope this helped,

 

Hmm. I probably didn't do a good job of laying out the problem. Actually, $manufacturerbox is on every page, over in the left-hand column. It's configured as a pull-down menu, and at this point is used for the publishers of the books--and there are a LOT of publishers.

 

Where I'm in trouble is on the custom product templates--the "content" templates. What I have is:

 

Title: (the product)

Author: (I used model number, increased the length of the field)

Product Description: (same as always)

Image: (same as always)

Add to Cart button: (same as always)

Price: (same as always)

 

What's missing from this nice little block is the ability to add the specific "manufacturer" or publisher, of that specific book. Because it's a specialized bookstore, that is information that purchasers will want to know.

 

In looking through the sts_user_code I find instructions for adding a new box (which I don't need to do).

There are instructions for declaring a new variable, but it appears it will always be the same:

$sts->template['MyText']='Hello World'; -- every time I place $MyText in a template, we'll see the same string--"Hello World"

 

What I need to do is set up so that I can have a variable that allows me to add "$manufacturer" and have it display the manufacturer associated with the specific product.

 

If I can get that done, it should be a simple matter to declare some additional variables for custom fields I might create including ISBN number, binding (hardcover/softcover), etc. -- the bibliographic data people want when they buy a book. I believe a bookseller has already written a contrib for those extra fields, but it doesn't mesh with STS as far as displaying them.

 

This would make STS a really powerful ally for indie bookstores wanting to use OSC.

 

Thanks!!

Anne

Share this post


Link to post
Share on other sites
Bill, help me with my languages issues please....

 

Did you try the following?

 

How to have a different image per language in STS:

 

Add the following code to your includes/modules/sts_inc/general.php file:

$sts->template['langid'] = $languages_id;

 

The above will create a STS tag called: $langid

 

Now you can create your images as so:

 

myimage1.jpg, myimage2.jpg, myimage3.jpg, etc, depending on how many languages you have in your shop, and save them in your images folder (or any osC folder such as images/banners).

 

:thumbsup: You can name the image anything you want but just keep them the same, just change the number according to the ID of the language that it represents. In other words, you do not have to name them "myimage". You could name them "languagemenu1.gif" or languagemenu2.gif" and so on.

 

:thumbsup: The number for the LangID will come from your specific osCommerce settings. To find the language ID for each of your shop's languages, go to your Admin, Localization, then select each language and view the ID in the URL.

 

Now add the following into your STS Template where you want the dynamic language image to appear:

<img border="0" src="images/myimage$langid.jpg">

 

 

The STS tag "$langid" will be replaced dynamically by the correct language id number that the user selects when viewing your shop.

 

For example:

english is ID=1 in my shop so the URL would be dynamically changed to "images/myimage1.jpg" if the user select the language "english" in my 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
Tyler,

Yes, you can change the admin style but you will not be able to use STS to do it. Poke around the files within yourstore.com/admin/includes folder for the admin stylesheet, box files, etc.

 

 

On the STS does my designs have to be a certain size? what if my design comes in slices? Like the banner, right side bar, and etc?

 

also how do I change the design on the cart?

Share this post


Link to post
Share on other sites

STS and Featured Products

 

:thumbsup: For those who may be interested, I just uploaded a new contribution on the Featured Products site to assist STS 4.5.2 (and above) users with the installation of Featured Products 1.5.9.

 

All files have been provided to make an easy merge into your existing store. Manual edits have been given as well.

 

Here is the link:

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

 

Hope this makes things easier for everyone. :lol:

 

Enjoy,

Edited by bkellum

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

 

On the STS does my designs have to be a certain size?
Nope.
what if my design comes in slices? Like the banner, right side bar, and etc?
As long as you know how to convert those slices to HTML then you are fine. Programs such as Photoshop will create the HTML for you.
how do I change the design on the cart?
Not sure what you are asking with this one. Sorry. :blink:

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

As long as you know how to convert those slices to HTML then you are fine. Programs such as Photoshop will create the HTML for you.

Not sure what you are asking with this one. Sorry. :blink:

 

 

Yes I know how to write html, and php I write php for a living and design shopping carts from bottom to top, I'm very new to oscommerce, so I'm not famaliar with the code, and etc. What I'm asking is the shopping cart design, can I change the look of how it returns the tables and rows?

Share this post


Link to post
Share on other sites
Yes I know how to write html, and php I write php for a living and design shopping carts from bottom to top, I'm very new to oscommerce, so I'm not famaliar with the code, and etc. What I'm asking is the shopping cart design, can I change the look of how it returns the tables and rows?

Tyler, hope you didn't take offense to the answers that I tried to give you (none was meant). If you are good with PHP, STS is an excellent tool to assist you in designing osC. I feel it brings added functionality because you can add PHP directly within the template itself and do all kinds of neat stuff.

 

I'm still having a little trouble understanding what you are asking but I'll take a stab at it anyway. I think you are wanting to know if STS can template the "content", or the "stuff in the middle" of each page like how many columns a product listing table may have and such. The answer to that is STS "out of the box" can't do that. It could, but you would need to create a module similar to the product info module that creates a content template for the product_info.php page.

 

I know a lot of users would like such a module that would create a content template for each catagory or manufacturer page but "out of the box" STS is configured to only templating the "layout" of those pages only.

 

Similar to the infobox templates which basically create a "wrapper" around the PHP content of each individual box.

 

So, if you are interested, a category, manumfacturer or even a product listing content module would be a nice little PHP project for you. :thumbsup:

 

Hope this answered your question,

Edited by bkellum

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
Tyler, hope you didn't take offense to the answers that I tried to give you (none was meant). If you are good with PHP, STS is an excellent tool to assist you in designing osC. I feel it brings added functionality because you can add PHP directly within the template itself and do all kinds of neat stuff.

 

I'm still having a little trouble understanding what you are asking but I'll take a stab at it anyway. I think you are wanting to know if STS can template the "content", or the "stuff in the middle" of each page like how many columns a product listing table may have and such. The answer to that is STS "out of the box" can't do that. It could, but you would need to create a module similar to the product info module that creates a content template for the product_info.php page.

 

I know a lot of users would like such a module that would create a content template for each catagory or manufacturer page but "out of the box" STS is configured to only templating the "layout" of those pages only.

 

Similar to the infobox templates which basically create a "wrapper" around the PHP content of each individual box.

 

So, if you are interested, a category, manumfacturer or even a product listing content module would be a nice little PHP project for you. :thumbsup:

 

Hope this answered your question,

 

Bill,

 

This is what I was after too....

Check out http://forums.oscommerce.com/index.php?showtopic=269533

 

I'm confused as to if I can change the table layout - and if so - where!

 

David

Share this post


Link to post
Share on other sites
Bill,

 

This is what I was after too....

Check out http://forums.oscommerce.com/index.php?showtopic=269533

 

I'm confused as to if I can change the table layout - and if so - where!

 

David

David, STS will allow you to template the "content" of the product_info.php page only. Take a look at the sample template in the full/content/ folder. This content template will allow you to rearrange the layout of the product info page.

 

On all other pages, such as the one you mentioned, STS currently only allows your to modify the layout of the entire page, minus what is pulled in by the $content variable.

 

OK...now regarding what STS looks at regarding the $content variable. The $content is taken from the php script you are running. For example, the $content for index.php is the piece of code you find in index.php, between the call of column_left and the call of column_right. If you want to modify it, you have to modify the script itself.

 

Take a look at that area and see if it would be too daunting for you. Otherwise, I strongly suggest installing other contributions to make these modifications. For example: If you are wanting to change the content of the way the products are listed, say, make them in multible columns verses just separate rows, I would install the Products Listings in Columns contribution (http://www.oscommerce.com/community/contri...g+Column+Format).

 

The above contribution would actually be making changes to the same area that the STS $content tag represents for the listing of products.

 

I hope the above makes sense to you. It really is a solid way of modifying your osCommerce store to give it that custom look that you need.


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
David, STS will allow you to template the "content" of the product_info.php page only. Take a look at the sample template in the full/content/ folder. This content template will allow you to rearrange the layout of the product info page.

 

On all other pages, such as the one you mentioned, STS currently only allows your to modify the layout of the entire page, minus what is pulled in by the $content variable.

 

OK...now regarding what STS looks at regarding the $content variable. The $content is taken from the php script you are running. For example, the $content for index.php is the piece of code you find in index.php, between the call of column_left and the call of column_right. If you want to modify it, you have to modify the script itself.

 

Take a look at that area and see if it would be too daunting for you. Otherwise, I strongly suggest installing other contributions to make these modifications. For example: If you are wanting to change the content of the way the products are listed, say, make them in multible columns verses just separate rows, I would install the Products Listings in Columns contribution (http://www.oscommerce.com/community/contri...g+Column+Format).

 

The above contribution would actually be making changes to the same area that the STS $content tag represents for the listing of products.

 

I hope the above makes sense to you. It really is a solid way of modifying your osCommerce store to give it that custom look that you need.

 

Cheers Bill, I'll look in to it.

 

One thing I wanted to do was change the table layout.

At the moment, it's like this :

 

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

- image | description | price | BUY |

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

 

What I wanted to do was have :

 

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

| | Description |

| |-------------------

| | Price |

| image |--------------------

| | BUY NOW |

|-----------------------------

 

 

But, I think this would involved changing the index.php file - yes ?

 

Cheers :)

 

David

Share this post


Link to post
Share on other sites
Cheers Bill, I'll look in to it.

 

One thing I wanted to do was change the table layout.

At the moment, it's like this :

 

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

- image | description | price | BUY |

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

 

What I wanted to do was have :

 

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

| | Description |

| |-------------------

| | Price |

| image |--------------------

| | BUY NOW |

|-----------------------------

But, I think this would involved changing the index.php file - yes ?

 

Cheers :)

 

David

 

Table didn't really come out right!!

 

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

|............|...Description....|

|............|-------------------

|............|...Price..............|

| image |--------------------

|............|...BUY NOW.......|

|-----------------------------

Share this post


Link to post
Share on other sites

Hi Bill,

 

I saw that you create a specific contribution for osocmmerce online merchant rc1. I installed this version of oscommerce, but installed the STS 4.5.2 before to know about the STS 4.5.3. Anyway to update only the modifications or I need to change all the pages again. Thanks.

Share this post


Link to post
Share on other sites

I was wondering if anyone could help me with a small STS issue.

I love the STS contribution. I wouldn't know what to do without it.

 

I also use McGrath's Sorter/Copier to sort hundreds of attributes - critical to my store.

 

When I use the STS template for product info page, the sort function in Sorter/Copier does not work.

Product attributes appear in a seemingly random order when they should appear in the order of their sort order.

 

I suppose it has something to do with where $optionchoices$ comes from but I wouldn't know where to begin fixing it.

 

Can anyone offer advice? For now, I have turned off the template for the product info page but I really want to use it.

 

Thanks in advance

Amy

Edited by lazykins

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

×