/
proddispfixed.php
227 lines (197 loc) · 5.83 KB
/
proddispfixed.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
<?php /*
FishCart: an online catalog management / shopping system
Copyright (C) 1997-2002 FishNet, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA.
N. Michael Brennen
FishNet(R), Inc.
850 S. Greenville, Suite 102
Richardson, TX 75081
http://www.fni.com/
mbrennen@fni.com
voice: 972.669.0041
fax: 972.669.8972
This file displays product info to the previously opened file handle
in fixed space format; it is used typically for offline Web page
orders, as well as email orders and confirmations.
*/
// SQL INJECTION AVOIDENCE
$zid=(int) $zid;
$lid=(int) $lid;
$esdid=(int) $esdid;
$body .= "\n";
if( empty($contrib_only) && empty($payment_total) ){
$body .= fc_text('itemcapfix').fc_text('qtycapfix').fc_text('pricecapfix').fc_text('productcapfix')."\n";
$fco = new FC_SQL;
$fcp = new FC_SQL;
$fpo = new FC_SQL;
$fps = new FC_SQL;
$fco->query("select subz from ohead where orderid='$cartid'");
$fco->next_record();
$subz=$fco->f("subz");
$fco->free_result();
if( !empty($subz) ){
$fco->query("select subzdescr from subzone where subzsid=$subz");
$fco->next_record();
$subzdescr=$fco->f("subzdescr");
$fco->free_result();
}else{
$subzdescr='';
}
$tqty=0;
$fco->query("select sku,compsku,qty,olid from oline where orderid='$cartid'");
while($fco->next_record()){
$qty=$fco->f("qty");
$sku=$fco->f("sku");
$csku=$fco->f("compsku");
$olid=(int)$fco->f("olid");
$fcp->query("select prodflag1 from prod ".
"where prodzid=$zid and prodsku='$sku'");
$fcp->next_record();
$flag1=(int)$fcp->f("prodflag1");
$fcp->free_result();
//BJH
$fcp->query("select prodname,installinst from prodlang ".
"where prodlzid=$zid and prodlid=$lid and prodlsku='$sku'");
$fcp->next_record();
// strip any HTML tags
$dsc=ereg_replace("<[^>]+>"," ",$fcp->f("prodname"));
$dsc=substr($dsc,0,35);
$installinst=$fcp->f("installinst");
//$installinst=substr($installinst,0,35);
$fcp->free_result();
// accumulate $popttotal, $poptsettot
while( get_prodopts($csku) ){
}
// figure options modified product price, accumulate $prodsetttot
// sets various globals
$prodprice = prod_price ( $sku );
$ltotal = line_total( $qty, $prodprice );
$tqty=rnd($tqty+$qty);
if( $csku ){
$body .=sprintf("\n%10s",$csku); // ProductNumber
}else{
$body .=sprintf("\n%10s",$sku); // ProductNumber
}
$body.=' ';
$body.=sprintf("%3d",$qty); // Quantity
$body.=' ';
$body.=sprintf("%8.2f",$ltotal); // ExtPrice
$body.=' ';
$body.=sprintf("%s",$dsc); // Description
$body.="\n";
// BJH
if($installinst !=''){
$body.="\n";
$body.=sprintf("%s",$installinst); // Installation Instructions
$body.="\n";
}
// now display the product options
if( $sku != $csku ){
$body .= fc_text('basepricefix').sprintf("%s%.2f\n",$csym,$prodbaseprice);
}
while( get_prodopts($csku) ){
$body .= fc_text('optionfix').$poptname."\n";
if($poptqty){
$body .=
fc_text('qtyfix').$poptqty."\n".
fc_text('totalfix').sprintf("%s%.2f\n",$csym,$poptextension);
}else{
$body .=
fc_text('totalfix').sprintf("%s%.2f\n",$csym,$poptextension);
}
if($poptsetup){
$body .=
fc_text('setupfix').sprintf("%s%.2f\n",$csym,$poptsetup);
}
}
if( $flag1 & $flag_useesd ){
// get esd record
$fcp->query(
"select esdid from esd where esdolid=$olid and esdoid='$cartid'");
if( $fcp->next_record() ){
$esdid=(int)$fcp->f("esdid");
}else{
$esdid=0;
}
$fcp->free_result();
$body.="<a href=\"${nsecurl}${cartdir}".
"/esdsend.php?esdid=${esdid}\">".fc_text('download')."</a>\n";
}
}
$fco->free_result();
$body .= "\n";
if( $prodsettot ){
$body .= fc_text('setuptotalfix').sprintf("%8.2f\n",$prodsettot);
}
if( $zflag1 & $flag_zonecoupon ){
if( $cpndisc > 0 ){
$body .= fc_text('discountfix').sprintf("%8.2f\n",$cpndisc);
}
}
if($stotal){
$body .= fc_text('subtotalfix').sprintf("%8.2f\n",$stotal);
$body .= fc_text('shippingfix').sprintf("%8.2f %s\n",$shamt,$shipdescr);
} // if stotal
$staxn=(double)$staxn;
$staxs=(double)$staxs;
if($staxn){
if( $staxcmtn ){
$body .= sprintf(" %9s: %8.2f\n",$staxcmtn,$staxn);
}else{
$body .= fc_text('salestaxfix').sprintf("%8.2f\n",$staxn);
}
}
if($staxs){
if( $staxcmts ){
$body .= sprintf(" %9s: %8.2f\n",$staxcmts,$staxs);
}else{
$body .= fc_text('salestaxfix').sprintf("%8.2f\n",$staxs);
}
}
} // end of contrib_only
if($contamt>0){
$body .= fc_text('contributefix').sprintf("%8.2f\n",$contamt);
}
if( !empty($payment_only) ){
$body .= fc_text('paymentfix').sprintf("%8.2f\n",$payment);
}
if( empty($contrib_only) && empty($payment_only) && $ttotal ){
$body .= fc_text('ordertotalfix').sprintf("%8.2f\n",$ttotal);
}
if( $ttotal && $ptotal){
$body .= "\n";
}
if($mtotal){
$body .= fc_text('psubtotalfix').sprintf("%8.2f\n",$mtotal);
}
$pstaxn=(double)$pstaxn;
$pstaxs=(double)$pstaxs;
if($pstaxn){
if( $staxcmtn ){
$body .= sprintf(" %9s: %8.2f\n",$staxcmtn,$pstaxn);
}else{
$body .= fc_text('psalestaxfix').sprintf("%8.2f\n",$pstaxn);
}
}
if($pstaxs){
if( $staxcmts ){
$body .= sprintf(" %9s: %8.2f\n",$staxcmts,$pstaxs);
}else{
$body .= fc_text('psalestaxfix').sprintf("%8.2f\n",$pstaxs);
}
}
if( empty($contrib_only) && empty($payment_only) && $ptotal ){
$body .= fc_text('ptotalfix').sprintf("%8.2f\n",$ptotal);
}
?>