Page 1 of 1

Trying to pass cart data to shipping .cgi script

PostPosted: Thu Feb 12, 2004 5:44 pm
by Bobby Beaulieu
Hi. I am trying to pass data from our SS6 cart to a shipping .cgi that I am
writing, but I get no data returned. In the example below, it just prints
the words cust_zip, followed by the price (456.00). I have already tried
preceding it with & and $ and enclosing it in {} and ' and everything else I
could think of. Anybody know how to pass any data at all from the cart to a
script? At this point I would settle for store id or locale, just to see
that data from the cart is being passed. Thanks in advance.


$zippy = 'cust_zip';

{
print "status=pass\noption_count=1\ns1option=$zippy\ns1price=456.00";
exit;
}

Re: Trying to pass cart data to shipping .cgi script

PostPosted: Thu Feb 12, 2004 5:48 pm
by loren_d_c
Is that the entire script? What scripting language is this using?

-Loren


Bobby Beaulieu wrote:
Hi. I am trying to pass data from our SS6 cart to a shipping .cgi that I am
writing, but I get no data returned. In the example below, it just prints
the words cust_zip, followed by the price (456.00). I have already tried
preceding it with & and $ and enclosing it in {} and ' and everything else I
could think of. Anybody know how to pass any data at all from the cart to a
script? At this point I would settle for store id or locale, just to see
that data from the cart is being passed. Thanks in advance.


$zippy = 'cust_zip';

{
print "status=pass\noption_count=1\ns1option=$zippy\ns1price=456.00";
exit;
}


Re: Trying to pass cart data to shipping .cgi script

PostPosted: Sat Feb 14, 2004 7:59 am
by David Clarke
This will help it writes every name value pair shop site passes into a file.
Be sure to get your path correct for the file name.
This script dosent send any html so if you try to hit it directly you will
get an error.
However, it works fine from the Order API - Custom CGI Location.

Good luck!
David Clarke

--- every thing after this line is the script --

#!/usr/bin/perl


$log_file_name = '../../../ss_test/ss_test.log';

open (LOGFILE, "+>> $log_file_name");
print LOGFILE ">>START\r\n";
&load_value_pairs;
print LOGFILE ">>END\r\n";
close LOGFILE;

1;

sub load_value_pairs {

if ($ENV{'REQUEST_METHOD'} eq 'GET') {@pairs = split(/&/,
$ENV{'QUERY_STRING'});}
if ($ENV{'REQUEST_METHOD'} eq 'POST') {read(STDIN, $buffer,
$ENV{'CONTENT_LENGTH'}); @pairs = split(/&/, $buffer); }

foreach $pair (@pairs)
{
local($name, $value) = split(/=/, $pair);
$name =~ tr/+/ /;
$name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
# Kill server side includes
$value =~ s/<!--(.|\n)*-->//g;
$FORM{$name} = $value;
print LOGFILE "$name\t$value\r\n";
}
}

--- end of script







"Bobby Beaulieu" <bobby@quickmedical.com> wrote in message
news:c0h37b$mfs$1@support.shopsite.com...
Hi. I am trying to pass data from our SS6 cart to a shipping .cgi that I
am
writing, but I get no data returned. In the example below, it just prints
the words cust_zip, followed by the price (456.00). I have already tried
preceding it with & and $ and enclosing it in {} and ' and everything else
I
could think of. Anybody know how to pass any data at all from the cart to
a
script? At this point I would settle for store id or locale, just to see
that data from the cart is being passed. Thanks in advance.


$zippy = 'cust_zip';

{
print "status=pass\noption_count=1\ns1option=$zippy\ns1price=456.00";
exit;
}