Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

aresman

Archived
  • Posts

    47
  • Joined

  • Last visited

Posts posted by aresman

  1. Okay, so we have multiple sites that use a live chat feature. The feature works by incorporating javascript into the page at some defined place and adding the "online" or "offline" image - depending on which is which.

     

    Well, I thought incorporating this into a box would be easy, just change the text area to the script - but no such luck.

     

    Does anyone have any suggestions on what I need to do to make this work?

     

    Here's the box text that I thought would work, but instead halts my site.

     

    <?php
    /*
    ?$Id: reviews.php,v 1.37 2003/06/09 22:20:28 hpdl Exp $
    
    ?osCommerce, Open Source E-Commerce Solutions
    ?http://www.oscommerce.com
    
    ?Copyright (c) 2003 osCommerce
    
    ?Released under the GNU General Public License
    */
    ?>
    <!-- warrantyregistration //-->
    ? ? ? ? ?<tr>
    ? ? ? ? ? ?<td>
    <?php
    ?$info_box_contents = array();
    ?$info_box_contents[] = array('text' => 'Chat Live');
    
    ?new infoBoxHeading($info_box_contents, false, false);
    
    ?$info_box_contents = array();
    ?$info_box_contents[] = array('text' => '<!-- BEGIN PHP Live! code, (c) OSI Codes Inc. -->
    <script language="JavaScript" src="http://www.mysite.com/phplive/js/status_image.php?base_url=http://www.mysite.com/phplive&l=mysitename&x=1&deptid=0&btn=1"><a href="http://www.phplivesupport.com"></a></script>
    <!-- END PHP Live! code : (c) OSI Codes Inc. --><br>');
    
    ?new infoBox($info_box_contents);
    ?>

     

    And here is the code I inserted into the sts_user_code as instructed:

     

    // Live Chat Box
    $sts_block_name = 'livechat';
    require(STS_START_CAPTURE);
    require(DIR_WS_BOXES . 'livchat.php');
    require(STS_STOP_CAPTURE);
    $template['livechat'] = strip_unwanted_tags($sts_block['livechat'], 'livechat');

     

    Thank you.

     

    Nick

  2. I think that you can define how the date is shown in:

     

    catalog/includes/languages/english.php

     

    Look for:

     

    define('DATE_FORMAT_LONG', '%A %d %B, %Y'); // this is used for strftime()

     

    Try swapping %d and %B with each other... see if it works. Sorry I haven't tested so cannot be 100% sure if it will work. You may have to otherwise mess around with the database!

     

    Regards

     

    Jiten

    Worked just fine... Thank you.

  3. I thought it might be more helpful if my entire sts_display_output.php file was here... So, here it is:

     

    <?php
    /*
    $Id: sts_display_output.php,v 1.2 2004/02/05 05:57:12 jhtalk Exp $
    
    osCommerce, Open Source E-Commerce Solutions
    http://www.oscommerce.com
    
    Copyright (c) 2003 osCommerce
    
    Released under the GNU General Public License
    */
    
    /* 
    
     Simple Template System (STS) - Copyright (c) 2004 Brian Gallagher - [email protected]
    
    */
    
    // Used for debugging, please don't change
    $sts_version = "2.01";
    $sts_osc_version = PROJECT_VERSION;
    $sts_osc_version_required = "osCommerce 2.2-MS2";
    
    
    
    // Perform OSC version checking
    if ($sts_osc_version != $sts_osc_version_required) {
     echo "STS was designed to work with OSC version [$sts_osc_version_required].  This is version [$sts_osc_version].\n";
    }
    
    $template['debug'] .= ''; // Define as blank if not already defined
    
    /////////////////////////////////////////////
    // SELECT HOW TO DISPLAY THE OUTPUT
    /////////////////////////////////////////////
    $display_template_output = 1;
    $display_normal_output = 0;
    $display_debugging_output = 0;
    $display_version_output = 0;
    
    /*  /////////////////////////////////////  ERROR FIXED by Walo /////////////
    /////////////////////////////////////////  ERROR FIXED by Walo /////////////
    /////////////////////////////////////////  ERROR FIXED by Walo /////////////
    // Override if we need to show a pop-up window
    $scriptname = $_SERVER['PHP_SELF'];
    $scriptname = getenv('SCRIPT_NAME');
    $scriptbasename = substr($scriptname, strrpos($scriptname, '/') + 1);
    // If script name contains "popup" then turn off templates and display the normal output
    // This is required to prevent display of standard page elements (header, footer, etc) from the template and allow javascript code to run properly
    if (strpos($scriptname, "popup") !== false || strpos($scriptname, "info_shopping_cart") !== false || strpos($scriptname, "printorder.php") !== false) {
     $display_normal_output = 1;
     $display_template_output = 0;
    }
    /////////////////////////////////////////  ERROR FIXED by Walo /////EOF/////
    */
    
    
    // Override if we need to show a pop-up window
    $scriptname = $_SERVER['PHP_SELF'];
    $scriptname = strstr($scriptname, "popup");
    $scriptname2 = strstr($scriptname, "info_shopping_cart");
    // If script name contains "popup" then turn off templates and display the normal output
    // This is required to prevent display of standard page elements (header, footer, etc) from the template and allow javascript code to run properly
    if ($scriptname != false || $scriptname2 != false) {
    $display_normal_output = 1;
    $display_template_output = 0;
    }
    
    /* Added for popup printorder
    // This is required to prevent display of standard page elements (header, footer, etc) from the template and allow javascript code to run properly
    if (strpos($scriptname, "popup") !== false || strpos($scriptname, "info_shopping_cart") !== false) {
    $display_normal_output = 1;
    $display_template_output = 0;
    } */
    
    /////////////////////////////////////////////
    // Allow the ability to turn on/off settings from the URL
    // Set values to 0 or 1 as needed
    /////////////////////////////////////////////
    
    // Allow Template output control from the URL
    if ($HTTP_GET_VARS['sts_template'] != "") {
    $display_template_output = $HTTP_GET_VARS['sts_template'];
    }
    
    // Allow Normal output control from the URL
    if ($HTTP_GET_VARS['sts_normal'] != "") {
    $display_normal_output = $HTTP_GET_VARS['sts_normal'];
    }
    
    // Allow Debugging control from the URL
    if ($HTTP_GET_VARS['sts_debug'] != "") {
    $display_debugging_output = $HTTP_GET_VARS['sts_debug'];
    }
    
    // Allow Version control from the URL
    if ($HTTP_GET_VARS['sts_version'] != "") {
    $display_version_output = $HTTP_GET_VARS['sts_version'];
    }
    
    // Print out version number if needed
    if ($display_version_output == 1 or $display_debugging_output == 1) {
    print "STS_VERSION=[$sts_version]\n";
    print "OSC_VERSION=[$sts_osc_version]\n";
    }
    
    // Start with the default template
    $sts_template_file = STS_DEFAULT_TEMPLATE;
    
    // See if there is a custom template file for the currently running script
    $sts_check_file = STS_TEMPLATE_DIR . $scriptbasename . ".html";
    if (file_exists($sts_check_file)) {
     // Use it
     $sts_template_file = $sts_check_file;
    } 
    
    // Are we in the index.php script?  If so, what is our Category Path (cPath)?
    if ($scriptbasename == "index.php") {
     // If no cPath defined, default to 0 (the home page)
     if ($cPath == "") {
    $sts_cpath = 0; 
     } else {
           $sts_cpath = $cPath;
     }
    
     // Look for category-specific template file like "index.php_1_17.html"
     $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;
     } 
    
    }
    
    // Open Template file and read into a variable
    if (! file_exists($sts_template_file)) {
     echo "Template file doesn't exist: [$sts_template_file]";
    }  else {
     echo "<!-- Using Template File [$sts_template_file) -->\n";
    }
    
    if (! $fh = fopen($sts_template_file, 'r')) {
    echo "Can't open Template file: [$sts_template_file]";
    }
    
    $template_html = fread($fh, filesize($sts_template_file));
    fclose($fh);
    
    
    /////////////////////////////////////////////
    ////// if product_info.php load data
    /////////////////////////////////////////////
    if ($scriptbasename == 'product_info.php') {
     require(STS_PRODUCT_INFO);
    }
    
    /////////////////////////////////////////////
    ////// Run any user code needed
    /////////////////////////////////////////////
    require(STS_USER_CODE);
    
    /////////////////////////////////////////////
    ////// Set up template variables
    /////////////////////////////////////////////
    
    $template['title'] = (HEADING_TITLE);
    
    /////////////////////////////////////////////
    ////// Capture <title> and <meta> tags
    /////////////////////////////////////////////
    
    // STS: ADD: Support for WebMakers.com's Header Tag Controller contribution
     // Capture the output
    // Modified to work with Article Manager (which uses custom headers)
    if ($use_ah_tags == 'true') {
    require(DIR_WS_INCLUDES . 'article_header_tags.php');
    // don't process HTC - use headertags from article_header_tags
    } else {
    
     require(STS_START_CAPTURE);
    if ($cPath && ($HTTP_GET_VARS['products_id'] < '20'))  {
     
     // RJW Begin Meta Tags Code
     if (file_exists(DIR_WS_INCLUDES . 'meta_tags.php')) {
       require(DIR_WS_INCLUDES . 'meta_tags.php');
     } else {
       echo '<title>' . TITLE . $title . '</title>';
     }
     // RJW End Meta Tags Code
    
    } else  {
     // BOF: WebMakers.com Changed: Header Tag Controller v1.0
     // Replaced by header_tags.php
     if ( file_exists(DIR_WS_INCLUDES . 'header_tags.php') ) {
    //    require(DIR_WS_FUNCTIONS . 'clean_html_comments.php');
       require(DIR_WS_FUNCTIONS . 'header_tags.php');
       require(DIR_WS_INCLUDES . 'header_tags.php');
     } else {
       echo "<title>" . TITLE . $title . "</title>";
     }
     // EOF: WebMakers.com Changed: Header Tag Controller v1.0
    }
     $sts_block_name = 'headertags';
     require(STS_STOP_CAPTURE);
    }
    // STS: EOADD: Support for WebMakers.com's Header Tag Controller contribution
    
    /////////////////////////////////////////////
    ////// Set up template variables
    /////////////////////////////////////////////
    
     $template['sid'] =  tep_session_name() . '=' . tep_session_id();
    
     // Strip out <title> variable
     $template['title'] = str_between($sts_block['headertags'], "<title>", "</title>");
    
     // Load up the <head> content that we need to link up everything correctly.  Append to anything that may have been set in sts_user_code.php
     $template['headcontent'] .= '<meta http-equiv="Content-Type" content="text/html; charset=' . CHARSET . '">' . "\n"; 
     $template['headcontent'] .= $sts_block['headertags'];
     $template['headcontent'] .= '<base href="' . (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG . '">' . "\n";
     // $template['headcontent'] .= '<link rel="stylesheet" type="text/css" href="stylesheet.css">' . "\n";
     $template['headcontent'] .= get_javascript($sts_block['applicationtop2header'],'get_javascript(applicationtop2header)');
      
    
     // Note: These values lifted from the stock /catalog/includes/header.php script's HTML
     // catalogurl: url to catalog's home page
     // catalog: link to catalog's home page
     $template['cataloglogo'] = '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image(DIR_WS_IMAGES . 'oscommerce.gif', 'osCommerce') . '</a>';
     $template['urlcataloglogo'] = tep_href_link(FILENAME_DEFAULT);
    
     $template['myaccountlogo'] = '<a href="' . tep_href_link(FILENAME_ACCOUNT, '', 'SSL') . '">' . tep_image(DIR_WS_IMAGES . 'header_account.gif', HEADER_TITLE_MY_ACCOUNT) . '</a>';
     $template['urlmyaccountlogo'] = tep_href_link(FILENAME_ACCOUNT, '', 'SSL');
    
     $template['cartlogo'] = '<a href="' . tep_href_link(FILENAME_SHOPPING_CART) . '">' . tep_image(DIR_WS_IMAGES . 'header_cart.gif', HEADER_TITLE_CART_CONTENTS) . '</a>';
     $template['urlcartlogo'] = tep_href_link(FILENAME_SHOPPING_CART);
    
     $template['checkoutlogo'] = '<a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . tep_image(DIR_WS_IMAGES . 'header_checkout.gif', HEADER_TITLE_CHECKOUT) . '</a>';
     $template['urlcheckoutlogo'] = tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL');
    
     $template['breadcrumbs'] = $breadcrumb->trail(' » ');
    
     if (tep_session_is_registered('customer_id')) {
       $template['myaccount'] = '<a href=' . tep_href_link(FILENAME_ACCOUNT, '', 'SSL') . ' class="headerNavigation">' . HEADER_TITLE_MY_ACCOUNT . '</a>';
       $template['urlmyaccount'] = tep_href_link(FILENAME_ACCOUNT, '', 'SSL');
       $template['logoff'] = '<a href=' . tep_href_link(FILENAME_LOGOFF, '', 'SSL')  . ' class="headerNavigation">' . HEADER_TITLE_LOGOFF . '</a>';
       $template['urllogoff'] = tep_href_link(FILENAME_LOGOFF, '', 'SSL');
       $template['myaccountlogoff'] = $template['myaccount'] . " | " . $template['logoff'];
     } else {
       $template['myaccount'] = '<a href=' . tep_href_link(FILENAME_ACCOUNT, '', 'SSL') . ' class="headerNavigation">' . HEADER_TITLE_MY_ACCOUNT . '</a>';
       $template['urlmyaccount'] = tep_href_link(FILENAME_ACCOUNT, '', 'SSL');
       $template['logoff'] = '';
       $template['urllogoff'] = '';
       $template['myaccountlogoff'] = $template['myaccount'];
     }
    
     $template['cartcontents']    = '<a href=' . tep_href_link(FILENAME_SHOPPING_CART) . ' class="headerNavigation">' . HEADER_TITLE_CART_CONTENTS . '</a>';
     $template['urlcartcontents'] = '<a href=' . tep_href_link(FILENAME_SHOPPING_CART) . ' class="headerNavigation">' . HEADER_TITLE_CART_CONTENTS . '</a>';
    
     $template['checkout'] = '<a href=' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . ' class="headerNavigation">' . HEADER_TITLE_CHECKOUT . '</a>';
     $template['urlcheckout'] = tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL');
    
    /////////////////////////////////////////////
    ////// Create custom boxes
    /////////////////////////////////////////////
     $template['categorybox'] = strip_unwanted_tags($sts_block['categorybox'], 'categorybox');
     $template['manufacturerbox'] = strip_unwanted_tags($sts_block['manufacturerbox'], 'manufacturerbox');
     $template['whatsnewbox'] = strip_unwanted_tags($sts_block['whatsnewbox'], 'whatsnewbox');
     $template['searchbox'] = strip_unwanted_tags($sts_block['searchbox'], 'searchbox');
     $template['informationbox'] = strip_unwanted_tags($sts_block['informationbox'], 'informationbox');
     $template['cartbox'] = strip_unwanted_tags($sts_block['cartbox'], 'cartbox');
     $template['maninfobox'] = strip_unwanted_tags($sts_block['maninfobox'], 'maninfobox');
     $template['orderhistorybox'] = strip_unwanted_tags($sts_block['orderhistorybox'], 'orderhistorybox');
     $template['bestsellersbox'] = strip_unwanted_tags($sts_block['bestsellersbox'], 'bestsellersbox');
     $template['specialfriendbox'] = strip_unwanted_tags($sts_block['specialfriendbox'], 'specialfriendbox');
     $template['reviewsbox'] = strip_unwanted_tags($sts_block['reviewsbox'], 'reviewsbox');
     $template['languagebox'] = strip_unwanted_tags($sts_block['languagebox'], 'languagebox');
     $template['currenciesbox'] = strip_unwanted_tags($sts_block['currenciesbox'], 'currenciesbox');
     $template['content'] = strip_content_tags($sts_block['columnleft2columnright'], 'content');
     // Prepend any error/warning messages to $content
     if ($messageStack->size('header') > 0) {
       $template['content'] = $messageStack->output('header') . $template['content'];
     }
     $template['date'] = strftime(DATE_FORMAT_LONG);
     $template['numrequests'] = $counter_now . ' ' . FOOTER_TEXT_REQUESTS_SINCE . ' ' . $counter_startdate_formatted;
     $template['counter'] = $sts_block['counter'];
     $template['footer'] = $sts_block['footer'];
     $template['banner'] = $sts_block['banner'];
    
     
    /////////////////////////////////////////////
    ////// Get Categories
    /////////////////////////////////////////////
    $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
    
         $template["cat_" . $catname] = tep_href_link(FILENAME_DEFAULT, $cPath_new);
         $template["urlcat_" . $catname] = tep_href_link(FILENAME_DEFAULT, $cPath_new);
         $template["cat_" . $path] = tep_href_link(FILENAME_DEFAULT, $cPath_new);
         $template["urlcat_" . $path] = tep_href_link(FILENAME_DEFAULT, $cPath_new);
    
         // print "<b>template[" . $categories_description['categories_name'] . "]=" . $template[$categories_description['categories_name']] . "<br>template[" . $path . "]=" . $template[$path] . "</b>";
    }
    
    /////////////////////////////////////////////
    ////// Display Template HTML
    /////////////////////////////////////////////
    
     // Sort array by string length, so that longer strings are replaced first
     uksort($template, "sortbykeylength");
    
     // Manually replace the <!--$headcontent--> if present
       $template_html = str_replace('<!--$headcontent-->', $template['headcontent'], $template_html);
    
     // Automatically replace all the other template variables
     foreach ($template as $key=>$value) {
       $template_html = str_replace('$' . $key, $value, $template_html);
     }
    
     if ($display_template_output == 1) {
       echo $template_html;
     }
    
    
    /////////////////////////////////////////////
    ////// Display HTML
    /////////////////////////////////////////////
    if ($display_normal_output == 1) {
     echo $sts_block['applicationtop2header'];
     echo $sts_block['header'];
    
    
     echo $sts_block['header2columnleft'];
    
     // print column_left stuff
     echo $sts_block['categorybox'];
     echo $sts_block['manufacturerbox'];
     echo $sts_block['whatsnewbox'];
     echo $sts_block['searchbox'];
     echo $sts_block['informationbox'];
    
     echo $sts_block['columnleft2columnright'];
    
     // print column_right stuff
     echo $sts_block['cartbox'];
     echo $sts_block['maninfobox'];
     echo $sts_block['orderhistorybox'];
     echo $sts_block['bestsellersbox'];
     echo $sts_block['specialfriendbox'];
     echo $sts_block['reviewsbox'];
     echo $sts_block['languagebox'];
     echo $sts_block['currenciesbox'];
    
     echo $sts_block['columnright2footer'];
    
     // print footer
     echo $sts_block['content'];
     echo $sts_block['counter'];
     echo $sts_block['footer'];
     echo $sts_block['banner'];
    }
    /////////////////////////////////////////////
    ////// End Display HTML
    /////////////////////////////////////////////
    
    if ($display_debugging_output == 1) {
     // Print Debugging Info
     print "\n<pre><hr>\n";
     print "STS_VERSION=[" . $sts_version . "]<br>\n";
     print "OSC_VERSION=[$sts_osc_version]\n";
     print "STS_TEMPLATE=[" . $sts_template_file . "]<hr>\n";
     // Replace $variable names in $sts_block_html_* with variables from the $template array
     foreach ($sts_block as $key=>$value) {
       print "<b>\$sts_block['$key']</b><hr>" . htmlspecialchars($value) . "<hr>\n";
     }
    
     foreach ($template as $key=>$value) {
       print "<b>\$template['$key']</b><hr>" . htmlspecialchars($value) . "<hr>\n";
     }
    
    }
    
    if ($display_normal_output == 1) {
     echo $sts_block['footer2applicationbottom'];
    }
    
    // STRIP_UNWANTED_TAGS() - Remove leading and trailing <tr><td> from strings
    function strip_unwanted_tags($tmpstr, $commentlabel) {
     // Now lets remove the <tr><td> that the require puts in front of the tableBox
     $tablestart = strpos($tmpstr, "<table");
    
     // If empty, return nothing
     if ($tablestart < 1) {
    	 return  "\n<!-- start $commentlabel //-->\n$tmpstr\n<!-- end $commentlabel //-->\n";
     }
    
     $tmpstr = substr($tmpstr, $tablestart); // strip off stuff before <table>
    
     // Now lets remove the </td></tr> at the end of the tableBox output
     // strrpos only works for chars, not strings, so we'll cheat and reverse the string and then use strpos
     $tmpstr = strrev($tmpstr);
    
     $tableend = strpos($tmpstr, strrev("</table>"), 1);
     $tmpstr = substr($tmpstr, $tableend);  // strip off stuff after </table>
    
     // Now let's un-reverse it
     $tmpstr = strrev($tmpstr);
    
     // print "<hr>After cleaning tmpstr:" . strlen($tmpstr) . ": FULL=[".  htmlspecialchars($tmpstr) . "]<hr>\n";
     return  "\n<!-- start $commentlabel //-->\n$tmpstr\n<!-- end $commentlabel //-->\n";
    }
    
    
    // STRIP_CONTENT_TAGS() - Remove text before "body_text" and after "body_text_eof"
    function strip_content_tags($tmpstr, $commentlabel) {
     // Now lets remove the <tr><td> that the require puts in front of the tableBox
     $tablestart = strpos($tmpstr, "<table");
     $formstart = strpos($tmpstr, "<form");
    
     // If there is a <form> tag before the <table> tag, keep it
     if ($formstart !== false and $formstart < $tablestart) {
        $tablestart = $formstart;
        $formfirst = true;
     }
    
     // If empty, return nothing
     if ($tablestart < 1) {
           return  "\n<!-- start $commentlabel //-->\n$tmpstr\n<!-- end $commentlabel //-->\n";
     }
     
     $tmpstr = substr($tmpstr, $tablestart); // strip off stuff before <table>
    
     // Now lets remove the </td></tr> at the end of the tableBox output
     // strrpos only works for chars, not strings, so we'll cheat and reverse the string and then use strpos
     $tmpstr = strrev($tmpstr);
    
     if ($formfirst == true) {
       $tableend = strpos($tmpstr, strrev("</form>"), 1);
     } else {
       $tableend = strpos($tmpstr, strrev("</table>"), 1);
     } 
    
     $tmpstr = substr($tmpstr, $tableend);  // strip off stuff after <!-- body_text_eof //-->
    
     // Now let's un-reverse it
     $tmpstr = strrev($tmpstr);
    
     // print "<hr>After cleaning tmpstr:" . strlen($tmpstr) . ": FULL=[".  htmlspecialchars($tmpstr) . "]<hr>\n";
     return  "\n<!-- start $commentlabel //-->\n$tmpstr\n<!-- end $commentlabel //-->\n";
    }
    
    
    function get_javascript($tmpstr, $commentlabel) {
     // Now lets remove the <tr><td> that the require puts in front of the tableBox
     $tablestart = strpos($tmpstr, "<script");
    
     // If empty, return nothing
     if ($tablestart === false) {
    	 return  "\n<!-- start $commentlabel //-->\n\n<!-- end $commentlabel //-->\n";
     }
    
     $tmpstr = substr($tmpstr, $tablestart); // strip off stuff before <table>
    
     // Now lets remove the </td></tr> at the end of the tableBox output
     // strrpos only works for chars, not strings, so we'll cheat and reverse the string and then use strpos
     $tmpstr = strrev($tmpstr);
    
     $tableend = strpos($tmpstr, strrev("</script>"), 1);
     $tmpstr = substr($tmpstr, $tableend);  // strip off stuff after </table>
    
     // Now let's un-reverse it
     $tmpstr = strrev($tmpstr);
    
     // print "<hr>After cleaning tmpstr:" . strlen($tmpstr) . ": FULL=[".  htmlspecialchars($tmpstr) . "]<hr>\n";
     return  "\n<!-- start $commentlabel //-->\n$tmpstr\n<!-- end $commentlabel //-->\n";
    }
    
    // Return the value between $startstr and $endstr in $tmpstr
    function str_between($tmpstr, $startstr, $endstr) {
     $startpos = strpos($tmpstr, $startstr);
    
     // If empty, return nothing
     if ($startpos === false) {
           return  "";
     }
    
     $tmpstr = substr($tmpstr, $startpos + strlen($startstr)); // strip off stuff before $start
    
     // Now lets remove the </td></tr> at the end of the tableBox output
     // strrpos only works for chars, not strings, so we'll cheat and reverse the string and then use strpos
     $tmpstr = strrev($tmpstr);
    
     $endpos = strpos($tmpstr, strrev($endstr), 1);
    
     $tmpstr = substr($tmpstr, $endpos + strlen($endstr));  // strip off stuff after </table>
    
     // Now let's un-reverse it
     $tmpstr = strrev($tmpstr);
    
     return  $tmpstr;
    }
    
    function sortbykeylength($a,$b) {
     $alen = strlen($a);
     $blen = strlen($b);
     if ($alen == $blen) $r = 0;
     if ($alen < $blen) $r = 1;
     if ($alen > $blen) $r = -1;
     return $r;
    }
    
    ?>

     

    Please, anyone?

  4. I got almost everything working the way I want, here is some more of the things I did:

     

    2) For those using STS, this is the way around it from Brian Gallagher

     

    In sts_display_output.php change these lines:

     

    CODE

    // This is required to prevent display of standard page elements (header, footer, etc) from the template and allow javascript code to run properly

    if (strpos($scriptname, "popup") !== false || strpos($scriptname, "info_shopping_cart") !== false) {

    $display_normal_output = 1;

    $display_template_output = 0;

    }

     

     

    to this:

     

     

    QUOTE

    // This is required to prevent display of standard page elements (header, footer, etc) from the template and allow javascript code to run properly

    if (strpos($scriptname, "popup") !== false || strpos($scriptname, "info_shopping_cart") !== false || strpos($scriptname, "printorder.php") !== false) {

    ? $display_normal_output = 1;

    ? $display_template_output = 0;

    }

     

     

    That should keep STS from using the template on the printorder file.

     

    - Brian

     

    I implemented the changed code into the sts_display_output file but, one question, is it supposed to be commented out? Here's what mine is currently, continuing the commented out as was set before:

     

    /*  /////////////////////////////////////  ERROR FIXED by Walo /////////////
    /////////////////////////////////////////  ERROR FIXED by Walo /////////////
    /////////////////////////////////////////  ERROR FIXED by Walo /////////////
    // Override if we need to show a pop-up window
    $scriptname = $_SERVER['PHP_SELF'];
    $scriptname = getenv('SCRIPT_NAME');
    $scriptbasename = substr($scriptname, strrpos($scriptname, '/') + 1);
    // If script name contains "popup" then turn off templates and display the normal output
    // This is required to prevent display of standard page elements (header, footer, etc) from the template and allow javascript code to run properly
    if (strpos($scriptname, "popup") !== false || strpos($scriptname, "info_shopping_cart") !== false || strpos($scriptname, "printorder.php") !== false) {
     $display_normal_output = 1;
     $display_template_output = 0;
    }
    /////////////////////////////////////////  ERROR FIXED by Walo /////EOF/////
    */

     

    Is this right?

     

    If I uncomment it then it ends up showing me nothing - just a blank page. If I leave it commented, it just takes me back to my index page in my popup.

     

    Please help.

     

    - Nick

  5. I figured out #2 - so now we're stuck with #1...

     

    I went and commented out line 8, but then ended up with this error:

     

    [Sat Aug 14 22:26:47 2004] [error] PHP Parse error: ?parse error, unexpected '}' in /home/htdocs/users/me/me/store.sitename.com/catalog/includes/functions/header_tags.php on line 15

     

    So then I went and commented out that } and got:

     

    [Sat Aug 14 22:27:34 2004] [error] PHP Fatal error: ?Call to undefined function: ?clean_html_comments() in /home/htdocs/users/me/me/store.sitename.com/catalog/includes/functions/header_tags.php on line 14

     

    Well, as you can see, it's just the trickle down thing I think. Each time I made these changes, I couldn't get anything but a white page in my catalog.

     

    - Nick

  6. Please, I hope someone can help. I'm about to get rid of Linda's header tag thing cuz I can't figure out what's going on.

     

    I'm having two problems:

     

    1) I'm getting this error:

     

    [Sat Aug 14 21:40:31 2004] [error] PHP Fatal error:  Cannot redeclare tep_get_header_tag_products_title() (previously declared in /home/htdocs/users/me/me/store.sitename.com/catalog/includes/functions/header_tags.php:8) in /home/htdocs/users/me/me/store.sitename.com/catalog/includes/functions/header_tags.php on line 8

     

    Now, this was preventing my catalog/index.php page from showing up at all. But, I read about a workaround to comment an area in top and another area in btm and at least get it show up now. Though, it keeps throwing this error in the log file.

     

    So, that's issue number 1.

     

    2) My other issue has to do with product names. They're showing up on the individual pages when you click on the item in the store. However, they're being deleted/not showing up in the Admin area. There's text there (ex. ABC's New Video) but it's not showing up on the product name on top, nor is it showing on the main category page (above the price) like it was earlier before installing this mod.

     

    Please, anyone who can help, please please please...

     

    If preferred, feel free to IM me:

     

    ICQ: 306613606

    Yahoo: geminiskyguy

     

    Thank you,

     

    Nick

     

    07:50pm 8/14

  7. Okay, so I installed the FedEx1 Real Time Quotes contrib recently. Now I'm getting an error in the PHP but don't know how to fix it. This error is creating a situation where I'm not seeing ANY of my shipping modules in the admin.

     

    Any help (asap) would be most appreciated.

     

    Here's the most recent error:

     

    [Fri Aug 13 13:21:35 2004] [error] PHP Fatal error: ?Cannot redeclare class fedex1 in /home/htdocs/users/name/name/store.xyz.com/catalog/includes/modules/shipping/fedex1.php on line 15

     

    Line 15 & 16 of the code is:

     

     ?class fedex1 {
    ? ?var $code, $title, $description, $sort_order, $icon, $tax_class, $enabled, $meter, $intl;

     

    Please? Any help would be appreciated. We use FedEx for our only shipping option, so...

     

    By the way, if I change line 15 to "fedex" rather than "fedex1" my shipping components show up, but it says "MODULE_SHIPPING_FEDEX1_TEXT_TITLE" where the FedEx should be...

×
×
  • Create New...