Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[contribution] Simple Template System (sts)


DiamondSea

Recommended Posts

Multiple templates using STS

 

Hey there!

 

I've been banging my head against this for a few months now and hoping someone can give me a definitive answer.

 

Is there a way to STS pick up a category template across entire categories and all products in that category? I'd be interested to hear from anyone that actually has that working.

 

I've tried Steve Oliveira fix

 

OPEN
/includes/sts_display_output.php


FIND: (around line 108)

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

ADD AFTER

// Check to see if there are universal templates for parent categories
else {
// get all subcategories and parent category
$sts_all_cats = explode("_", $sts_cpath);
$num_all_cats = count($sts_all_cats);

// Load nearest parent category to the child
for ($i=1; $i<$num_all_cats; $i++) {
array_pop($sts_all_cats);
$sts_cpath = implode("_", $sts_all_cats);
$sts_check_file = STS_TEMPLATE_DIR . "index.php_$sts_cpath.html";
if (file_exists($sts_check_file)) {
// Use it
$sts_template_file = $sts_check_file;
$i=$num_all_cats;
}
}
}

 

No go. I've tried Greg K's fix

 

in sts_display_output.php:

Replace:

// Look for category-specific template file like "index.php_1_17.html"
$sts_check_file = STS_TEMPLATE_DIR . "index.php_$sts_cpath.html";
//echo "$sts_check_file<BR>";
if (file_exists($sts_check_file)) {
// Use it
$sts_template_file = $sts_check_file;
}

With:

while ($sts_cpath != "")
{
// Look for category-subcategory-specific template file like "index.php_1_17.html"
$sts_check_file = STS_TEMPLATE_DIR . "index.php_$sts_cpath.html";
//echo "$sts_check_file<BR>";
if (file_exists($sts_check_file)) {
// Use it
$sts_template_file = $sts_check_file;
break;
} 
$sts_cpath = substr($sts_cpath, 0, (strrpos($sts_cpath, "_")));
}

 

No go. Took a look at

http://www.oscommerce.com/forums/index.php?sho...16entry378616

 

But it's crazier than just making individual templates for every product. (No offense to Jaxx)

 

So, to sum up, I'd like to find a way for STS to be smart enough to know that if

 

/catalog/product_info.php?cPath=21&products_id=28

 

doesn't have a specific template created for it that it should fall back on 21.

 

Has anyone gotten such a thing to function and can explain or point me at the solution?

 

Thanks much,

Iggy

Everything's funny but nothing's a joke...

Link to comment
Share on other sites

hi,

 

i have just used STS for the first time.

everything shows up apart from the "$content" the centre of the site is just blank?

i have even tested it with the basic sts template from the zip file but again there is no content.

 

Any boby have a clue what im doing wrong?

 

 

Cheers

Link to comment
Share on other sites

if anyone can help me it would be great help to alot of poeple i think, basically, i have mopics 6 installed with STS and a few other mods, but the problem i am facing is this, when im using product_info.php.html template i use $thumbnail, $image1, $image2 and so on to display the pictures, i have the code through the sts_product_info.php to define these, BUT if i dont have a picture in the spot it will display the $thumnail or whatever i use to define the thumbnail, now i have tried to use this

 

<?php

if (tep_not_null($product_info['products_image'])) {

$template;}

?>

 

and this

 

<?php

if (tep_not_null($product_info['products_image'])) {

'$template';}

?>

 

but i get nothing appear, i know it is because the database query is not in the template, but i though STS included that when it is built, am i quickly tried inserting the query that is in the sts_product_info.php and pasted it before the html tag in the template like this

 

<?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, p.products_subimage1, p.products_subimage2, p.dob, p.sire, p.dam, p.products_subimage3, p.products_subimage4, p.products_subimage5, p.products_subimage6, 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 . "'");

$product_info = tep_db_fetch_array($product_info_query);

?>

<html>

 

but i dont know if that is even right. If anyone can help it would be great..

 

do i perhaps have to include application top and those things, and build the template simular to an actual php file, with a .html extension ??

Link to comment
Share on other sites

i worked out a way to do the above problem, if anyone wants to know i replaced

 

if (tep_not_null($product_info['products_image'])) {

$template['image'] = tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_model']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5" style="border: 1px solid #FFFFFF"') . '<br><center>' . tep_image(DIR_WS_IMAGES . 'image_enlarge.gif', TEXT_CLICK_TO_ENLARGE) . '</center>';

}

 

in sts_product_info.php with

 

if (tep_not_null($product_info['products_image'])) {

$template['image'] = tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_model']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5" style="border: 1px solid #FFFFFF"') . '<br><center>' . tep_image(DIR_WS_IMAGES . 'image_enlarge.gif', TEXT_CLICK_TO_ENLARGE) . '</center>';

} else {

$template['image'] = '';

}

 

u can also use the tag to display a image if u have no picture like

 

if (tep_not_null($product_info['products_image'])) {

$template['image'] = tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_model']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5" style="border: 1px solid #FFFFFF"') . '<br><center>' . tep_image(DIR_WS_IMAGES . 'image_enlarge.gif', TEXT_CLICK_TO_ENLARGE) . '</center>';

} else {

$template['image'] = tep_image(DIR_WS_IMAGES . 'image_blank.jpg' . '<br><center>' ;

}

 

thanks guys

Link to comment
Share on other sites

Hi, I asked before, but got no response. Im hoping someone knows how to add the poll booth to STS? Or is there a Poll contribution that works with STS ?

 

Steve

 

 

yes u can, u will need to make a few additions to the sts files though, very simple mods, u will need to do the following changes

 

open sts_display_output.php

 

add

 

$template['polls'] = strip_unwanted_tags($sts_block['polls'], 'polls');

 

on about line 234 after

 

$template['specialfriendbox'] = strip_unwanted_tags($sts_block['specialfriendbox'], 'specialfriendbox');

 

and also add

 

echo $sts_block['polls'];

 

on line 314 - u will see the other boxes there

 

u will need to insert $polls in the sts_template.html file where ever u want it. If this does not work, check to see if the polls box in includes/boxes is polls.php

 

if it is not change where ever polls is to whatever the file is called. easy yes

Link to comment
Share on other sites

I have a small problem with breadcrumbs using STS. I've installed numerous contribs and all are working fine. Here what is the prob:

 

Breadcrumbs are working. They just show the product's name twice like this:

 

Top >> Catalog >> Category >> Product Name >> Product Name

 

Anyone knows something about that?

 

Contirbs I have installed are, article manager, autothumbnail creator, enhanced categories.

There's a diference between living & BEING ALIVE!

Link to comment
Share on other sites

Im trying to get the product_info.php.html to work. Im using the file that was added with this contr. But when im press the add to cart button nothing happends.

 

If i not use the "product_info.php.html" the contr. is working perfect. But when im using "product_info.php.html" it will not add any products to the shopping cart.. any ideas?

Link to comment
Share on other sites

I found the reason to why i cant add a product to the cart. (see above) the reason is that im using the master products contr.

 

In the contr " 19 May 2005 - STS and Master Products WITH product_info.php.html template" you can read that you should change a line in sts_product_info.php

 

From:

$template['startform'] = tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product'));

 

To:

$template['startform'] = tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_slave'));

 

 

I gues the problem is "action=add_slave".

 

Is there any one out there who had get the Master Product Contr. to work with STS html template of Product info? I realy want this to work!!

 

Im trying to get the product_info.php.html to work. Im using the file that was added with this contr. But when im press the add to cart button nothing happends.

 

If i not use the "product_info.php.html" the contr. is working perfect. But when im using "product_info.php.html" it will not add any products to the shopping cart.. any ideas?

Link to comment
Share on other sites

Im trying to get the product_info.php.html to work. Im using the file that was added with this contr. But when im press the add to cart button nothing happends.

 

If i not use the "product_info.php.html" the contr. is working perfect. But when im using "product_info.php.html" it will not add any products to the shopping cart.. any ideas?

Well for the Add To Cart button to work you need to place a form. By dafault, $addtocartbutton just adds an imput image without a form so to have a form you should do this at your product_info.php.html:

 

$startform <- Starts the form

$optionnames $optionchoices <- Include product attributes if any at the form so they will be added to the cart

$addtocartbutton <- The actual button

$endform <- Form ends with this tag

 

DiamondSea should have had this info at his readme.txt as a supported tag. He doesn't so you get confused on why this damn cart button isn't working :)

Edited by Z3RatuL

There's a diference between living & BEING ALIVE!

Link to comment
Share on other sites

Thank you Z3RatuL for your respond!

 

The thing is that im tryig to get STS ?nd the Master Product contr. working togther. I hve found the problem, but not the solution. (see above)

 

Any idea?

Link to comment
Share on other sites

Thank you Z3RatuL for your respond!

 

The thing is that im tryig to get STS ?nd the Master Product contr. working togther. I hve found the problem, but not the solution. (see above)

 

Any idea?

 

Well, did you do that (change from add_product to add_slave at sts_product_info.php)? and after that did you do what I told ya with the form tags?

There's a diference between living & BEING ALIVE!

Link to comment
Share on other sites

:'(

 

I've read this whole thread and haven't found an answer to my problem. Maybe I read right past it though, since I have no idea what half of you are talking about! Color me dumb.

 

MY issue is that after installing STS (which I am absolutely thankful for), at my website (trial run found here- Cupcake. )- I can't bring up the large version of the product images. When I added a few fake items to my catalog to see how the layout looks, if I click on the "click to enlarge" link in the product table it loads another window but it just has the heading info for the shop.

 

Please, please help.

 

The only other issue I have (probably not STS related) is that when you go to the site www.cupcakeshop.com, I'm going to have a "shop" link off of that to take the visitor to bakery.cupcakeshop.com. The links in the STS/oscommerce shopping system seem to add "www" to that, so that after clicking on something, the address becomes www.bakery.cupcakeshop.com. Not a huge deal, but kind of not what I want. Is there a quick fix for this?

Link to comment
Share on other sites

yeah.. I have made the changes in sts_product_info and did cut in:

 

$startform <- Starts the form

$optionnames $optionchoices <- Include product attributes if any at the form so they will be added to the cart

$addtocartbutton <- The actual button

$endform <- Form ends with this tag

 

And i cant add anything to the cart. But only when i have "add_slave" in product_info. If i have add_product I can add the master product but not the slaves.

Link to comment
Share on other sites

:'(

 

I've read this whole thread and haven't found an answer to my problem. Maybe I read right past it though, since I have no idea what half of you are talking about! Color me dumb.

 

MY issue is that after installing STS (which I am absolutely thankful for), at my website (trial run found here- Cupcake. )- I can't bring up the large version of the product images. When I added a few fake items to my catalog to see how the layout looks, if I click on the "click to enlarge" link in the product table it loads another window but it just has the heading info for the shop.

 

Please, please help.

 

The only other issue I have (probably not STS related) is that when you go to the site www.cupcakeshop.com, I'm going to have a "shop" link off of that to take the visitor to bakery.cupcakeshop.com. The links in the STS/oscommerce shopping system seem to add "www" to that, so that after clicking on something, the address becomes www.bakery.cupcakeshop.com. Not a huge deal, but kind of not what I want. Is there a quick fix for this?

 

And now it doesn't show the smaller image with the "Click to Enlarge" option below it at all. What did I do? This happened when I commented out the Review button at the bottom of product_info.php

Link to comment
Share on other sites

I fixed the second issue I was having, but still having the first issue, where the "Click to enlarge" image link doesn't work. Please point me in the right direction. I must be missing something.

Link to comment
Share on other sites

sorry for the double post... now i know where to post for sts support. i'm kind of confused,and i cannot find a solution for my problem: i noticed recently that all my downloadable products bigger than 12mb were NOT working anymore. the link is correctly highlighted, the files are all correctly placed, but the customer gets a '500 internal server error' .. every file smaller than 12mb works perfectly (the files are all in the /download/ folder ) ...

 

then, i realized that what was causing the problem was STS template, because i uninstalled it and everything started working fine again...all biigger files could be downloaded again..

 

has anyone experienced this problem ? i want to continue using sts template, i really like it . thanks everyone !!

Link to comment
Share on other sites

hi..

 

i am currently working on a sts_template one problem i am facing.

 

i want to make the template instead of sts_template.html into sts_template.php ok.. i fixed this problem by changing in Configure.php

 

BUT..

 

the problem is the PHP Commands do not work correctly when i change the configure.php to redirect the STS TEMPLATE to be sts_template.php

 

how can i fix this problem

 

i would much appreciate your help

 

Thank You

Link to comment
Share on other sites

Hi,

 

I've just downloaded STS and OSC, i have read some FAQ's etc, but they all start with very complicated things.

 

But i just don't understand how to add products, catogaries etc and make them appear in my sts_template.htm. Do i have to add products to a database, a php file, or something else? Isn't there a walk-through or tutorial about how to start with adding products etc?

 

I'm sorry if this question allready has been asked, but i didn't feel like reading 118 pages :)

Edited by Vincenttr
Link to comment
Share on other sites

I am using STS templates and have setup some tables to contain my site but the shopping cart kicks out my tables as it is wider than the width of the cell can anyone give me some suggestions how I could alter the code in order to make the cart fit within the cell.

 

www.divebureau.com/catalog

 

Try adding something to the cart and then proceeding as though to checkout (you have to click the little arrow in the cart box for now. you will see that it nudges the whole site to the right where it cant fit in the cell.

 

can I change something in the coding/layout to make this work. I dont reall want to have to redesign the site just to accomodate the cart.

Link to comment
Share on other sites

I am using the sts_template system with an "index.php" page as the initial display (when typing in the site directly from the main page)

 

I have all the categories listed down the left side, and some of these have sub categories.

 

I noticed that the only way to get the subcategories to display is if there are NO PRODUCTS OUTSIDE the subcategory boxes (inside the main category box). If there is even 1 product, it won't display the subcategories. By the way, when they do display, they appear in the main body area, where I have a $content command.

 

Worse, whenever you click on ANY of the subcategories, instead of going to that category, it goes straight back to the Homepage (url displays correct category_subcategory).

 

I really need to fix this since there are many multiple sub categories and I really would like to figure out why this behaves this way. Site is www.LotsofMags.com.

 

PS Also notice site is very slow, is there something I can do on my end to fix.

 

Thanks!

Rep

Link to comment
Share on other sites

Hello everyone, I am just curious as to the relationship the STS Mod has with any WYSIWYG editors such as DreamWeaver and such. Is it possible to graphically design your osCommerce STS templates in this? I have tried but the intergration is a bit sloppy and I can only make very choppy tables. Basically it's lacking the creativity I need. More so, I'm lacking the knowledge to impliment the creativity I need to. Any and all help would be greatly appreciated.

 

I thank you for your time and help in advance,

Salvage.

Link to comment
Share on other sites

Hello everyone, I am just curious as to the relationship the STS Mod has with any WYSIWYG editors such as DreamWeaver and such.  Is it possible to graphically design your osCommerce STS templates in this?  I have tried but the intergration is a bit sloppy and I can only make very choppy tables.  Basically it's lacking the creativity I need.  More so, I'm lacking the knowledge to impliment the creativity I need to.  Any and all help would be greatly appreciated. 

 

I thank you for your time and help in advance,

    Salvage.

 

Ofcourse you can... sts_template.html grabs images from the images folder. So if you design a template with all it's images taken from there (images folder) then you won't have any problems.

 

Since you have sts_template.html in your includes folder if you open the file directly you won't see the images but they will work if you seeit live from your site :)

There's a diference between living & BEING ALIVE!

Link to comment
Share on other sites

Hi,

 

I've just downloaded STS and OSC, i have read some FAQ's etc, but they all start with very complicated things.

 

But i just don't understand how to add products, catogaries etc and make them appear in my sts_template.htm. Do i have to add products to a database, a php file, or something else? Isn't there a walk-through or tutorial about how to start with adding products etc?

 

I'm sorry if this question allready has been asked, but i didn't feel like reading 118 pages  :)

 

You ever consider reading the manual? Diamond Sea explains everything you need to know about how to add your content in your template file.

There's a diference between living & BEING ALIVE!

Link to comment
Share on other sites

Thanks for the quick reply Z3RatuL, it was a big help. Would you, or anyone else, happen to know where I can go for some help on creating a template? New to the whole graphic design part of this so any and all help is appreciated and not over looked.

 

Once again, thank you in advance.

 

Salvage.

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