Perl, MySQL and the Order API

This is an archive of old posting to the User Forum

Perl, MySQL and the Order API

Postby J Graham » Mon Jun 03, 2002 1:04 pm

Hi,

I was wondering if anyone has written a perl script using the Order API to
insert the order data into a MySQL database? It would be great to get all
the order info into a db I can easily access. A perl example (or PHP) would
be a great help!

Thanks,
-Jon

--
Jonathan Graham
www.homeworkout.com
J Graham
 

Re: Perl, MySQL and the Order API

Postby Barney Stone » Mon Jun 03, 2002 1:42 pm

If what you want is "all the order info into a db I can easily access", save
yourself a lot of time and money, and check out the Stone Edge Order Manager
for ShopSite at: http://stoneedge.com/OrderManager.htm

- Barney Stone, President
Stone Edge Technologies, Inc.
215-641-1837
www.ECommerceUtilities.com



"J Graham" <jkgraham@homeworkout.com> wrote in message
news:adgi4m$g0t$1@support.shopsite.com...
Hi,

I was wondering if anyone has written a perl script using the Order API to
insert the order data into a MySQL database? It would be great to get all
the order info into a db I can easily access. A perl example (or PHP)
would
be a great help!

Thanks,
-Jon

--
Jonathan Graham
www.homeworkout.com


Barney Stone
 

Re: Perl, MySQL and the Order API

Postby J Graham » Mon Jun 03, 2002 3:14 pm

Barney,

Unfortunately we can't afford that right now. Also, I don't need all of the
other functionality... I just want some way (automatic) to put all of the
Shopsite tables into a table I can access from my PHP scripts. If you have
a utility that can do that and be cronned then I would be interested.

Thanks,
-Jon


"Barney Stone" <barney@StoneEdge.com> wrote in message
news:adgk7b$g9e$1@support.shopsite.com...
If what you want is "all the order info into a db I can easily access",
save
yourself a lot of time and money, and check out the Stone Edge Order
Manager
for ShopSite at: http://stoneedge.com/OrderManager.htm

- Barney Stone, President
Stone Edge Technologies, Inc.
215-641-1837
www.ECommerceUtilities.com



"J Graham" <jkgraham@homeworkout.com> wrote in message
news:adgi4m$g0t$1@support.shopsite.com...
Hi,

I was wondering if anyone has written a perl script using the Order API
to
insert the order data into a MySQL database? It would be great to get
all
the order info into a db I can easily access. A perl example (or PHP)
would
be a great help!

Thanks,
-Jon

--
Jonathan Graham
www.homeworkout.com




J Graham
 

Re: Perl, MySQL and the Order API

Postby Switch Hits » Mon Jun 03, 2002 3:27 pm

Jon,

You do need the other functionality, you just don't realize it yet and won't until you use Order Manager on a daily basis. I would give up lunch for a few weeks and buy Order Manager. The time you spend trying to get what you want has to be worth something...invest now in Order Manager and I'll guarantee you'll thank me...and Barney.

Jimmy Hilburger
www.switchhits.com

(This is not a paid endorsement)


"J Graham" <jkgraham@homeworkout.com> wrote in message news:adgpnv$gqd$1@support.shopsite.com...
Barney,

Unfortunately we can't afford that right now. Also, I don't need all of the
other functionality... I just want some way (automatic) to put all of the
Shopsite tables into a table I can access from my PHP scripts. If you have
a utility that can do that and be cronned then I would be interested.

Thanks,
-Jon


"Barney Stone" <barney@StoneEdge.com> wrote in message
news:adgk7b$g9e$1@support.shopsite.com...
If what you want is "all the order info into a db I can easily access",
save
yourself a lot of time and money, and check out the Stone Edge Order
Manager
for ShopSite at: http://stoneedge.com/OrderManager.htm

- Barney Stone, President
Stone Edge Technologies, Inc.
215-641-1837
www.ECommerceUtilities.com



"J Graham" <jkgraham@homeworkout.com> wrote in message
news:adgi4m$g0t$1@support.shopsite.com...
Hi,

I was wondering if anyone has written a perl script using the Order API
to
insert the order data into a MySQL database? It would be great to get
all
the order info into a db I can easily access. A perl example (or PHP)
would
be a great help!

Thanks,
-Jon

--
Jonathan Graham
www.homeworkout.com




Switch Hits
 

Re: Perl, MySQL and the Order API

Postby loren_d_c » Mon Jun 03, 2002 4:22 pm

I've written one in Perl for PostgreSQL, using DBI, so it is probably pretty
much the same for MySQL. Below is a sample that shows the top of the file and
then some of the guts that includes connecting to the db, creating the SQL
insert, and then executing it. This is not the full thing, so it will not run
as-is, and may require you to install the proper perl modules on your server in
order to use it. It is also only storing 12 variables for each item ordered, and
is only using one table (so not really using the relational features of a good
SQL database server), but hopefully you'll get the idea. Have fun.

-Loren



#!/usr/bin/perl

use DBI;
use CGI qw(:standard);

# get all name value pairs into $formIn
my $formIn = new CGI;

....
<snip>
....

# connect to the postgres database called lstrans
$dbh = DBI->connect('dbi:Pg:dbname=lstrans', 'admin', undef, { RaiseError => 1,
AutoCommit => 1 });

# print loop to print each unique line item
for ($i = 0; $i < $uniqueitems; $i++){

# create the SQL statement to insert to the lstrans table called transactions
$sql = "INSERT INTO transactions VALUES ( '$orderid', '$siteid', '$timeentered

', '$timecompleted', '@skuarray[$i]', '@quantityarray[$i]', '@amountarray[$i]',

'$currency', '$email', '$paymenttype', '$zipcode', '@namearray[$i]' )";

# now do the SQL statement
$dbh->do($sql) || die("INSERT error: DBI::errstr");

# end the print loop
}

# close/disconnect from the database
$dbh->disconnect;




J Graham wrote:

Hi,

I was wondering if anyone has written a perl script using the Order API to
insert the order data into a MySQL database? It would be great to get all
the order info into a db I can easily access. A perl example (or PHP) would
be a great help!

Thanks,
-Jon

--
Jonathan Graham
www.homeworkout.com
loren_d_c
 
Posts: 2571
Joined: Fri Aug 04, 2006 12:02 pm
Location: Anywhere


Return to User Forum Archive

Who is online

Users browsing this forum: No registered users and 32 guests