checkout.pl HTML output?

Get help with nopcart formatting or style related issues.

Moderators: Koibito, Stefko, Randy

checkout.pl HTML output?

Postby SignsInTheMaking » Tue Jun 24, 2008 8:35 pm

I am redoing my bosses website and most of it is finally done. i just wanted to know if its possible to have the order info that is sent via email (when they hit submit) sent out in an html form instead of plain text. He wants it formatted similar to the order forms that we have in store when he gets the email in the sense that he can print it and just add it to our files instead of having to copy the orders onto another form by hand.

-Nathan
SignsInTheMaking
WebMaster
 
Posts: 2
Joined: Tue Jun 24, 2008 8:22 pm

Re: checkout.pl HTML output?

Postby Koibito » Wed Jun 25, 2008 2:07 am

Yes, that is possible. You'll have to experiment a little with inserting the <tr> and <td> elements at the right place in the Perl script.

You also have to change the mail headers somewhat, so that the script sends out html-formatted e-mail instead of plain text:

Code: Select all
   open (MAIL,"|$mailprogram");
   print MAIL "To: $youremail\n";
   print MAIL "From: $b_email\n";
   print MAIL "Subject: New Online Order\n";
   print MAIL "MIME-Version: 1.0\n";
   print MAIL "Content-Type: text/html; charset=ISO-8859-1\n";
   print MAIL "\n\n";
John
Koibito
Site Admin / Guru
 
Posts: 918
Joined: Sun May 28, 2006 1:59 am
Location: New Jersey, USA

Re: checkout.pl HTML output?

Postby Stefko » Wed Jun 25, 2008 5:24 pm

To follow-up on what John said, you can place your HTML directly into the PERL script and any vars without any special coding.

Code: Select all
print qq~

...HTML CODE HERE
...
...
Your <b>TOTAL AMOUNT DUE is $TOTAL</b>
...
...

~;
KFL Technologies
Web-Enabled Solutions
e-Commerence Solutions
Stefko
Contributor / Guru
 
Posts: 833
Joined: Wed Sep 18, 2002 1:11 am
Location: Wichita, KS

Re: checkout.pl HTML output?

Postby SignsInTheMaking » Thu Jul 03, 2008 3:48 pm

I was thinking along the lines of a formatted email that looks identical to our office order forms and having the script fill in the blanks etc so we can just print and add to our records
SignsInTheMaking
WebMaster
 
Posts: 2
Joined: Tue Jun 24, 2008 8:22 pm

Re: checkout.pl HTML output?

Postby Stefko » Fri Jul 04, 2008 5:49 am

Well I would recommend you do some studying of PURL Formatting.

PURL was written as a word processing script, so easy enough right, WRONG !
You'll need to understand how Formatting works, here is an snippet of a script I wrote for a client who needed values formatted for another off-server program to read.



Code: Select all
$d="d";
$t="t";
$Version="7.0.0";

if($fileMode eq "live"){
$path = "/u/web/citysa/Orders/"; # Path for the Orders DIR
}
if($fileMode eq "test"){
$path = "/u/web/citysa/StaticCart/cgi-bin/"; # Test Path for the Orders Text File
}

$myfile = qq~$path$b_accountCode$d$mymonth$day$year$t$hour$min$sec.txt~;

use Fcntl; #The Module


sysopen (TEXT, $myfile, O_RDWR|O_EXCL|O_CREAT, 0755);
close (TEXT);

open(MYORDER,">$myfile") or die "Can't open up file: $!\n";


# and this page header format will automatically apply to MYFILE
format MYORDER_TOP =
Company-@<<<<<<<<<<<<<<<<<<< Account#-@<<<<<<<< Version-@<<<<<<<<<<<<<<
        $b_company,                              $b_accountCode,                   $Version
@<<<<<<<<<<<<<<<<<<<<<  Memo Code-@<<< PO#-@<<<<<<<<<<<<<
$filedate,    $mc,    $b_po

@<<<<<<<<< @>>> @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
"Item #","Qty","Item Description","Sell Unit"
.

format MYORDER =
@<<<<<<<<< @>>> @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
${$ide},   ${$qnt},${$naam},                                   ${$adlinfo}
.

format MYORDER_BOTTOM =

Item Total = @<<<< Qty Total = @<<<<
             $x-1,               $WEIGHT
¤http://citysales.com/     @<<<<<<<<<<<<<<<<<<<<<<
                            $db_update
.
   for($y=1;$y<=100;$y++){
      $thename="NAME_$y";
         if(length(${$thename})>3){
         $num5++;
      }
   }
   foreach($x=1; $x<=$num5; $x++){
      $qnt="QUANTITY_$x";
      $prce="PRICE_$x";
      $xtnd="XTEND_$x";
      $ide="ID_$x";
      $naam="NAME_$x";
      $adlinfo="ADDTLINFO_$x";
      ${$naam}=~ s/\n//g;

write MYORDER;
}

select((select(MYORDER), $~ = "MYORDER_BOTTOM")[0]);
write(MYORDER);

close(MYORDER);


This is placing the words where they are required for another program to read, but it could be used to print out on a pre-printed invoice or statement. Here is the output:

Code: Select all
Company-Dougs Corner Store   Account#-123456    Version-7.0.0
01/15/2008 07:40:51     Memo Code-00     PO#-12875

Item #      Qty Item Description                         Sell Unit
880245        1 CRUSH FRZ ORNGEDREAM BIB                 1/5GAL
883025        2 SLUSH PUPPIE BASE BIB CLEAR CHERRY 5/GA  5/GAL
882886        3 THELMAS LEMONADE BIB 2.5GAL              1/EACH

Item Total = 3     Qty Total = 6
¤http://citysales.com/     2007-10-19 12:08:54
KFL Technologies
Web-Enabled Solutions
e-Commerence Solutions
Stefko
Contributor / Guru
 
Posts: 833
Joined: Wed Sep 18, 2002 1:11 am
Location: Wichita, KS

Re: checkout.pl HTML output?

Postby Tom4us » Fri Jul 04, 2008 7:26 am

Can it also be done to the checkout.php, if anybody has explanation please .
Tom4us
Guru
 
Posts: 55
Joined: Fri Feb 07, 2003 11:02 am
Location: Kenya

Re: checkout.pl HTML output?

Postby Koibito » Mon Jul 07, 2008 6:01 pm

Tom4us wrote:Can it also be done to the checkout.php, if anybody has explanation please .


Yes, but you have to add this to the mail headers;

Code: Select all
$mailheaders . = 'MIME-Version: 1.0' . "\r\n";
$mailheaders .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";


I think that it would be easiest to put $strMessageBody in a table, so you would have to experiment a little with the <tr> and <td> elements.
John
Koibito
Site Admin / Guru
 
Posts: 918
Joined: Sun May 28, 2006 1:59 am
Location: New Jersey, USA

Re: checkout.pl HTML output?

Postby transmutator » Wed Jul 23, 2008 9:48 pm

Would this process work then for the output to the web page?
transmutator
WebMaster
 
Posts: 2
Joined: Mon Jul 21, 2008 7:26 pm

Re: checkout.pl HTML output?

Postby Koibito » Wed Jul 23, 2008 10:57 pm

transmutator wrote:Would this process work then for the output to the web page?


The webpage output already is in an HTML table.
John
Koibito
Site Admin / Guru
 
Posts: 918
Joined: Sun May 28, 2006 1:59 am
Location: New Jersey, USA

Re: checkout.pl HTML output?

Postby floridamary4 » Fri Apr 10, 2009 1:49 pm

thanks for sharing :)

web design chennai
floridamary4
WebMaster
 
Posts: 1
Joined: Fri Apr 10, 2009 1:45 pm


Return to Help: Formatting and Style

Who is online

Users browsing this forum: No registered users and 0 guests