-
Notifications
You must be signed in to change notification settings - Fork 0
/
preview.php
239 lines (212 loc) · 6.97 KB
/
preview.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
228
229
230
231
232
233
234
235
236
237
238
239
<?php
if (!$functions_inc){
require('./functions.php');
// ========== start of variable loading ==========
// load passed variables and cookie variables
// int or double cast the numbers, no exceptions
// custid cookie is mime encoded, don't escape
$CookieCustID = getcookie("Cookie${instid}CustID");
$CookieCart = getcookie("Cookie${instid}Cart");
$cartid=getparam('cartid');
$zid = (int)getparam('zid');
$lid = (int)getparam('lid');
$subz = (int)getparam('subz');
$cat = (int)getparam('cat');
// ========== end of variable loading ==========
if( !$pub_inc ){ require('./public.php'); }
if( !$cartid_inc ){ require('./cartid.php'); }
if( !$flags_inc ){ require('./flags.php'); }
if( !$lang_inc ){ require('./languages.php'); }
} // end functions_inc
$pre1 = new FC_SQL;
$pre2 = new FC_SQL;
$pre3 = new FC_SQL;
$pre4 = new FC_SQL;
$pre5 = new FC_SQL;
$pre6 = new FC_SQL;
// get the language templates
$pre7=new FC_SQL;
$pre7->Auto_free=1;
$pre7->query(
"select langgeo,langshow,langordr from lang where langid=$lid");
// echo "select langgeo,langshow,langordr from lang where langid=$lid";
$pre7->next_record();
$pregeo=$pre7->f("langgeo");
$preshow=$pre7->f("langshow");
$preordr=$pre7->f("langordr");
$pre7->free_result();
$pre8 = new FC_SQL; // order table
$pre8->Auto_commit = 1;
$now=time();
$pre8->query("select * from oline where orderid='$cartid'");
if($pre8->next_record()){
?>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr><td>
<table class="text" align="left" cellpadding="1" cellspacing="1" bgcolor="#CCCCCC" width="100%">
<tr><td class="subdivrow" colspan="2" align="center" valign="top" bgcolor="#CCCCCC">
<font face="Arial,Helvetica" size="1">
<b><?php echo fc_text('product'); ?></b>
</font>
</td><!--td class="subdivrow" align="center" valign="top" bgcolor="#CCCCCC">
<font face="Arial,Helvetica" size="1">
<b><?php echo fc_text('total'); ?></b>
</font>
</td--></tr>
<?php
$i=0;
$tqty=0;
$pre10 = new FC_SQL;
$pre11 = new FC_SQL;
do{ // already have the first record
$sku=$pre8->f("sku");
$csku=$pre8->f("compsku");
$qty=$pre8->f("qty");
$invover=(int)$pre8->f("invover");
$olzone=(int)$pre8->f("olzone");
$ollang=(int)$pre8->f("ollang");
// get the short product description
$pre10->query("select prodname from prodlang ".
"where prodlzid=$olzone and prodlid=$ollang and prodlsku='$sku'");
if(!$pre10->next_record()){
$pre11->query("delete from oline where orderid='$cartid'");
continue;
}
$sdescr=stripslashes(ereg_replace("<[^>]+>"," ",$pre10->f("prodname")));
$pre10->free_result();
$pre10->query(
"select prodprice,prodsetup,prodweight,prodflag1 from prod ".
"where prodzid=$olzone and prodsku='$sku'");
if(!$pre10->next_record()){
$pre11->query("delete from oline where orderid='$cartid'");
continue;
}
$prodprice=(double)$pre10->f("prodprice");
$prodsetup=(double)$pre10->f("prodsetup");
$prodweight=(double)$pre10->f("prodweight");
$flag1=(int)$pre10->f("prodflag1");
$pre10->free_result();
?>
<tr><td class="previewcell" colspan="2" align="left" valign="top" bgcolor="#FFFFFF">
<font face="Arial,Helvetica" size="1">
<?php
echo "<b>".$sdescr."</b><br />\n".
sprintf("%s %d<br />\n",fc_text('qty'),$qty);
// retrieve product options, accumulate $popttotal, $poptsetttot
if( $sku != $csku && $prodprice ){
echo sprintf("%s %s%.2f<br />\n",fc_text('price'),$csym,$prodprice);
if( $prodsetup ){
echo sprintf("%s %s%.2f<br />\n",fc_text('setup'),$csym,$prodsetup);
}
}
while( get_prodopts($csku) ){
echo fc_text('option').' '.$poptname."<br />\n";
if($poptqty){
echo ' '.
fc_text('qty').' '.$poptqty."<br />\n";
if( $poptextension ){
echo ' '.fc_text('total').
' '.sprintf("%s%.2f",$csym,$poptextension)."<br />\n";
}
}elseif($poptextension){
echo ' '.fc_text('total').' '.
sprintf("%s%.2f",$csym,$poptextension)."<br />\n";
}
if($poptsetup){
// for one time product setup regardless of qty, comment the line below
$poptsetup=$poptsetup*$poptqty;
echo " ".fc_text('setup').' '.
sprintf("%s%.2f",$csym,$poptsetup)."<br />\n";
}
// echo "<br />\n";
}
?>
</font>
</td>
<!--td class="previewcell" align="right" valign="top" bgcolor="#FFFFFF">
<font face="Arial,Helvetica" size="1">
<?php
// figure options modified product price, accumulate $prodsetttot
// sets various globals
$prodprice = prod_price ( $sku );
// if(!$prodprice){ $prodprice=$webfree; }
$ltotal=line_total( $qty, $prodprice );
// $ltotal=rnd($ltotal+$prodsetup);
printf("%s %s%.2f<br>",fc_text('total'),$csym,$ltotal);
if( $prodsetup ){
// for one time product setup regardless of qty, comment the line below
$prodsetup=$prodsetup*$qty;
printf("%s %s%.2f<br />",fc_text('setuptotal'),$csym,$prodsetup);
$prodsettot=rnd($prodsettot+$prodsetup);
}
$tqty=rnd($tqty+$qty);
//$lweight=rnd($qty * $prodweight);
if( $flag1 & $flag_persvc ){
//$mstotal=rnd($mstotal+$ltotal);
//$mtotal=rnd($mtotal+$ltotal);
$ptotal=rnd($ptotal+$ltotal);
}else{
//$wtotal=rnd($wtotal+$lweight);
//$pstotal=rnd($pstotal+$ltotal);
$stotal=rnd($stotal+$ltotal);
}
?>
</font>
</td--></tr>
<?php
$i++;
} while($pre8->next_record()); /* end of product display while loop */
?>
<?php if( $prodsettot ){ ?>
<tr><td class="previewcell" colspan="1" align="left" valign="top" bgcolor="#FFFFFF">
<font face="Arial,Helvetica" size="1">
<b><?php echo fc_text('setupfees'); ?></b><br />
</font>
</td><td class="previewcell" colspan="1" align="right" valign="top" bgcolor="#FFFFFF">
<font face="Arial,Helvetica" size="1">
<?php
printf("%s%.2f<br />",$csym,$prodsettot);
// accumulate setup into order total
$stotal=rnd($prodsettot+$stotal);
?>
</font>
</td></tr>
<?php
}
if( $zflag1 & $flag_zonecoupon ){
// $stotal is the discounted product subtotal
$cpndisc=coupon_discount($couponid,$stotal,$tqty);
if( $cpndisc > 0 ){
$shipsubtotal=rnd($shipsubtotal - $cpndisc);
$taxsubtotal=rnd($taxsubtotal - $cpndisc);
$stotal=rnd($stotal - $cpndisc);
$ototal=rnd($ototal - $cpndisc);
?>
<tr><td class="previewcell" colspan="1" align="left" valign="top" bgcolor="#FFFFFF">
<font face="Arial,Helvetica" size="1">
<b><?php echo fc_text('coupondisc'); ?></b><br />
</font>
</td><td class="previewcell" colspan="1" align="right" valign="top" bgcolor="#FFFFFF">
<font face="Arial,Helvetica" size="1">
<?php printf("%s%.2f<br />",$csym,$cpndisc); ?>
</font>
</td><td class="previewcell" colspan="1" align="right" valign="top" bgcolor="#FFFFFF">
<font face="Arial,Helvetica" size="1">
<?php
}
} // flag_zonecoupon ?>
<?php // if( $stotal ){ ?>
<tr><td class="previewcell" colspan="1" align="left" valign="top" bgcolor="#FFFFFF">
<font face="Arial,Helvetica" size="1">
<b><?php echo fc_text('subtotal'); ?></b>
</font>
</td><td class="previewcell" colspan="1" align="right" valign="top" bgcolor="#FFFFFF">
<font face="Arial,Helvetica" size="1">
<?php printf("%s%.2f<br />",$csym,$stotal); ?>
</font>
</td></tr>
</table>
</td></tr></table>
<?php // } // if stotal
} // if($olc>0)
?>