Becki Posted January 26, 2009 Share Posted January 26, 2009 This is fairly simple. All you need to do is create a STS tag for the new infobox. Here is what I like to use for a Newsletter Infobox: http://www.oscommerce.com/community/contributions,535 As I stated above, the only thing needed to make this work in STS is to create a new variable for the newly created newsletter infobox: $sts->start_capture(); require(DIR_WS_BOXES . 'newsletter.php'); $sts->stop_capture('newsletter', 'box'); Hi Bill, Thanks very much for the information in reply to my two posts :) I'm sure I have created a new variable but I will double check it is correct. Does the contribution you mention allow a visitor to sig up just by entering an email address or do they have to put in more information? Many thanks Quote Link to comment Share on other sites More sharing options...
uwearusa Posted January 26, 2009 Share Posted January 26, 2009 Chris, The stock osCommerce shop has some "hard coded" infobox images for the corners. An easy way to take care of this in order for the boxes to flow with your design is to upload some transparent gifs that are named the same as the stock images. Use the following to do this very easily: http://www.oscommerce.com/community/contributions,4764/ http://www.oscommerce.com/community/contributions,2034 Hope this helped, Ok, all is well, and I have it looking just the way I want it. Except when I click on a product information. When I do that, my template changes on the right side to include some boxes that I don't want. I getting confused on the templating...can anyone please help me. Thanks! Quote Link to comment Share on other sites More sharing options...
Becki Posted January 26, 2009 Share Posted January 26, 2009 This is fairly simple. All you need to do is create a STS tag for the new infobox. Here is what I like to use for a Newsletter Infobox: http://www.oscommerce.com/community/contributions,535 As I stated above, the only thing needed to make this work in STS is to create a new variable for the newly created newsletter infobox: $sts->start_capture(); require(DIR_WS_BOXES . 'newsletter.php'); $sts->stop_capture('newsletter', 'box'); Hi bill, I just checked and I do have $sts->start_capture(); require(DIR_WS_BOXES . 'visitoremail.php'); $sts->stop_capture('newsletter', 'box'); already in my sts_user_code. The box shows fine but after clicking the submit button all the box placeholder names display instead of the actual boxes, it just seems to effect the boxes - all other links etc using other palceholder names are still working. Maybe I should try the contribution you said you used - does it allow users to join the newsletter by just entering their email address? Thanks Quote Link to comment Share on other sites More sharing options...
uwearusa Posted January 26, 2009 Share Posted January 26, 2009 Ok, all is well, and I have it looking just the way I want it. Except when I click on a product information. When I do that, my template changes on the right side to include some boxes that I don't want. I getting confused on the templating...can anyone please help me. Thanks! Mr. Kellum, Any ideas on this? Thanks! Quote Link to comment Share on other sites More sharing options...
Becki Posted January 26, 2009 Share Posted January 26, 2009 Add the following code directly in your template where you want the name to appear: <?php if ( tep_session_is_registered('customer_first_name') && tep_session_is_registered('customer_id') ) { echo tep_output_string_protected($customer_first_name); } ?> Sorry to be a nuisance but this doesn't work when I try it, I wonder if someone else can try to see if it works or not? Thanks Quote Link to comment Share on other sites More sharing options...
bkellum Posted January 27, 2009 Share Posted January 27, 2009 Sorry to be a nuisance but this doesn't work when I try it, I wonder if someone else can try to see if it works or not? Thanks Becki, Try this: Add the following code in your includes/modules/sts_inc/general.php file: $sts->start_capture(); if ( tep_session_is_registered('customer_first_name') && tep_session_is_registered('customer_id') ) { echo tep_output_string_protected($customer_first_name); } $sts->stop_capture ('customername'); Now add the new STS tag $customername wherever you want it in your template. Quote 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 More sharing options...
bkellum Posted January 27, 2009 Share Posted January 27, 2009 Mr. Kellum, Any ideas on this? Thanks! Chris, Until you get to know how STS works, I suggest that you add a small tagline to each of your templates to help you find your way around. Something like, "This is my default template sts_template.html" and "This is my home page template index.php_0.html" and "This is my create_account.php.html template" and so on. Once you get familar with how STS works, you can remove the tag lines from the template. This is the reason why the sample tag lines were inserted in the first place. Quote 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 More sharing options...
El_Heso Posted January 27, 2009 Share Posted January 27, 2009 Hi Bill! Im trying to manage to inlude additional_image.php in product_info.php.html. from thiscontribution ( Ultra Pics 2.07.01 - incl. STS + CCGV + LightBox_1 ) I tryed to replicate the function of this beeacuse that was the only function that i found that reminded me of what im trying to do. $sts->start_capture(); if ((USE_CACHE == 'true') && empty($SID)) { echo tep_cache_also_purchased(3600); } else { include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS); } $sts->stop_capture ('alsopurchased'); // Get the result to the main array $template_pinfo['alsopurchased']= $sts->template['alsopurchased']; // Put it in the product info I thought that this would work beacuse that file also includes from modules as additional_image also do but i cant make this work... any idea how to get it to work so i only put $additionalimage in product_info under content? Regards Tony Quote Link to comment Share on other sites More sharing options...
jrthor2 Posted January 27, 2009 Share Posted January 27, 2009 I'm not sure if this is the right forum for this. I have a template where in the header, I want to display the number of products inthe shopping cart, and the total dollar amoun in their shopping cart. How would I do this in my template so that it looked like this: 5 Products | $45.00 Thanks!! Quote Link to comment Share on other sites More sharing options...
Guest Posted January 27, 2009 Share Posted January 27, 2009 I'm not sure if this is the right forum for this. I have a template where in the header, I want to display the number of products inthe shopping cart, and the total dollar amoun in their shopping cart. How would I do this in my template so that it looked like this: 5 Products | $45.00 Thanks!! Hello Jrthor, I set this up using the following. http://www.oscommerce.com/community/contributions,1079 Following the directions their to show the cart info in the header. I then modified mine to only show the number of items in the cart and the total price, by commenting out some of the unneeded stuff. if ($productno > 1) { //echo ENTRY_HCART_CONTAINS; //echo " "; echo $productno; echo " "; //echo ENTRY_HCART_ITEMS; echo " "; echo " "; echo ENTRY_HCART_PRICE; echo " "; echo $totalprice; } elseif ($productno == 0) { //echo ENTRY_HCART_EMPTY; echo $productno; } else { //echo ENTRY_HCART_CONTAINS; //echo " "; echo $productno; echo " "; //echo ENTRY_HCART_ITEM; echo " "; echo " "; //echo ENTRY_HCART_PRICE; echo " "; echo $totalprice; Hope that helps. -Jason Quote Link to comment Share on other sites More sharing options...
Becki Posted January 27, 2009 Share Posted January 27, 2009 $sts->start_capture(); if ( tep_session_is_registered('customer_first_name') && tep_session_is_registered('customer_id') ) { echo tep_output_string_protected($customer_first_name); } $sts->stop_capture ('customername'); Now add the new STS tag $customername wherever you want it in your template. Thanks Bill this worked! Does anyone know how I should go about changing the class of the text (I tried adding it to the STS tag but no joy)? And also is it possible to put a 'Hello' in front of the name? it needs to be incorporated into the $customername tag so that it doesn't display when people are not logged in? Thanks Again :) Quote Link to comment Share on other sites More sharing options...
johnnybebad Posted January 27, 2009 Share Posted January 27, 2009 Take a look at my solution here: Post #4183http://www.oscommerce.com/forums/index.php?sho...p;#entry1278943 Thats spot on, couldnt for the life of me find it anywhere. add the two bits of script to the relevant files and then copied the $headcart into the header and it worked perfectly Thanks for you help, do think searching this forum for stuff is hard work sometimes. Thanks again Johnny Quote Getting better with mods but no programmer am I. Link to comment Share on other sites More sharing options...
johnnybebad Posted January 27, 2009 Share Posted January 27, 2009 Scott, Here is a simple solution for you: Just to clarify... This will create a new STS tag called $headcart that will allow you to place shopping cart details in your header (or anywehre else you want it). Add the following in includes/modules/sts_inc/sts_user_code.php: $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 " "; echo ENTRY_HCART_PRICE; echo " "; echo $totalprice; } elseif ($productno == 0) { echo ENTRY_HCART_EMPTY; } else { echo ENTRY_HCART_CONTAINS; echo " "; echo $productno; echo " "; echo ENTRY_HCART_ITEM; echo " "; echo " "; echo ENTRY_HCART_PRICE; echo " "; echo $totalprice; } $sts->stop_capture ('headcart'); Now add the following in includes/languages/engish.php: // STS Show Cart In Header define('ENTRY_HCART_EMPTY', 'Your cart is empty'); define('ENTRY_HCART_CONTAINS', 'You have '); define('ENTRY_HCART_ITEM', '<a href="shopping_cart.php" class="trailText">item in your cart</a>'); define('ENTRY_HCART_ITEMS', '<a href="shopping_cart.php" class="trailText">items in your cart</a>'); define('ENTRY_HCART_PRICE', ''); Thats it! Now use $headcart anywhere you want in your STS template files. Enjoy, Okay done this, but the addition of the code in the sts_user_code.php makes the following infoboxes loose there header images:- caterogies, whats new and languages the rest appear okay. the code with the addition recommended at the bottom, tried placing it in serval places and got the same problem. Can you advise if I need to change something please. <?php /* $Id: sts_user_code.php,v 4.1 2005/02/05 05:57:21 rigadin Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2005 osCommerce Released under the GNU General Public License Based on: Simple Template System (STS) - Copyright (c) 2004 Brian Gallagher - [email protected] STS v4.1 by Rigadin ([email protected]) */ /* The following code is a sample of how to add new boxes easily. Use as many blocks as you need and just change the block names. $sts->start_capture(); require(DIR_WS_BOXES . 'new_thing_box.php'); $sts->stop_capture('newthingbox', 'box'); // 'box' makes the system remove some html code before and after the box. Otherwise big mess! Note: If $sts->stop_capture('newthingbox', 'box') is followed by $sts->start_capture, you can replace both by $sts->restart_capture('newthingbox', 'box') Another way to declare STS variables is to enter them directly into the STS array: $sts->template['MyText']='Hello World'; */ $sts->start_capture(); echo "\n<!-- Start Category Menu -->\n"; echo tep_draw_form('goto', FILENAME_DEFAULT, 'get', ''); echo tep_draw_pull_down_menu('cPath', tep_get_category_tree(), $current_category_id, 'onChange="this.form.submit();"'); echo "</form>\n"; echo "<!-- End Category Menu -->\n"; $sts->stop_capture('catmenu'); function tep_get_category_tree($parent_id = '0', $spacing = '', $exclude = '', $category_tree_array = '', $include_itself = false) { global $languages_id; if (!is_array($category_tree_array)) $category_tree_array = array(); if ( (sizeof($category_tree_array) < 1) && ($exclude != '0') ) $category_tree_array[] = array('id' => '0', 'text' => "Catalog"); if ($include_itself) { $category_query = tep_db_query("select cd.categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " cd where cd.language_id = '" . (int)$languages_id . "' and cd.categories_id = '" . (int)$parent_id . "'"); $category = tep_db_fetch_array($category_query); $category_tree_array[] = array('id' => $parent_id, 'text' => $category['categories_name']); } $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' and c.parent_id = '" . (int)$parent_id . "' order by c.sort_order, cd.categories_name"); while ($categories = tep_db_fetch_array($categories_query)) { if ($exclude != $categories['categories_id']) $category_tree_array[] = array('id' => $categories['categories_id'], 'text' => $spacing . $categories['categories_name']); $category_tree_array = tep_get_category_tree($categories['categories_id'], $spacing . ' ', $exclude, $category_tree_array); } return $category_tree_array; } /* // START COMPATIBILITY WITH STS 2 AND 3: $footer // Uncomment this piece of code if you want $footer like in STS. // Keep it as comment if you want to have $footer displaying only the copyright info. $sts->start_capture(); ?> <table border="0" width="100%" cellspacing="0" cellpadding="1"> <tr class="footer"> <td class="footer"> <?php echo strftime(DATE_FORMAT_LONG); ?> </td> <td align="right" class="footer"> <?php echo $counter_now . ' ' . FOOTER_TEXT_REQUESTS_SINCE . ' ' . $counter_startdate_formatted; ?> </td> </tr> </table> <br> <table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td align="center" class="smallText"> <?php echo FOOTER_TEXT_BODY ?> </td> </tr> </table> <?php $sts->stop_capture('footer'); // END COMPATIBILITY WITH STS 2 AND 3: $footer */ /* // START COMPATIBILITY WITH STS 2 AND 3: $banner $sts->start_capture(); if ($banner = tep_banner_exists('dynamic', '468x50')) { ?> <br> <table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td align="center"><?php echo $sts->template['banner_only']; ?></td> </tr> </table> <?php } $sts->stop_capture('banner'); // END COMPATIBILITY WITH STS 2 AND 3: $banner */ /* // START COMPATIBILITY WITH STS 2 AND 3: $cat_ and $urlcat_ // See if there are any $url_ or $urlcat_ variables in the template file, if so, flag to read them if (strpos($sts->template['template_html'], "\$cat_") or strpos($sts->template['template_html'], "\$urlcat_") ) { print "<!-- STS: Reading $cat_ and $urlcat_ tags, recommend not using them -->"; $get_categories_description_query = tep_db_query("SELECT categories_id, categories_name FROM " . TABLE_CATEGORIES_DESCRIPTION); // Loop through each category (in each language) and create template variables for each name and path while ($categories_description = tep_db_fetch_array($get_categories_description_query)) { $cPath_new = tep_get_path($categories_description['categories_id']); $path = substr($cPath_new, 6); // Strip off the "cPath=" from string $catname = $categories_description['categories_name']; $catname = str_replace(" ", "_", $catname); // Replace Spaces in Category Name with Underscores $sts->template["cat_" . $catname] = tep_href_link(FILENAME_DEFAULT, $cPath_new); $sts->template["urlcat_" . $catname] = tep_href_link(FILENAME_DEFAULT, $cPath_new); $sts->template["cat_" . $path] = tep_href_link(FILENAME_DEFAULT, $cPath_new); $sts->template["urlcat_" . $path] = tep_href_link(FILENAME_DEFAULT, $cPath_new); } } */ // END COMPATIBILITY WITH STS 2 AND 3: $cat_ and $urlcat_ $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 " "; echo ENTRY_HCART_PRICE; echo " "; echo $totalprice; } elseif ($productno == 0) { echo ENTRY_HCART_EMPTY; } else { echo ENTRY_HCART_CONTAINS; echo " "; echo $productno; echo " "; echo ENTRY_HCART_ITEM; echo " "; echo " "; echo ENTRY_HCART_PRICE; echo " "; echo $totalprice; } $sts->stop_capture ('headcart'); ?> Quote Getting better with mods but no programmer am I. Link to comment Share on other sites More sharing options...
jrthor2 Posted January 27, 2009 Share Posted January 27, 2009 Hello Jrthor,I set this up using the following. http://www.oscommerce.com/community/contributions,1079 Following the directions their to show the cart info in the header. I then modified mine to only show the number of items in the cart and the total price, by commenting out some of the unneeded stuff. if ($productno > 1) { //echo ENTRY_HCART_CONTAINS; //echo " "; echo $productno; echo " "; //echo ENTRY_HCART_ITEMS; echo " "; echo " "; echo ENTRY_HCART_PRICE; echo " "; echo $totalprice; } elseif ($productno == 0) { //echo ENTRY_HCART_EMPTY; echo $productno; } else { //echo ENTRY_HCART_CONTAINS; //echo " "; echo $productno; echo " "; //echo ENTRY_HCART_ITEM; echo " "; echo " "; //echo ENTRY_HCART_PRICE; echo " "; echo $totalprice; Hope that helps. -Jason Thanks, that worked great. Quote Link to comment Share on other sites More sharing options...
bkellum Posted January 28, 2009 Share Posted January 28, 2009 Thanks, that worked great. There are several talking about the same issue. Here is the STS solution: http://www.oscommerce.com/forums/index.php?sho...p;#entry1278943 Quote 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 More sharing options...
bkellum Posted January 28, 2009 Share Posted January 28, 2009 (edited) Okay done this, but the addition of the code in the sts_user_code.php makes the following infoboxes loose there header images:- caterogies, whats new and languages the rest appear okay. the code with the addition recommended at the bottom, tried placing it in serval places and got the same problem. Can you advise if I need to change something please. Use this instead: <?php /* $Id: sts_user_code.php,v 4.1 2005/02/05 05:57:21 rigadin Exp $ osCommerce, Open Source E-Commerce Solutions [url="http://www.oscommerce.com/"]http://www.oscommerce.com[/url] Copyright (c) 2005 osCommerce Released under the GNU General Public License Based on: Simple Template System (STS) - Copyright (c) 2004 Brian Gallagher - [email="[email protected]"][email protected][/email] STS v4.1 by Rigadin ([email="[email protected]"][email protected][/email]) */ /* The following code is a sample of how to add new boxes easily. Use as many blocks as you need and just change the block names. $sts->start_capture(); require(DIR_WS_BOXES . 'new_thing_box.php'); $sts->stop_capture('newthingbox', 'box'); // 'box' makes the system remove some html code before and after the box. Otherwise big mess! Note: If $sts->stop_capture('newthingbox', 'box') is followed by $sts->start_capture, you can replace both by $sts->restart_capture('newthingbox', 'box') Another way to declare STS variables is to enter them directly into the STS array: $sts->template['MyText']='Hello World'; */ $sts->start_capture(); echo "\n<!-- Start Category Menu -->\n"; echo tep_draw_form('goto', FILENAME_DEFAULT, 'get', ''); echo tep_draw_pull_down_menu('cPath', tep_get_category_tree(), $current_category_id, 'onChange="this.form.submit();"'); echo "</form>\n"; echo "<!-- End Category Menu -->\n"; $sts->stop_capture('catmenu'); function tep_get_category_tree($parent_id = '0', $spacing = '', $exclude = '', $category_tree_array = '', $include_itself = false) { global $languages_id; if (!is_array($category_tree_array)) $category_tree_array = array(); if ( (sizeof($category_tree_array) < 1) && ($exclude != '0') ) $category_tree_array[] = array('id' => '0', 'text' => "Catalog"); if ($include_itself) { $category_query = tep_db_query("select cd.categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " cd where cd.language_id = '" . (int)$languages_id . "' and cd.categories_id = '" . (int)$parent_id . "'"); $category = tep_db_fetch_array($category_query); $category_tree_array[] = array('id' => $parent_id, 'text' => $category['categories_name']); } $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' and c.parent_id = '" . (int)$parent_id . "' order by c.sort_order, cd.categories_name"); while ($categories = tep_db_fetch_array($categories_query)) { if ($exclude != $categories['categories_id']) $category_tree_array[] = array('id' => $categories['categories_id'], 'text' => $spacing . $categories['categories_name']); $category_tree_array = tep_get_category_tree($categories['categories_id'], $spacing . ' ', $exclude, $category_tree_array); } return $category_tree_array; } $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 " "; echo ENTRY_HCART_PRICE; echo " "; echo $totalprice; } elseif ($productno == 0) { echo ENTRY_HCART_EMPTY; } else { echo ENTRY_HCART_CONTAINS; echo " "; echo $productno; echo " "; echo ENTRY_HCART_ITEM; echo " "; echo " "; echo ENTRY_HCART_PRICE; echo " "; echo $totalprice; } $sts->stop_capture ('headcart'); /* // START COMPATIBILITY WITH STS 2 AND 3: $footer // Uncomment this piece of code if you want $footer like in STS. // Keep it as comment if you want to have $footer displaying only the copyright info. $sts->start_capture(); ?> <table border="0" width="100%" cellspacing="0" cellpadding="1"> <tr class="footer"> <td class="footer"> <?php echo strftime(DATE_FORMAT_LONG); ?> </td> <td align="right" class="footer"> <?php echo $counter_now . ' ' . FOOTER_TEXT_REQUESTS_SINCE . ' ' . $counter_startdate_formatted; ?> </td> </tr> </table> <br> <table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td align="center" class="smallText"> <?php echo FOOTER_TEXT_BODY ?> </td> </tr> </table> <?php $sts->stop_capture('footer'); // END COMPATIBILITY WITH STS 2 AND 3: $footer */ /* // START COMPATIBILITY WITH STS 2 AND 3: $banner $sts->start_capture(); if ($banner = tep_banner_exists('dynamic', '468x50')) { ?> <br> <table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td align="center"><?php echo $sts->template['banner_only']; ?></td> </tr> </table> <?php } $sts->stop_capture('banner'); // END COMPATIBILITY WITH STS 2 AND 3: $banner */ /* // START COMPATIBILITY WITH STS 2 AND 3: $cat_ and $urlcat_ // See if there are any $url_ or $urlcat_ variables in the template file, if so, flag to read them if (strpos($sts->template['template_html'], "\$cat_") or strpos($sts->template['template_html'], "\$urlcat_") ) { print "<!-- STS: Reading $cat_ and $urlcat_ tags, recommend not using them -->"; $get_categories_description_query = tep_db_query("SELECT categories_id, categories_name FROM " . TABLE_CATEGORIES_DESCRIPTION); // Loop through each category (in each language) and create template variables for each name and path while ($categories_description = tep_db_fetch_array($get_categories_description_query)) { $cPath_new = tep_get_path($categories_description['categories_id']); $path = substr($cPath_new, 6); // Strip off the "cPath=" from string $catname = $categories_description['categories_name']; $catname = str_replace(" ", "_", $catname); // Replace Spaces in Category Name with Underscores $sts->template["cat_" . $catname] = tep_href_link(FILENAME_DEFAULT, $cPath_new); $sts->template["urlcat_" . $catname] = tep_href_link(FILENAME_DEFAULT, $cPath_new); $sts->template["cat_" . $path] = tep_href_link(FILENAME_DEFAULT, $cPath_new); $sts->template["urlcat_" . $path] = tep_href_link(FILENAME_DEFAULT, $cPath_new); } } */ // END COMPATIBILITY WITH STS 2 AND 3: $cat_ and $urlcat_ ?> Edited January 28, 2009 by bkellum Quote 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 More sharing options...
bkellum Posted January 28, 2009 Share Posted January 28, 2009 Thanks Bill this worked! Does anyone know how I should go about changing the class of the text (I tried adding it to the STS tag but no joy)? And also is it possible to put a 'Hello' in front of the name? it needs to be incorporated into the $customername tag so that it doesn't display when people are not logged in? Thanks Again :) Becki, Here you go: $sts->start_capture(); if ( tep_session_is_registered('customer_first_name') && tep_session_is_registered('customer_id') ) { echo 'Hello ' . tep_output_string_protected($customer_first_name); } $sts->stop_capture ('customername'); The above will print out the following only when the customer is logged in: Hello Bob Add any style you want in your template: <td class="pageHeading">$customername</td> Quote 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 More sharing options...
johnnybebad Posted January 28, 2009 Share Posted January 28, 2009 Use this instead: <?php /* $Id: sts_user_code.php,v 4.1 2005/02/05 05:57:21 rigadin Exp $ osCommerce, Open Source E-Commerce Solutions [url="http://www.oscommerce.com/"]http://www.oscommerce.com[/url] Copyright (c) 2005 osCommerce Released under the GNU General Public License Based on: Simple Template System (STS) - Copyright (c) 2004 Brian Gallagher - [email="[email protected]"][email protected][/email] STS v4.1 by Rigadin ([email="[email protected]"][email protected][/email]) */ /* The following code is a sample of how to add new boxes easily. Use as many blocks as you need and just change the block names. $sts->start_capture(); require(DIR_WS_BOXES . 'new_thing_box.php'); $sts->stop_capture('newthingbox', 'box'); // 'box' makes the system remove some html code before and after the box. Otherwise big mess! Note: If $sts->stop_capture('newthingbox', 'box') is followed by $sts->start_capture, you can replace both by $sts->restart_capture('newthingbox', 'box') Another way to declare STS variables is to enter them directly into the STS array: $sts->template['MyText']='Hello World'; */ $sts->start_capture(); echo "\n<!-- Start Category Menu -->\n"; echo tep_draw_form('goto', FILENAME_DEFAULT, 'get', ''); echo tep_draw_pull_down_menu('cPath', tep_get_category_tree(), $current_category_id, 'onChange="this.form.submit();"'); echo "</form>\n"; echo "<!-- End Category Menu -->\n"; $sts->stop_capture('catmenu'); function tep_get_category_tree($parent_id = '0', $spacing = '', $exclude = '', $category_tree_array = '', $include_itself = false) { global $languages_id; if (!is_array($category_tree_array)) $category_tree_array = array(); if ( (sizeof($category_tree_array) < 1) && ($exclude != '0') ) $category_tree_array[] = array('id' => '0', 'text' => "Catalog"); if ($include_itself) { $category_query = tep_db_query("select cd.categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " cd where cd.language_id = '" . (int)$languages_id . "' and cd.categories_id = '" . (int)$parent_id . "'"); $category = tep_db_fetch_array($category_query); $category_tree_array[] = array('id' => $parent_id, 'text' => $category['categories_name']); } $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' and c.parent_id = '" . (int)$parent_id . "' order by c.sort_order, cd.categories_name"); while ($categories = tep_db_fetch_array($categories_query)) { if ($exclude != $categories['categories_id']) $category_tree_array[] = array('id' => $categories['categories_id'], 'text' => $spacing . $categories['categories_name']); $category_tree_array = tep_get_category_tree($categories['categories_id'], $spacing . ' ', $exclude, $category_tree_array); } return $category_tree_array; } $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 " "; echo ENTRY_HCART_PRICE; echo " "; echo $totalprice; } elseif ($productno == 0) { echo ENTRY_HCART_EMPTY; } else { echo ENTRY_HCART_CONTAINS; echo " "; echo $productno; echo " "; echo ENTRY_HCART_ITEM; echo " "; echo " "; echo ENTRY_HCART_PRICE; echo " "; echo $totalprice; } $sts->stop_capture ('headcart'); /* // START COMPATIBILITY WITH STS 2 AND 3: $footer // Uncomment this piece of code if you want $footer like in STS. // Keep it as comment if you want to have $footer displaying only the copyright info. $sts->start_capture(); ?> <table border="0" width="100%" cellspacing="0" cellpadding="1"> <tr class="footer"> <td class="footer"> <?php echo strftime(DATE_FORMAT_LONG); ?> </td> <td align="right" class="footer"> <?php echo $counter_now . ' ' . FOOTER_TEXT_REQUESTS_SINCE . ' ' . $counter_startdate_formatted; ?> </td> </tr> </table> <br> <table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td align="center" class="smallText"> <?php echo FOOTER_TEXT_BODY ?> </td> </tr> </table> <?php $sts->stop_capture('footer'); // END COMPATIBILITY WITH STS 2 AND 3: $footer */ /* // START COMPATIBILITY WITH STS 2 AND 3: $banner $sts->start_capture(); if ($banner = tep_banner_exists('dynamic', '468x50')) { ?> <br> <table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td align="center"><?php echo $sts->template['banner_only']; ?></td> </tr> </table> <?php } $sts->stop_capture('banner'); // END COMPATIBILITY WITH STS 2 AND 3: $banner */ /* // START COMPATIBILITY WITH STS 2 AND 3: $cat_ and $urlcat_ // See if there are any $url_ or $urlcat_ variables in the template file, if so, flag to read them if (strpos($sts->template['template_html'], "\$cat_") or strpos($sts->template['template_html'], "\$urlcat_") ) { print "<!-- STS: Reading $cat_ and $urlcat_ tags, recommend not using them -->"; $get_categories_description_query = tep_db_query("SELECT categories_id, categories_name FROM " . TABLE_CATEGORIES_DESCRIPTION); // Loop through each category (in each language) and create template variables for each name and path while ($categories_description = tep_db_fetch_array($get_categories_description_query)) { $cPath_new = tep_get_path($categories_description['categories_id']); $path = substr($cPath_new, 6); // Strip off the "cPath=" from string $catname = $categories_description['categories_name']; $catname = str_replace(" ", "_", $catname); // Replace Spaces in Category Name with Underscores $sts->template["cat_" . $catname] = tep_href_link(FILENAME_DEFAULT, $cPath_new); $sts->template["urlcat_" . $catname] = tep_href_link(FILENAME_DEFAULT, $cPath_new); $sts->template["cat_" . $path] = tep_href_link(FILENAME_DEFAULT, $cPath_new); $sts->template["urlcat_" . $path] = tep_href_link(FILENAME_DEFAULT, $cPath_new); } } */ // END COMPATIBILITY WITH STS 2 AND 3: $cat_ and $urlcat_ ?> Alas this is still making the 3 info boxes named previously loose there heder title images, so have the boxed x's, but its only when adding the code into the system for the cart header. Quote Getting better with mods but no programmer am I. Link to comment Share on other sites More sharing options...
tementa Posted January 28, 2009 Share Posted January 28, 2009 Hi, How I can to display $languagebox in a drop-down menu? The file that makes the $languagebox display is includes/boxes/languages.php I tried this but I get no the right result <!-- languages //--> <tr> <td> <?php $info_box_contents = array(); $info_box_contents[] = array('text' => BOX_HEADING_LANGUAGES); new infoBoxHeading($info_box_contents, false, false); if (!isset($lng) || (isset($lng) && !is_object($lng))) { include(DIR_WS_CLASSES . 'language.php'); $lng = new language; } $languages_string = ''; reset($lng->catalog_languages); $languages_array = array(); while (list($key, $value) = each($lng->catalog_languages)) { $languages_array[] = array ('<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('language', 'currency')) . 'language=' . $key, $request_type) . '">' . tep_image(DIR_WS_LANGUAGES . $value['directory'] . '/images/' . $value['image'], $value['name']) . '</a>'); } $info_box_contents = array(); $info_box_contents[] = array('align' => 'center', 'text' => tep_draw_pull_down_menu('languages', $languages_string) . $hidden_get_variables . tep_hide_session_id()); new infoBox($info_box_contents); ?> </td> </tr> <!-- languages_eof //--> An the error that displays is this: Fatal error: Cannot use string offset as an array in C:\wamp\www\tienda\includes\functions\html_output.php on line 306 Quote Link to comment Share on other sites More sharing options...
Becki Posted January 28, 2009 Share Posted January 28, 2009 This is fairly simple. All you need to do is create a STS tag for the new infobox. Here is what I like to use for a Newsletter Infobox: http://www.oscommerce.com/community/contributions,535 As I stated above, the only thing needed to make this work in STS is to create a new variable for the newly created newsletter infobox: Hi Bill, do you happen to know which version of this you are using? I've wasted so much time trying to install versions of contributions that just end up buggy or not working at all it would be a real advantage to know you have a version working ;). Thanks if you can remember! Just one qestion - what info do they have to give to sign up to the newsletter, just email? BTW - this didn't fix getting the other newsletter contrib working but I'm willing to accept it was a waste of time and go with the one you mention! $sts->start_capture(); require(DIR_WS_BOXES . 'newsletter.php'); $sts->stop_capture('newsletter', 'box'); Many thanks and thanks again for the answer regarding the $customername. Quote Link to comment Share on other sites More sharing options...
Treskel Posted January 29, 2009 Share Posted January 29, 2009 Hey folks, I am new to php etc. so please forgive me if I have done the equivilent of not having the modem plugged in. I had installed several mods to a new site this week. I was good with sts 4.5.8, Ultimate SEO Urls 2.6, OsC Catalog, Easy Populate 2.76, Product Listing Columns 2.2.8, Store feeds 3.3, Dynamic Sitemap 3.5.10. I guess Header tags 2.5.9 was too much. so I backed up and used STS v4.3.3 with HTC v2.6.0. Here is the error I am getting: Warning: strstr() [function.strstr]: Empty delimiter in /home/treskel/public_html/includes/header_tags.php on line 43 Warning: strstr() [function.strstr]: Empty delimiter in /home/treskel/public_html/includes/header_tags.php on line 43 Line 43 is: case (strstr($_SERVER['PHP_SELF'],FILENAME_DEFAULT) or strstr($PHP_SELF,FILENAME_DEFAULT) ): Like I said, I am not too good with this stuff. I just can't figure this out. I looked for the usual suspects: missing files, typos, etc. I think the error means that strstr is bringing back no data? is this right? and what do I do about that? Thanks in advance Quote Link to comment Share on other sites More sharing options...
bkellum Posted January 29, 2009 Share Posted January 29, 2009 Hi Bill, do you happen to know which version of this you are using? I've wasted so much time trying to install versions of contributions that just end up buggy or not working at all it would be a real advantage to know you have a version working ;) . Thanks if you can remember! Just one qestion - what info do they have to give to sign up to the newsletter, just email? BTW - this didn't fix getting the other newsletter contrib working but I'm willing to accept it was a waste of time and go with the one you mention! Many thanks and thanks again for the answer regarding the $customername. v.53a Basically how that contrib works is you can either subscribe to the newsletter via the infobox if you are not a registered user, or if you are already registered you can subscribe like normal in your account setttings. The data is kept in separate tables, the reason being if you tried to keep them all in one table and someone who had subscribed to the newsletter but then tried to to create an account it would make quite a problem as each registered account has a unique email address. Quote 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 More sharing options...
BlindingLight Posted January 29, 2009 Share Posted January 29, 2009 (edited) FYI: PHP code CAN BE INSERTED INTO THE ACTUAL TEMPLATES. There are a couple of different methods of including external files but first you should try to add the file name in the STS Modules in the admin. You would do this by creating a file called sts_form_check_ajx.js.php and upload it to your includes/modules/sts_inc/ folder. The content of sts_form_check_ajax.js.php file should only contain the following: <?php /* $Id: sts_form_check_ajax.js.php, v 1.0 12/3/2008 bkellum Exp $ osCommerce, Open Source E-Commerce Solutions [url="http://www.oscommerce.com/"][color="#0000ff"]http://www.oscommerce.com[/color][/url] Copyright (c) 2008 osCommerce Released under the GNU General Public License STS v4 include module by bkellum ([email="billkellum@soundsgoodpro."][color="#0000ff"][email="billkellum@soundsgoodproDOTcom"]billkellumATsoundsgoodpro[/color][/email]DOTcom[/email]) for [font="Verdana"]country_state_selector_ajax1.5.5 contrib[/font] */ $sts->start_capture(); if ( file_exists(DIR_WS_INCLUDES . '[font="Verdana"]form_check.js.php'[/font]) ) { require(DIR_WS_INCLUDES . '[font="Verdana"]form_check.js.php'[/font]); } if ( file_exists(DIR_WS_INCLUDES . 'ajax[font="Verdana"].js.php'[/font]) ) { require(DIR_WS_INCLUDES . '[font="Verdana"]ajax.js.php'[/font]); } $sts->stop_capture('header_ajax'); ?> Test your site to see if everything is working. If not, add $header_ajax to your template in the head section. bkellum, I have a similar problem with AJAX Search Suggest... and I believe it's because it can't include the files needed to render the results. <?php echo tep_draw_form('quick_find', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get'); ?> <?php echo tep_draw_input_field('keywords', '', 'id="txtSearch" size="40" autocomplete="off" maxlength="40" style="width:266px:font-size:13px;height:22px"')." "; echo tep_hide_session_id(); ?> <script language="JavaScript" type="text/javascript" src="includes/class.OSCFieldSuggest.js"></script> <script language="JavaScript" type="text/javascript"> /*<![CDATA[*/ //Attention!!! put always this code above the HTML code of your field!!! var oscSearchSuggest = new OSCFieldSuggest('txtSearch', 'includes/search_suggest.xsl', 'searchsuggest.php'); /*]]>*/ </script> <?php echo tep_image_submit('button_go.gif', 'Search'); ?> <?php echo '<a href="' . tep_href_link(FILENAME_ADVANCED_SEARCH) . '"><b>Advanced Search</b></a>'; ?> I know it has to do with STS because when I turn it off it works well... but when I turn it on it doesn't. AJAX Search suggest is supposed to do quick search and display it in a table... but the table is never filled with information. There is not include happening. This is how a fellow osC user has it running but without STS --> www (DOT) smartoys (dot) be Help Pleeeze :P AJAX Search Suggest -> [link]http://addons.oscommerce.com/info/4144[/link] Edited January 29, 2009 by BlindingLight Quote Link to comment Share on other sites More sharing options...
Guest Posted January 29, 2009 Share Posted January 29, 2009 How do I chage the width of a module I would like to change the width of the X-sell module from 100 % to 300 px so it fit to my sts site. See at the bottom of this site http://www.babygear.dk/aqua-baby-banz-p-98.html Best regards, Jesper Quote Link to comment Share on other sites More sharing options...
El_Heso Posted January 29, 2009 Share Posted January 29, 2009 Hi! Im trying to manage to inlude additional_image.php in product_info.php.html. from this contribution ( Ultra Pics 2.07.01 - incl. STS + CCGV + LightBox_1 ) I tryed to replicate the function of this beeacuse that was the only function that i found that reminded me of what im trying to do. $sts->start_capture(); if ((USE_CACHE == 'true') && empty($SID)) { echo tep_cache_also_purchased(3600); } else { include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS); } $sts->stop_capture ('alsopurchased'); // Get the result to the main array $template_pinfo['alsopurchased']= $sts->template['alsopurchased']; // Put it in the product info I thought that this would work beacuse that file also includes from modules as additional_image also do but i cant make this work... Has anyone manage to get it work to use $additionalimage in product_info under content? Regards Tony Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.