WN

WN (https://www.wn.se/forum/index.php)
-   E-kommers (https://www.wn.se/forum/forumdisplay.php?f=10)
-   -   Strul med utcheckning i osc (STS & Kreditor) (https://www.wn.se/forum/showthread.php?t=12292)

Spinn 2006-02-09 13:17

T.ex. om kunden nekas köp eller om adressen inte stämmer så får kunden ingen info om detta, utan backas bara tillbaka.
Jag använder Kreditors modul som fungerar ypperligt annars och sts (template från 7dana). Fler som haft det problemet?

Jag tror att jag ska leta upp en kodsnutt i filen sts_display_outut.php och ändra men jag hittar inte kodsnutten.

P.S. Rubrik och underrubrik innehåller info. :)

Spinn 2006-02-10 07:54

Ingen som kör denna kombination?

mellow 2006-02-10 15:34

Jo, jag gör det. Om du läser readme-filen som du får med modulen så står allt förklarat under 2.1 - STS (STS FIX - For displaying error messages during the checkout process). Säg till om du inte hittar.

bompaholm 2006-03-04 13:00

Har samma problem och hittar inte lösningen. Kan du skicka länk?

polecat69 2006-03-04 13:28

Exakt så här står det i readme filen på kreditors modul

------------------------
STS FIX - For displaying error messages during the checkout process

Ian, Patrick, Deborah:

This fix should solve your problem with the credit class/gift voucher
contribution not displaying a coupon code error during checkout. I
just tried this code and it works great. You can thank Tom Thumb, who
used to frequent the STS forum. This STS fix should solve problems
with any contribution that is supposed to display error messages
during checkout (including Authroize.Net concolidated for AIM 1.7):

Look for this in includes/sts_display_output.php:

CODE
// Prepend any error/warning messages to $content
if ($messageStack->size('header') > 0) {
$template['content'] = $messageStack->output('header') . $template['content'];
}


Add this right after it:

CODE
////////Start Error Messages - Tom Wojcik
if (isset($HTTP_GET_VARS['error_message']) && tep_not_null($HTTP_GET_VARS['error_message'])) {
$messageStack->add('error_message', $HTTP_GET_VARS['error_message']);
$template['content'] = $messageStack->output('error_message') . $template['content'];
}
////// End Error Messages


Let me know if this works for you. I think this code would be worth
adding to the next version of STS.
---------------------

Spinn 2006-03-04 14:54

Jag har inte heller fått det att fungera. Hittar inte kodsnutten jag ska leta upp. Så min fråga är. Vilken rad ska den finnas på?

polecat69 2006-03-04 15:56

på rad ~297

Sök i filen efter "Get Categories" ett par rader ovanför är koden du har letat efter.

Spinn 2006-03-04 16:09

Jag hittar fortfarande inte koden. Om någon hittar den här så utser jag mig härmed till "dagens nöt" :)

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

Citat:


<?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 © 2003 osCommerce

Released under the GNU General Public License
*/

/*

Simple Template System (STS) - Copyright © 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";

echo "<!-- Page layout by Simple Template System (STS) v$sts_version on $sts_osc_version - http://www.diamondsea.com/sts/ -->\n";

// 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;

// 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) {
$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
/////////////////////////////////////////////

/////////////////////////////////////////////
////// Capture <title> and <meta> tags
/////////////////////////////////////////////

// STS: ADD: Support for WebMakers.com's Header Tag Controller contribution
// Capture the output
require(STS_START_CAPTURE);

// 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>";
}
// 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'] = '' . tep_image(DIR_WS_IMAGES . 'logga1.gif', 'gravtest.se') . '';
$template['urlcataloglogo'] = tep_href_link(FILENAME_DEFAULT);

$template['myaccountlogo'] = '' . tep_image(DIR_WS_IMAGES . 'header_account.gif', HEADER_TITLE_MY_ACCOUNT) . '';
$template['urlmyaccountlogo'] = tep_href_link(FILENAME_ACCOUNT, '', 'SSL');

$template['cartlogo'] = '' . tep_image(DIR_WS_IMAGES . 'header_cart.gif', HEADER_TITLE_CART_CONTENTS) . '';
$template['urlcartlogo'] = tep_href_link(FILENAME_SHOPPING_CART);

$template['checkoutlogo'] = '' . tep_image(DIR_WS_IMAGES . 'header_checkout.gif', HEADER_TITLE_CHECKOUT) . '';
$template['urlcheckoutlogo'] = tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL');

$template['breadcrumbs'] = $breadcrumb->trail(' &raquo; ');

if (tep_session_is_registered('customer_id')) {
$template['myaccount'] = '' . HEADER_TITLE_MY_ACCOUNT . '';
$template['urlmyaccount'] = tep_href_link(FILENAME_ACCOUNT, '', 'SSL');
$template['logoff'] = '' . HEADER_TITLE_LOGOFF . '';
$template['urllogoff'] = tep_href_link(FILENAME_LOGOFF, '', 'SSL');
$template['myaccountlogoff'] = $template['myaccount'] . " | " . $template['logoff'];
} else {
$template['myaccount'] = '' . HEADER_TITLE_MY_ACCOUNT . '';
$template['urlmyaccount'] = tep_href_link(FILENAME_ACCOUNT, '', 'SSL');
$template['logoff'] = '';
$template['urllogoff'] = '';
$template['myaccountlogoff'] = $template['myaccount'];
}

$template['cartcontents'] = '' . HEADER_TITLE_CART_CONTENTS . '';
$template['urlcartcontents'] = '' . HEADER_TITLE_CART_CONTENTS . '';

$template['checkout'] = '' . HEADER_TITLE_CHECKOUT . '';
$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_que ry)) {
$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 "template[" . $categories_description['categories_name'] . "]=" . $template[$categories_description['categories_name']] . "
template[" . $path . "]=" . $template[$path] . "
";
}

/////////////////////////////////////////////
////// 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 . "]
\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 "\$sts_block['$key']<hr>" . htmlspecialchars($value) . "<hr>\n";
}

foreach ($template as $key=>$value) {
print "\$template['$key']<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;
}

?>


polecat69 2006-03-04 16:28

Japp, jag ser den..

I detta kodstycke

/////////////////////////////////////////////
////// 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'];

Spinn 2006-03-04 16:32

Wow, tack! Så blind jag var... och härmed en nöt. :lol:
Otroligt tacksam!!


Alla tider är GMT +2. Klockan är nu 22:09.

Programvara från: vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Svensk översättning av: Anders Pettersson