Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] STS v4


Guest

Recommended Posts

Hey Bill,

 

I'm working on trying to figure this out and I'm going through the "Create a Content Template for Any Page" section in the STS User Manual and I'm a bit confused.

 

Please see my questions/comments in red:

 

3.11 Create content templates for any page

Since v2.1.1 of module sts_default.php (delivered with STS v4.5) you can create content templates for whatever page you want, without creating a new module. This is particularly useful when creating new pages.

 

The catalog script that is going to use a content template must place the template name in the variable $sts->script->content_template_file, for example:

STS_TEMPLATE_DIR . "content/mypage.php.html";

How does the catalog script put the template name into the variable?

 

A variable for a default content template is ready in the sts class:

$sts->default_content_template and contains content/sts_template.html

I did not have this file, so I renamed the content/product_info.php.html file to sts_template.php.html and uploaded it to my content folder. Is this correct to at least see if there is a difference in the content being displayed on the category pages?

 

So you can create logic in your script to check if a specific content template exists, and use the default one if not.

 

In your script you now have to create an array with placeholder names and values, placeholders that you will be used on your content template. The array is the format:

$template_content ['placeholdername'] = 'placeholdervalue';

On your content template you can now use {$placeholdername} (the leading and trailing chars are fixed). This is important to not change the name of the array!

If you use the default template for several pages, you must be sure that all pages create the same placeholders, even empty, so you won't see placeholder names in your browser.

Not sure I understand this section yet - but I was thinking the placeholders for the content/product_info.php.html would already have been created - correct?

 

I also went into the admin/modules/sts and added index.php to the "files for content template" section and turned "use template for product info page" to true (in case it made any difference).

 

I am not seeing any change in the content on my category pages. What am I missing?

 

 

Hi Bill,

 

I'm finally back on this project again and I'm just running into a brick wall. I had thought you hit the nail on the head, and then learned I'm not quite there yet.

 

So - starting with "what I need" - on a category page that has products in the category I need to have a table that shows:

 

Master Products Image | Master Products Name

Master Products Description

Slave Model # | Slave Name | Slave Description | Slave Price | Qty Box | Add To Cart

Slave Model # | Slave Name | Slave Description | Slave Price | Qty Box | Add To Cart (continue for each slave product)

 

Then repeat the entire thing for the next Master Product listed for that category.

~Tracy
 

Link to comment
Share on other sites

Hmmm....

 

Thinking out loud here...

 

Being I am trying to get the product info into the category pages - even when I have gone to using the placeholders from the product_info.php.html content template and adding the product_info.php to files for index and default templates - the most I can seem to accomplish is getting the $ symbol wherever I have tried to place an item from the placeholder.

 

Reviewing the sts_inc/product_info.php file has caused a possible light bulb to go on. Is it because the placeholders are trying to be created by finding the product_id via the $HTTP_GET_VARS['products_id'] type of method, and being I am on a category page I need to find the $HTTP_GET_VARS['categories_id'] and then pull the products_id from the products_to_categories table first - basing the rest of the placeholders on the results of that?

 

Ok - off to continue plugging away at this - will rename sts_inc/product_info.php for the category pages and try my thought and see what happens :)

 

 

Hey Bill,

 

I'm working on trying to figure this out and I'm going through the "Create a Content Template for Any Page" section in the STS User Manual and I'm a bit confused.

~Tracy
 

Link to comment
Share on other sites

So - Looking at the fact you have a way to customize the product_info.php content section with a template - I was wondering if there is a way I can customize the product_listing.php with a template? Or is there a way to create tags for the individual items (Master Products Image, Name & Description and the Slave Model #, Name, Description, Price, Add to Cart) that I can put onto the Category Templates?

 

Thanks again!

Tracy,

Yes, you can create an infobox template for the product_listing.php page.

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

Hmmm....

 

Thinking out loud here...

 

Being I am trying to get the product info into the category pages - even when I have gone to using the placeholders from the product_info.php.html content template and adding the product_info.php to files for index and default templates - the most I can seem to accomplish is getting the $ symbol wherever I have tried to place an item from the placeholder.

 

Reviewing the sts_inc/product_info.php file has caused a possible light bulb to go on. Is it because the placeholders are trying to be created by finding the product_id via the $HTTP_GET_VARS['products_id'] type of method, and being I am on a category page I need to find the $HTTP_GET_VARS['categories_id'] and then pull the products_id from the products_to_categories table first - basing the rest of the placeholders on the results of that?

 

Ok - off to continue plugging away at this - will rename sts_inc/product_info.php for the category pages and try my thought and see what happens :)

Tracy,

 

You would need to query the products table and then recreate the STS tags in the sts_user_code.php file so that you can use them in non-product_info templates.

 

See this recent post and let me know how it works for you:

 

http://www.oscommerce.com/forums/index.php?sho...p;#entry1260438

 

Hope this helped you out,

Bill Kellum

 

Sounds Good Productions

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

Link to comment
Share on other sites

Ok - We are getting somewhere!!

 

I had to re-name the sts_inc/product_info.php file and change it to pull products_id where p2c.categories_id = '" . $HTTP_GET_VARS['categories_id'] . "'

 

I then had to remove the product_info.php file and replace it with the new category_info.php file in the admin side under Default and Index.

 

Then I had to open includes/modules/master_products.php and resave it as master_products2.php and change it to also pull according to the categories_id and then change the include in category_info.php to the master_products2.php file (of course adding it to the includes/filenames.php file as well).

 

So - I now have the information pulling on the category page for the Master Products Image, Name and Description.

 

NOW - I need to know how to loop that so it pulls the info for EACH Master product in that category. Which file would be best to do this in? Or is there an easier way than what I am currently doing - LOL

 

Once I get it repeating that information for each product, then I get to figure out how to pull in the Slave Products information and get it repeating for each slave product :blush:

 

 

Hmmm....

 

Thinking out loud here...

 

Being I am trying to get the product info into the category pages - even when I have gone to using the placeholders from the product_info.php.html content template and adding the product_info.php to files for index and default templates - the most I can seem to accomplish is getting the $ symbol wherever I have tried to place an item from the placeholder.

 

Reviewing the sts_inc/product_info.php file has caused a possible light bulb to go on. Is it because the placeholders are trying to be created by finding the product_id via the $HTTP_GET_VARS['products_id'] type of method, and being I am on a category page I need to find the $HTTP_GET_VARS['categories_id'] and then pull the products_id from the products_to_categories table first - basing the rest of the placeholders on the results of that?

 

Ok - off to continue plugging away at this - will rename sts_inc/product_info.php for the category pages and try my thought and see what happens :)

~Tracy
 

Link to comment
Share on other sites

Ugh - this is turning out to be a bugger of a project. I'm thinking that it would be easiest if I could just modify the includes/modules/product_listing.php file to show what I need, but I'm not having much luck with that either. Is there a way to create a template for how the product_listing.php box is displayed?

 

Ok - We are getting somewhere!!

 

NOW - I need to know how to loop that so it pulls the info for EACH Master product in that category. Which file would be best to do this in? Or is there an easier way than what I am currently doing - LOL

 

Once I get it repeating that information for each product, then I get to figure out how to pull in the Slave Products information and get it repeating for each slave product :blush:

~Tracy
 

Link to comment
Share on other sites

Quick question -

 

In an index template - if I want to only show a table row if there are subcategories for the current category, what "if" statement should I use?

 

I've tried the majority of the one's I can find in index.php and they all seem to think there are no subcategories, which tells me I'm obviously not giving it the correct if statement. But for the life of me, I can't seem to figure out what the correct if statement is - :blush:

 

Try to take a break from the stuff that's hurting your head - and find more stuff you can't seem to figure out - LOL ;)

~Tracy
 

Link to comment
Share on other sites

Is there a way to modify the spacing between the links in the information infobox???? I am using a template for it but I don't think that matters. I tried looking through the PHP code but I am a rookie and couldn't figure it out.

Link to comment
Share on other sites

Hi

 

I have Oscommerce rc2

Sts latestest version

Header tags SEO lastest

 

 

I am trying to install infobox templates version 4.2 contribution add on to sts, so I can use graphics for the borders of my infoboxes. After installing I get this error.

 

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

Fatal error: Call to a member function add_current_page() on a non-object in /home/wi/public_html/store/includes/application_top.php on line 312

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

 

I know this was made to work good on sts 4.2, but I thought I'd give it a try on sts 4.58 and since it is made for sts I figured it would work.

 

The only thing that I may done wrong that I can think of is on number 5 on installation instructions " If you have Header Tags Contoller installed, be sure to add headerdertags.php to the "Files to include section" I have Header Tags Seo so not sure if I have to do the same thing to that to and I'm not sure how to do that?

 

Please help

 

Thanks

Joey

I have installed:

Oscommerce version 2.2rc2a, STS version 4.5.8, Header Tags SEO version 3.1.5, SEO Assistant version 2.1

 

Thanks

Joey

Link to comment
Share on other sites

Also, I am trying to create a content template for one of the new pages I added with the "STS 4 Add New Page Files" contribution. Can someone explain how to do this in layman's terms. I looked through the STS manual and didn't really see anything that helped. The new page is safety.php.html in the "full folder" under sts_template, I tried just creating a file called safety.php.html and put it in the ...full/content/ folder but it still shows the default safety.php file.

 

Thanks in advance!!!!

Link to comment
Share on other sites

Bill I hope you are out there!!!

 

3rd question.... im such a php moron!!!

 

How do I get the "shopping cart in header" turned into a link? Here is the code

 

$sts->start_capture();
$productno = $cart->count_contents();
$totalprice = $currencies->format($cart->show_total());

if ($productno > 1) {
echo ENTRY_HCART_CONTAINS;
echo " ";
echo $productno;
echo " ";
echo ENTRY_HCART_ITEMS;
echo " "; echo " ";

} elseif ($productno == 0) {
echo ENTRY_HCART_EMPTY;
} else {
echo ENTRY_HCART_CONTAINS;
echo " ";
echo $productno;
echo " ";
echo ENTRY_HCART_ITEM;
echo " "; echo " ";
}
$sts->stop_capture ('headcart');

 

I tried several different things and just couldn't figure it out.

Link to comment
Share on other sites

I'm having problems with the infobox template, whereby i edit the file, re-upload it and not see any changes at all. When i view the source it still has the same callouts ie. "infoboxheading" etc, in the new code i'v changed it to pure CSS but i can't see why it isn't working :(

Link to comment
Share on other sites

Hi!

Does someone know how to put this code into product_info.php.html so it works??

 

<?php 
 $prod_quantity = tep_get_products_stock($products_id); 
 switch ($prod_quantity) { 
  case 0: 
  print '<img src="images/stock_soldout.gif" border="0">'; 
  break; 
  case 1: 
  print '<img src="images/stock_limitedstock.gif" border="0">'; 
  break; 
  case 2: 
  print '<img src="images/stock_limitedstock.gif" border="0">'; 
  break; 
  case 3: 
  print '<img src="images/stock_instock.gif" border="0">'; 
  break; 
  case 4: 
  print '<img src="images/stock_instock.gif" border="0">'; 
  break; 
  default: 
  print '<img src="images/stock_instock.gif" border="0">'; 
 } 
 ?>

 

I have tryed to implement the code into includes/modules/sts_inc/product_info.php

 

But i dont know how i should make the code

 

 

Need help

 

Regards Tony

Link to comment
Share on other sites

You do this in the language files ;)

Go to catalog/includes/languages/english.php (or whatever language you need to do this in) and find the

 

$sts->start_capture();
$productno = $cart->count_contents();
$totalprice = $currencies->format($cart->show_total());

if ($productno > 1) {
echo ENTRY_HCART_CONTAINS;
echo " ";
echo $productno;
echo " ";
echo ENTRY_HCART_ITEMS;
echo " "; echo " ";

} elseif ($productno == 0) {
echo ENTRY_HCART_EMPTY;
} else {
echo ENTRY_HCART_CONTAINS;
echo " ";
echo $productno;
echo " ";
echo ENTRY_HCART_ITEM;
echo " "; echo " ";
}
$sts->stop_capture ('headcart');

 

I tried several different things and just couldn't figure it out.

~Tracy
 

Link to comment
Share on other sites

Did you turn on the Use templates for Infoboxes part in the Admin?

 

I'm having problems with the infobox template, whereby i edit the file, re-upload it and not see any changes at all. When i view the source it still has the same callouts ie. "infoboxheading" etc, in the new code i'v changed it to pure CSS but i can't see why it isn't working :(

~Tracy
 

Link to comment
Share on other sites

Hi!

 

I would like to show manufacturer on the product info page and not only in the productlisting. I have oscommerce with sts but there are not any placeholder for manufacturer. How do you create a new placeholder for that?

 

Thanks in advance!

Link to comment
Share on other sites

Hi!

Does someone know how to put this code into product_info.php.html so it works??

 

<?php 
 $prod_quantity = tep_get_products_stock($products_id); 
 switch ($prod_quantity) { 
  case 0: 
  print '<img src="images/stock_soldout.gif" border="0">'; 
  break; 
  case 1: 
  print '<img src="images/stock_limitedstock.gif" border="0">'; 
  break; 
  case 2: 
  print '<img src="images/stock_limitedstock.gif" border="0">'; 
  break; 
  case 3: 
  print '<img src="images/stock_instock.gif" border="0">'; 
  break; 
  case 4: 
  print '<img src="images/stock_instock.gif" border="0">'; 
  break; 
  default: 
  print '<img src="images/stock_instock.gif" border="0">'; 
 } 
 ?>

 

I have tryed to implement the code into includes/modules/sts_inc/product_info.php

 

But i dont know how i should make the code

 

 

Need help

 

Regards Tony

Nobody know??

Link to comment
Share on other sites

Hello all,

 

I have some javascript code that displays a series of scrolling images that I would like to appear on my home page (index.php) only. When I set it up using my default sts template I put it in the same area that $content is at. Everything works as expected but when I click on anything else (products, links, etc.) the scrolling images "follow" me to whatever page I go to. How do I get this to stop?

 

I know that the reason this is happening is because every page is using the default sts template... but I'm stuck at how to get around this. I have minimal HTML experience and very minimal PHP knowledge. This is also my first shot at using osC. I must say however, that this is probably one of the best learning experiences I have had concerning coding and the likes. I really am starting to enjoy the problem solving. :)

 

Any help or guidance is appreciated. Thanks.

Link to comment
Share on other sites

Hello all,

 

I have some javascript code that displays a series of scrolling images that I would like to appear on my home page (index.php) only. When I set it up using my default sts template I put it in the same area that $content is at. Everything works as expected but when I click on anything else (products, links, etc.) the scrolling images "follow" me to whatever page I go to. How do I get this to stop?

 

I know that the reason this is happening is because every page is using the default sts template... but I'm stuck at how to get around this. I have minimal HTML experience and very minimal PHP knowledge. This is also my first shot at using osC. I must say however, that this is probably one of the best learning experiences I have had concerning coding and the likes. I really am starting to enjoy the problem solving. :)

 

Any help or guidance is appreciated. Thanks.

 

 

Scratch that. I didn't realize that my index.php_0.html file wasn't being "recognized" by STS. For anyone who may be interested... I simply had to go into admin and uninstall the index page part of STS and then click install again to "reset" it. Then I added my index.php_0.html file to the list of files used. That's it, I think it just needed to be "reset".

 

Thanks again.

Link to comment
Share on other sites

Scratch that. I didn't realize that my index.php_0.html file wasn't being "recognized" by STS. For anyone who may be interested... I simply had to go into admin and uninstall the index page part of STS and then click install again to "reset" it. Then I added my index.php_0.html file to the list of files used. That's it, I think it just needed to be "reset".

 

Thanks again.

No, no, no, no....

You should not add the template to the files to include option in the admin. STS will automatically use the index.php_0.html as your home page as long as you have the STS Module Index enabled in the admin

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 have Oscommerce rc2

Sts latestest version

Header tags SEO lastest

 

 

I am trying to install infobox templates version 4.2 contribution add on to sts, so I can use graphics for the borders of my infoboxes. After installing I get this error.

 

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

Fatal error: Call to a member function add_current_page() on a non-object in /home/wi/public_html/store/includes/application_top.php on line 312

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

 

I know this was made to work good on sts 4.2, but I thought I'd give it a try on sts 4.58 and since it is made for sts I figured it would work.

 

The only thing that I may done wrong that I can think of is on number 5 on installation instructions " If you have Header Tags Contoller installed, be sure to add headerdertags.php to the "Files to include section" I have Header Tags Seo so not sure if I have to do the same thing to that to and I'm not sure how to do that?

 

Please help

 

Thanks

Joey

 

Joey,

You do not need to install an infobox template contribution into STSv4.5.8 since it ALREADY has an infobox template system ALREADY built in. All you have to do is enable it in the STS Default module in the admin. If you tried to install the older infobox template addon into v4.5.8, then there is not telling what kind of errors you are going to get.

 

I strongly suggest that you either uninstall the infobox addon or reinstall STSv4.5.8 completely.

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

Bill I hope you are out there!!!

 

3rd question.... im such a php moron!!!

 

How do I get the "shopping cart in header" turned into a link? Here is the code

 

$sts->start_capture();
$productno = $cart->count_contents();
$totalprice = $currencies->format($cart->show_total());

if ($productno > 1) {
echo ENTRY_HCART_CONTAINS;
echo " ";
echo $productno;
echo " ";
echo ENTRY_HCART_ITEMS;
echo " "; echo " ";

} elseif ($productno == 0) {
echo ENTRY_HCART_EMPTY;
} else {
echo ENTRY_HCART_CONTAINS;
echo " ";
echo $productno;
echo " ";
echo ENTRY_HCART_ITEM;
echo " "; echo " ";
}
$sts->stop_capture ('headcart');

 

I tried several different things and just couldn't figure it out.

 

Just place the above code in your sts_user_code.php file and then use $headcart in your template.

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

Hey everyone,

 

I'm not ignoring the STS Support thread on purpose.

 

I am only able to check in at short variables as I am out of the office and traveling. My current location has been having WI-FI issues so I have not been able to check in and may not be able to until a few days from now.

 

Please keep checking in to see if your support request has been answered. Hopefully other STS users (like Tracy) will be able to help out with the support.

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

Bill, I had 2 questions earlier that I really could use a hand on.

 

1. Is there a way to modify the spacing between the links in the information infobox???? I am using a template for it but I don't think that matters. I tried looking through the PHP code but I am a rookie and couldn't figure it out.

 

2. I am trying to create a content template for one of the new pages I added with the "STS 4 Add New Page Files" contribution. Can someone explain how to do this in layman's terms. I looked through the STS manual and didn't really see anything that helped. The new page is safety.php.html in the "full folder" under sts_template, I tried just creating a file called safety.php.html and put it in the ...full/content/ folder but it still shows the default safety.php file.

 

 

Thanks for everything you do

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