Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[contribution] Simple Template System (sts)


DiamondSea

Recommended Posts

Thanks, for your help, it is appreciated

 

I could get around the first error message but now i get this one :

 

Fatal error: Cannot redeclare do_magic_quotes_gpc() (previously declared in

/Applications/MAMP/htdocs/skydog/catalog/includes/functions/compatibility.php:18) in /Applications/MAMP/htdocs/skydog/catalog/includes/functions/compatibility.php on line 30

 

So i looked for a second declaration of do_magic_quotes_gpc() but only found one in the whole site...s

Edited by supertiti
Link to comment
Share on other sites

Thanks, for your help, it is appreciated

 

I could get around the first error message but now i get this one :

 

Fatal error: Cannot redeclare do_magic_quotes_gpc() (previously declared in

/Applications/MAMP/htdocs/skydog/catalog/includes/functions/compatibility.php:18) in /Applications/MAMP/htdocs/skydog/catalog/includes/functions/compatibility.php on line 30

 

So i looked for a second declaration of do_magic_quotes_gpc() but only found one in the whole site...s

 

Jean, your new page may not have been setup correctly. First off, is this a new page or simply an infobox or insert? If this is a new page, you should look into my "Add New Pages Using STS" add-on available in the STS Add-on download site (link in my signature below).

Bill Kellum

 

Sounds Good Productions

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

Link to comment
Share on other sites

  1. You can always create a home page template and name it index.php_0.html and then create a default category template to be used for all other category pages and name it index.php.html.
  2. Take a look at my post regarding adding the cart to show only the number of items and basket total:
    http://www.oscommerce.com/forums/index.php?sho...p;#entry1195537
  3. You could either edit the catalog/product_info.php file (not very difficult to simply move the product image to the left table cell) or use the STS Product Info Template feature to layout your product page anyway you want using HTML.

 

This may be very stupid of me but I do not see where the info is for the showing items and cart total on that link you sent me.

I'm a real beginner at all of this php and dynamic sites stuff.

 

Sorry.

Link to comment
Share on other sites

This may be very stupid of me but I do not see where the info is for the showing items and cart total on that link you sent me.

I'm a real beginner at all of this php and dynamic sites stuff.

 

Sorry.

The link sent you to post# 3317 of this thread.

It creates some new STS tags for you to use to display the shopping cart in the header of your template or anywhere else you want to place it.

 

The final output will look like this:

My Account | Log Off | You have 3 items in your cart $9.75

Bill Kellum

 

Sounds Good Productions

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

Link to comment
Share on other sites

Jean, your new page may not have been setup correctly. First off, is this a new page or simply an infobox or insert? If this is a new page, you should look into my "Add New Pages Using STS" add-on available in the STS Add-on download site (link in my signature below).

 

Thanks i'll try that !

Link to comment
Share on other sites

Hi Bill

 

How are you. I hope you can help me with a question I have?

 

I want to create a separate content for a custom page - let's call it 'video'.

 

Here's what I've done so far:

I followed the "Create A New Page" instructions PDF that I found on here (very helpful)

 

1) I've created cataloge/video.php

2) Created includes/languages/english/video.php

3) Added: define('FILENAME_VIDEO','video.php'); to filenames

4) added the suggested string to sts_user_code.php

5) in includes/sts_templates, I've created 'video.php.html' template file (copied from my main site template)

 

Now, for the life of me, I can't work out how to call the '$content' tag from a separate content file? And where would I place that content file?

 

I guess put simply, I want 'video' to look the same as the rest of my site template, but I want to be able to write a custom content page for 'video' within STS. How do I do this?

 

The content page needs to be able to execute <php includes> etc... I'm assuming this won't be an issue?

 

Your advice greatly appreciated.

Regards

Sol

Link to comment
Share on other sites

Hi Bill

 

How are you. I hope you can help me with a question I have?

 

I want to create a separate content for a custom page - let's call it 'video'.

 

Here's what I've done so far:

I followed the "Create A New Page" instructions PDF that I found on here (very helpful)

 

1) I've created cataloge/video.php

2) Created includes/languages/english/video.php

3) Added: define('FILENAME_VIDEO','video.php'); to filenames

4) added the suggested string to sts_user_code.php

5) in includes/sts_templates, I've created 'video.php.html' template file (copied from my main site template)

 

Now, for the life of me, I can't work out how to call the '$content' tag from a separate content file? And where would I place that content file?

 

I guess put simply, I want 'video' to look the same as the rest of my site template, but I want to be able to write a custom content page for 'video' within STS. How do I do this?

 

The content page needs to be able to execute <php includes> etc... I'm assuming this won't be an issue?

 

Your advice greatly appreciated.

Regards

Sol

 

Sol,

 

There are three ways of doing this:

  1. Create the content in the video.php file itself, or
  2. Create a content template for video.php (complex but possible to do), or
  3. Create the content in the video.php.html template itself (easiest to do).

Since you are using STS, I suggest option #3. Simply leave out the $content tag within the video.php.html template and add your static content into the template wherever you want it.

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

Link to comment
Share on other sites

Sol,

 

There are three ways of doing this:

  1. Create the content in the video.php file itself, or
  2. Create a content template for video.php (complex but possible to do), or
  3. Create the content in the video.php.html template itself (easiest to do).

Since you are using STS, I suggest option #3. Simply leave out the $content tag within the video.php.html template and add your static content into the template wherever you want it.

 

 

Thanks Bill - I have considered option 3 and whilst it is the easiest, I would really like to use option 2 - would you be willing to explain it further ?

Thanks

Sol

Link to comment
Share on other sites

see the demo at: www.bluegreenenterprises.com

 

New OSC Bundle package comming soon:

 

give it a try and let me know what you think...

 

Google Checkout (v1.4.5a).

STS v4.5.8.

Web Mobile Thumbnails - in POPUP IMAGE.

Dynamenu (Gone Nuts Bonkers) - Multiple Flyout Menu System.

Extra Admin links to New Add-Ons.

Admin - Multi Product Update - Weight, Prices and QTY.

Hide Empty Categories (Dynamenu also hides empty Categories).

Admin->modules->shipping - Individual Product Shipping Prices.

STS Articles

Link to comment
Share on other sites

Thanks Bill - I have considered option 3 and whilst it is the easiest, I would really like to use option 2 - would you be willing to explain it further ?

Thanks

Sol

 

OK, but you are on your own as I do not have a lot of time to go into great detail. I hope I can make it plain enough so that it is helpful to you....

 

If you are using STS 4.5 or higher, and want to create a new page that for example displays some text, you can do it with only few lines of code.

  1. Create an empty new page in your shop's catalog, for example mypage.php (you can use my "Add New Pages Using STS" add-on available in the STS Power Pack site to assist you in this)
  2. As for all catalog pages, you have to first call application_top.php (again, this is done for you if you used my step by step to add new pages):
    require('includes/application_top.php');


  3. As we have not created a STS module for this new page, STS will use the Default module(includes/modules/sts/sts_default.php). The Default module can handle content templates, we just have to specify which content template to use.
     
    In our example, we will use the content template mypage.php.html, which should be located in the content folder of the actual template set (includes/sts_templates/*your template folder*/content/mypage.php.html).
     
    Add the following code into your new page:
    $sts->script->content_template_file = STS_TEMPLATE_DIR . "content/mypage.php.html";


    Note that STS has a predefined name for a default content template: $sts->default_content_template, so you can modify the logic above to use it if the mypage.php.html is not found on the server. The name of this default content template is sts_template.html (must be located in the content folder).

  4. In your new page, you now have to create an array with placeholder names and values, placeholders that you will be used on your content template. The array should be in the format: $template_content ['placeholdername'] = 'placeholdervalue';
  5. On your content template you can now use {$placeholdername} (the leading and trailing characters are fixed). This is important to not change the name of the array!
     
    The example below defines the following placeholders: {$content}, {$image}, {$button_right}.
    $template_content = array(); // Create the array
    $template_content['content'] = TEXT_DESCRIPTION_MYPAGE; // Define this text in a language file
    $template_content['image'] = tep_image(DIR_WS_IMAGES . 'table_background_specials.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT);
    $template_content['buttonright'] = '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>';


    Note that if you have a lot of code to place here, you may want to put it in another file and just include it from here. Generally, extra files for STS are placed in catalog/includes/modules/sts_inc folder.

  6. Once the placeholders are created, we can continue to add code just like any other php page in your shop, by calling the header, columns and footer. As we are using a content template, we don't need to process all the original osCommerce files:
      require(DIR_WS_INCLUDES . 'header.php'); // Get messages if any
     require(DIR_WS_MODULES . 'sts_inc/sts_column_left.php'); // Get infoboxes
     require(DIR_WS_INCLUDES . 'application_bottom.php'); // Finish, print everything


  7. That's it, you have your new page using a content template. Be careful of one thing though; if several pages are using the same template, all these pages must create the same placeholders, empty if needed. Otherwise you will see the name of the placeholder when viewing those pages!

I didn't have the time to test the above to be sure that I did not leave out a step but it should get your started in the right direction. If you happen to use this method, please post a working copy of your new page so that other STS users can benefit.

 

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

Link to comment
Share on other sites

Hi I just uploaded my site and I'm getting this message:

 

Redirect Loop

 

 

Redirection limit for this URL exceeded. Unable to load the requested page. This may be caused by cookies that are blocked.

 

 

 

The browser has stopped trying to retrieve the requested item. The site is

 

redirecting the request in a way that will never complete.

 

 

 

 

* Have you disabled or blocked cookies required by this site?

 

 

* NOTE: If accepting the site's cookies does not resolve the problem, it is probably a server configuration

 

issue and not your computer.

Link to comment
Share on other sites

Hi,

 

Does anyone know if its possible to have rotating banners with STS? I know theres the $banner_only command that calls the banner .. but with oscommerce its possible to have rotating banners in different places. Like a banner at the top of the page can change depending on what catagory you click to.

 

For example if there was a banner that was an advert for a mouse, you can set it to only display when the hardware catagory is clicked...

 

I was just wondering if its possible to do this with STS? It would be great if you could....

 

Thanks

Link to comment
Share on other sites

Hi,

 

Does anyone know if its possible to have rotating banners with STS? I know theres the $banner_only command that calls the banner .. but with oscommerce its possible to have rotating banners in different places. Like a banner at the top of the page can change depending on what catagory you click to.

 

For example if there was a banner that was an advert for a mouse, you can set it to only display when the hardware catagory is clicked...

 

I was just wondering if its possible to do this with STS? It would be great if you could....

 

Thanks

Yes, set it up in the admin and then STS will display depending upon the settings. Use the $banner_only tag in your template. This placeholder contains the banner generally displayed in the footer of the page. Empty if no banner to display.

Bill Kellum

 

Sounds Good Productions

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

Link to comment
Share on other sites

Thanks Bill that's aswesome. I'm gonna have a crack at it this weekend.

 

Meanwhile, I need to link to a <php include? file in my new sts template file. But <php includes> don't seem to work because of the .php.html file extension. When I change it to .php obviously it works.... but then the file itself doesn't load!

 

Any suggestions how I can achieve this pls?

 

Thanks for your help so far.

Sol

Link to comment
Share on other sites

Thanks Bill that's aswesome. I'm gonna have a crack at it this weekend.

 

Meanwhile, I need to link to a <php include? file in my new sts template file. But <php includes> don't seem to work because of the .php.html file extension. When I change it to .php obviously it works.... but then the file itself doesn't load!

 

Any suggestions how I can achieve this pls?

 

Thanks for your help so far.

Sol

Sol, STS templates are not a place to do PHP includes. Rather, you should create a tag for the code in the sts_user_code.php file and then create your link using the new tag you just created.

 

With that said, includes work just fine in your templates (.html has nothing to do with it). I use a header template include as well as a footer template include. Look at my header and footer include templates available in the STSv4 Power Pack site as an example.

Bill Kellum

 

Sounds Good Productions

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

Link to comment
Share on other sites

Hi Bill,

 

Appreciate all your work here.

 

I use STS and I am having a problem with text in my site. When I first started, all text used to 'wrap' if I inputted it in the admin or in the html part of the site. However, recently I've noticed that text will not wrap itself anymore. I have to manually insert <br> tag at the end of each line so that it returns to a new line. I was wondering where the wrap part of the code was in STS so that I can go and check it and make sure that I haven't gone and deleted it by accident whiole making changes.

 

Thanks again for all your help on this site.

 

Regards,

 

Tomo

Link to comment
Share on other sites

Hi there, i'm trying to figure out how to use the get_javascript function in STS, in order to add google analytics support, i might create a contribution to that too, simplifying the process.

 

The question is : where to put the code for it to show in the "application2header" part of the template's source ?

 

Cheers !

 

Terence

Link to comment
Share on other sites

  • 2 weeks later...

Hello Bill,

 

Not spoken in any way for a while, but i hope i have a '''little''' but interesting question for you...

 

I have just hit upon a novil idea to use STS as the defining software that could solve a long term wish that I wanted to solve.

 

You may remember that I did the sts external pages templates contribution to bring pages outside of the osc folder within the wings of the template.

 

This was aimed at the overall aim of having several domain names targeted at a single server.

 

Now i dont have a server that allows multiple domain names pointing to individual index files but I do have STS

 

AND THAT IS WHEN THE BRAINWAVE HIT TODAY.

 

May i point your attention to my demo site to illustrate my point:

 

http://www.bluegreenenterprises.com/OSC_TE...v145a/index.php

 

Now look at:

 

http://www.bluegreentechnologies.com/OSC_T...v145a/index.php

 

These are both exactly the same index file and hence (((sts_template.html.php))) for both addresses but a little bit of cheeky coding will allow me to effectively

produce a secondary template for another domain name.

 

I hope you see where I am going here...

 

Now as you see from the second link, I get the Dynamenu output from my DynamenuGoneNutsBonkers contribution addition.

 

I believe that this only shows up because includes/application_bottom.php is included after the templae file has been processed by STS.

 

Could you shed a little light on how this works?

 

 

By the way. cheeky coding is:

 

 

<?PHP

 

IF(!($_SERVER['SERVER_NAME'] == 'www.bluegreenenterprises.com')){

 

ECHO 'NOT www.bluegreenenterprises.com BUT SERVER = '.$_SERVER['SERVER_NAME'] .' HENCE WE CAN USE A SEPARATE TEMPLATE FOR DIFFERENT WEBSITES <BR>

ONE PROBLEM WITH THAT IS WHAT IS SEEN BELOW. THIS COLUD BE DUE TO OSC APPLICATION_BOTTOM.PHP BEING ADDED LATER VIA THE SIMPLE TEMPLATE SYSYEM';

 

}else{

 

?> --- doctype and rest of template file as you would normall do.....

 

finished of with:

 

<?PHP } // end ifelse not bluegreenenterprises.com ?>

 

obviously

 

Dam my spelling still hasnt improved with a few beers... ;o) teehee

Edited by MatthewRitchie
Link to comment
Share on other sites

i had a designer setup my online store with oscommerce. now i want to add a new category to my shop which should show up on the homepage. i created a new category under admin and added all the products. which files do i have to change and how, to get the catgeory added to my homepage?

Link to comment
Share on other sites

Now as you see from the second link, I get the Dynamenu output from my DynamenuGoneNutsBonkers contribution addition.

 

I believe that this only shows up because includes/application_bottom.php is included after the templae file has been processed by STS.

 

Could you shed a little light on how this works?

 

I solved the problem of the above almost.... sorry, this part was actually not a sts question but is mentioned here because dynamenu instructions are included in the sts_power_pack.

 

I will try to ask the question a little better:

 

How does sts pick up application_bottom.php?

 

sts works by capturing code from a file.php in the shop, and using various classes and functions manipulates the code [chopping of sections before/after a table or form] before sticking it all back together in relation to what the template file is telling sts to do.

 

question:

 

How does sts deal with php includes like the one for application_bottom.php?

 

Does the sts start/stop capture() simply ignore the php untill later or is it processed as it goes along?

 

 

 

 

Actually!!! Thinking aloud here....

 

 

 

 

What am I trying to achieve? --- a front page that determins which domain name has been used to make the call to the server and outputs an individual style of template for that domain name.

 

What was I trying to do above? --- remove the dynamenu links from the bottom of the screen.

 

Where are the dynamenu links included? --- in application_bottom.php which is associated with the oscommerce style of index.php page.

 

Now there are two ways that this could work...

 

first is to have a query statement in the index file that says use this code[1] for domain[1] or code[2] for domain[2] etc. hence the application_bottom.php include could be allowed in [1] and not [2] thus dynamenu links would not show in [2].

 

second - sts_template.html, I believe would need a similar domain name identifier statement to provide different templates for each domain.

Link to comment
Share on other sites

Hello and thank you for any help you can provide in advanced!

 

I've setup an osc store and everything with the template is working fantastic except for one thing! Because of words in different languages have different characters i've created 2 entirely different header menu buttons. When i try to use $langid to pickup which language is in use with the template i receive no data on my php code.

 

<?php if($langid == 1) {

 

(code would go here for header images)

 

}else{

 

(code would go here for secondary header images)

 

}

?>

 

When i place $langid inside of a php code piece period i get no value on it. While if i place $langid anywhere on the page without it being inside of a php code piece i get value. Any ideas?

Link to comment
Share on other sites

Hi,

 

Where should I put the Google Adwords code to track sales in my shop, when I'm using STS?

 

Hope some can help me

 

Best regards,

 

Jesper Brejning

www.BabyGear.dk - Kids on the go!

Link to comment
Share on other sites

Hello and thank you for any help you can provide in advanced!

 

I've setup an osc store and everything with the template is working fantastic except for one thing! Because of words in different languages have different characters i've created 2 entirely different header menu buttons. When i try to use $langid to pickup which language is in use with the template i receive no data on my php code.

 

<?php if($langid == 1) {

 

(code would go here for header images)

 

}else{

 

(code would go here for secondary header images)

 

}

?>

 

When i place $langid inside of a php code piece period i get no value on it. While if i place $langid anywhere on the page without it being inside of a php code piece i get value. Any ideas?

 

Your problem is related to a global variable but you do not need to place an "if" statement in order to display a language driven image. Simply do the following:

 

Create your images as so:

 

image1.jpg, image2.jpg, etc, depending on the languages being used, and save them in your template images folder. The number for the LangID will come from your particular osC implementation. To find the language ID, 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 button:

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

Where $langid will be replaced dynamically by the correct language id number.

For example:

english is ID=1 in my shop so the URL would be dynamically changed to "my_template_folder/images/image1.jpg" if the user selected the language "english" in my shop. If the user selected a different language, then that particular language image would appear.

 

Hope this got you on your way.

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

Link to comment
Share on other sites

i had a designer setup my online store with oscommerce. now i want to add a new category to my shop which should show up on the homepage. i created a new category under admin and added all the products. which files do i have to change and how, to get the catgeory added to my homepage?

 

 

It appears your designer used "static" links to create your category menu otherwise it would have automatically displayed on the home page. Here is how you create your new static link to your new category:

 

STS Link to a category:

 

<a href="<?php echo tep_href_link('index.php', 'cPath=21&', 'NONSSL'); ?>">Category Name Here</a>

Change the cpath number to the correct category number of your new category.

 

STS Link to a product:

<a href="<?php echo tep_href_link('product_info.php', 'products_id=53&', 'NONSSL'); ?>">Product Name Here</a>

Change the product ID number to the product ID number of the product you are linking to.

You can use the links above to create your menus.

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

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