Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[contribution] Simple Template System (sts)


DiamondSea

Recommended Posts

Greetings!

 

I am trying to get my hands dirty with the STS contribution and I have tried to follow the instructions but I guess I am just a bit challenged here. :)

 

My knowledge of php is very basic by I have implemented it in the past and I have been pretty good at it, but I am having trouble with the STS install.

 

So far I have installed the files in my catalog/includes/ folder but I keep getting this error:

 

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

 

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

 

I am also having trouble understanding the following: Does the HTML template go in the includes also? and if it does, does the index.php in the main folder point to that html template?

 

Thanks!!!!

Link to comment
Share on other sites

Greetings!

 

I am trying to get my hands dirty with the STS contribution and I have tried to follow the instructions but I guess I am just a bit challenged here. :)

 

My knowledge of php is very basic by I have implemented it in the past and I have been pretty good at it, but I am having trouble with the STS install.

 

So far I have installed the files in my catalog/includes/ folder but I keep getting this error:

 

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

 

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

 

I am also having trouble understanding the following: Does the HTML template go in the includes also? and if it does, does the index.php in the main folder point to that html template?

 

Thanks!!!!

You might want to upgrade your editor

 

headers already sent error

 

The template belongs in the includes (only) If you follow the install instructions the template will be called.

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

HOW TO CREATE PRODUCT-SPECIFIC TEMPLATES IN STS:

 

STS is awesome, but currently you can only create one generic template for all the products.  The code below will allow you to create templates for every single product in your store.  This will allow you to put extra pics on a particular product page, put additional info about a product, and even do cross-selling and upselling.  The possibilities are endless!

 

This code was contributed by Chris Langtiw (screen name: Jaxx), and I take no credit.

 

///////Product-specific templates (contributed by Chris L.)
// Are we in the product_info.php script?
if ($scriptbasename == "product_info.php") {
// Look to see whether the product id was sent, otherwise don't bother
if (isset($HTTP_GET_VARS['products_id'])) {
? $sts_productid = $HTTP_GET_VARS['products_id'];

? // Look for product-specific template file like "product_info.php_17.html"
? $sts_check_file = STS_TEMPLATE_DIR . "product_info.php_$sts_productid.html";

? if (file_exists($sts_check_file)) {
? ? // Use it
? ? $sts_template_file = $sts_check_file;
? } 
}
}
///////

 

So for example, a template for product with ID=17 would look like: "product_info.php_17.html".

 

-Philip

 

Would it be possible to define a template product_info.php file based on the category the products are located in? So for example, a template for any product in category ID=36 would look like: "product_info.php_36.html". Something like:

 

///////Product-specific templates (contributed by Chris L.)
// Are we in the product_info.php script?
if ($scriptbasename == "product_info.php") {
 if (isset($HTTP_POST_VARS['categories_id'])) {
  $sts_categoriesid = $HTTP_GET_VARS['categories_id'];

  // Look for category-specific product template file like "product_info.php_36.html"
  $sts_check_file = STS_TEMPLATE_DIR . "product_info.php_$sts_categoriesid.html";

  if (file_exists($sts_check_file)) {
    // Use it
    $sts_template_file = $sts_check_file;
  } 
}
}
///////

 

Thanks in advance!

Link to comment
Share on other sites

Hello,

 

I was wondering if someone could please help me with this.. I have STS installed and was trying to install the article manager which is functioning correctly but I am having header issues... please help anyone?

 

I am getting this error:

 

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

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

 

Thanks,

Gina

Link to comment
Share on other sites

Hi Brian,

 

This is great stuff! I am working on the tail end of a huge site right now. I will post it at your Diamondsea website when its live.

 

My question is about Category Descriptions.

 

I played around with this today but couldnt quite get it to work. I am wondering if it is even possible to get a category description to show up using STS.

 

Any thoughts? Has anyone else had some success with adding Category Descriptions into an STS built website?

 

Thanks for listening.

 

Deborah Smith

Spinning Frog Internet Services

Link to comment
Share on other sites

Hi Brian,

 

This is great stuff! I am working on the tail end of a huge site right now. I will post it at your Diamondsea website when its live.

 

My question is about Category Descriptions.

 

I played around with this today but couldnt quite get it to work. I am wondering if it is even possible to get a category description to show up using STS.

 

Any thoughts? Has anyone else had some success with adding Category Descriptions into an STS built website?

 

Thanks for listening.

 

Deborah Smith

Spinning Frog Internet Services

This is the second post I have seen in the last day or so about category descriptions not working with sts. I have them installed together and I do not remember having any issues. What kind of problems are you having?

 

I have categories_description_MS2_1.5 and STS-2_01 working together.

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

Thanks!!!

 

It worked! So now all I do is work with the template?

I'll give it a try.

 

Webflyer

Correct. Any changes you make to the sts_template.html file should show up on your site.

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

Hi Richard,

 

Thanks for the reply.

I have a few other contribs in there as well and I think that I will have to do some fancy footwork to squeeze it in. Most notably, the options type and sorter contribs.

 

Sometimes contribs don't play well together so I am glad that you have been successfull at putting this one in STS. At least I know it works!

 

I am going to give it another try today. I think I will install the category descriptions on a clean osc + sts store and look at the category.php and index.php files. I figure those are the only two files I could be hashing.

 

I will post back and let you know how it worked out.

 

Thanks again! Wish me luck!

 

Deborah

Link to comment
Share on other sites

Hi all,

 

Thank for the STS contribution, it's wonderful :D

 

I have a pb with the dropdownmenu (installed with STS) and with a modification of my code.

I modified my application_top.php like it is mention in this thread

http://www.oscommerce.com/forums/index.php?showtopic=58891&st=20

 

The modification is:

$filename = explode("/", $PHP_SELF);
if (($filename[count($filename)-1] != "login.php") && (!tep_session_is_registered('customer_id'))) {
  $navigation->set_snapshot();
  tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
}

 

Now users must be logged to access at my shop. My pb is that the dropdowmenu don't function correctly with it because at each click on it, I must re log-in.

I hope yo understand me :D

 

Kymation, the writer of this code said to me:

The drop-down menu is not passing the osCsid properly, so the server does not recognize you as the same customer. This is a problem with the code for the drop-down. Unfortunately, I'm not familiar enough with that code to tell you how to fix it. If there is a support thread for that mod in the Forum, I would try there first.

 

So, anyone could help me to solve this pb, because I'm not a coder, I'm only a pro of copy/past :lol:

 

Thx

 

Fab

Edited by fablog
Link to comment
Share on other sites

Hi, I love this contrib.....

 

It worked for me right out of the box.....

Just a little cosmetic question.....

 

In the product_info template, How can I make the regular price to show up with a line thru if a special price is available??

 

Thanks in advance for any help....

 

Slipperyman

Link to comment
Share on other sites

Hi.

 

Am trying to incorperate a image to the bottom of my infoboxes and am not having any luck.

 

If I do it using the sts template it works exept that when the boxes arent there (eg if your not logged in) then the image appears anyway. is there a way arround this with HTML. Looking through the forum there is talk of wrapper's but to be honest I dont really understand the concept. seems like its just a table and therefore the image will appear even if sts does not display the box.

 

If I try using code in the individual box files then it only appears if sts is disabled.

 

I know I've posted about this before and this'll be the last time. Its just that the bottom images are really needed to complete the look of the store. So if anyone can put me straight on how to do this they may look forward to several hours of warm smuggness, based around the prinicipal that they are infact much smarter than me!

 

Many thanks for any help and thanks again for STS, which kicks ass.

 

Cheers

 

Ian

Link to comment
Share on other sites

Hi.

 

Am trying to incorperate a image to the bottom of my infoboxes and am not having any luck.

 

If I do it using the sts template it works exept that when the boxes arent there (eg if your not logged in) then the image appears anyway. is there a way arround this with HTML. Looking through the forum there is talk of wrapper's but to be honest I dont really understand the concept. seems like its just a table and therefore the image will appear even if sts does not display the box.

 

If I try using code in the individual box files then it only appears if sts is disabled.

 

I know I've posted about this before and this'll be the last time. Its just that the bottom images are really needed to complete the look of the store. So if anyone can put me straight on how to do this they may look forward to several hours of warm smuggness, based around the prinicipal that they are infact much smarter than me!

 

Many thanks for any help and thanks again for STS, which kicks ass.

 

Cheers

 

Ian

You need to make the change in the

 

.../catalog/classes/boxes.php file

 

for the change to work in STS. This is the code that lays out the boxes (the "box class") for OSC.

 

- Brian

Simple Template System (STS)

Layout your site with 1 (or more) HTML file!

Download STS: http://www.oscommerce.com/community/contributions,1524

Support: http://www.oscommerce.com/forums/index.php?showtopic=58541

Link to comment
Share on other sites

Hi Brian

 

Thanks for replying, I can see where your coming from but (and I bet you could see this coming :rolleyes: ) can you tell me what changes need to be made because having looked at it its a bit over my head!.

 

I dont want to take up loads of your time mate, so if its really involved then dont worry about it. but if you already have a solution that you can pass on - that would be fantastic.

 

Thanks for all the time you must have put in to STS.

 

Ian

Link to comment
Share on other sites

Hello:

 

I just installed STS on a brand new install of OSC. I checked to see if it was working and then I followed the instructions for the "easy" install.

 

I got this error:

 

Warning: mysql_connect(): Access denied for user: 'tlc_osc1@localhost' (Using password: YES) in /home/tlc/public_html/catalog/includes/functions/database.php on line 19

Unable to connect to database server!

 

HELP!

 

Ronda

Link to comment
Share on other sites

This is a common problem with STS. You have to include a line of code in one of your files IIRC. I don't recall the solution but there are several threads here on the subject. Do a search for "$content not displaying" or something like that.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

Hello:

 

I just installed STS on a brand new install of OSC. I checked to see if it was working and then I followed the instructions for the "easy" install.

 

I got this error:

 

Warning: mysql_connect(): Access denied for user: 'tlc_osc1@localhost' (Using password: YES) in /home/tlc/public_html/catalog/includes/functions/database.php on line 19

Unable to connect to database server!

 

HELP!

 

Ronda

did you copy the few lines into your existing configure.php file or just replace with the one supplied in the STS install pack?? If the latter, then this is why. You only need to copy/paste the final few lines (as highlighted by the comments bit).

Link to comment
Share on other sites

OK, I have been able to get STS and UltraImages to work together on the Product Info template, BUT I have no control over where it goes.

 

It shows up even if i don't have the chosen variable included on the page. Whatever I do the extra images table always appears at the top of the page pushing all other content to the bottom.

 

Here are the code changes I made in sts_product_info.php

 

$product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");

 

Was changed to include the extra images.

 

$product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, p.products_image_med, p.products_image_lrg, p.products_image_sm_1, p.products_image_xl_1, p.products_image_sm_2, p.products_image_xl_2, p.products_image_sm_3, p.products_image_xl_3, p.products_image_sm_4, p.products_image_xl_4, p.products_image_sm_5, p.products_image_xl_5, p.products_image_sm_6, p.products_image_xl_6, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");

 

Then using the line in product_info.php I created a new variable in sts_product_info.php called $addimages.

 

The code in product_info.php looks like...

 if (ULTIMATE_ADDITIONAL_IMAGES == 'enable') { include(DIR_WS_MODULES . 'additional_images.php');
}

 

So I created this in sts_product_info.php...

if (ULTIMATE_ADDITIONAL_IMAGES == 'enable') {
$template['addimages'] = include(DIR_WS_MODULES . 'additional_images.php');
}

 

As mentioned, the images are showing up, but I have no control over where or when then are displayed...they are always there, and always in the top left corner of the page.

 

Here is a screenshot...

http://arbv44.dsl.pipex.com/osc_sts_addimages.jpg

 

I'm no php expert so I know this is probably a error in my code.

Any ideas?

Link to comment
Share on other sites

Solved it...

 

For anyone wishing to add the Ultra Images to STS then you need to...

 

Open sts_product_info.php and change

 

$product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");

 

to

 

$product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, p.products_image_med, p.products_image_lrg, p.products_image_sm_1, p.products_image_xl_1, p.products_image_sm_2, p.products_image_xl_2, p.products_image_sm_3, p.products_image_xl_3, p.products_image_sm_4, p.products_image_xl_4, p.products_image_sm_5, p.products_image_xl_5, p.products_image_sm_6, p.products_image_xl_6, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");

 

then open up sts_user_code and add

 

    $sts_block_name = 'addimages';
   require(STS_START_CAPTURE);
require(DIR_WS_MODULES . 'additional_images.php');
   require(STS_STOP_CAPTURE);
   $template['addimages'] = $sts_block['addimages'];

 

then just place $addimages anywhere in your product_info.php.html template to display the images.

 

See screenshot -> http://www.arbv44.dsl.pipex.com/osc_sts_ultra_fixed.jpg

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