Datum tijd
Sinds kort verdiep ik mij in php, en dan met name om pagina's meer naar mijn hand te zetten.
Nu ben ik bezig met een webshop en toen liep ik tegen Zingiri webshop aan, wat echt een hele leuke webshop is, maar ik kan daar niet een datum en tijd van afhalen instellen. Nu vond ik een leuk script wat ik graag zou willen gebruiken, het probleem is echter dat ik niet de output naar de template voor elkaar krijg.
Ik ben al 3 dagen met dreamweaver aan het "klooien" en krijg het niet voor elkaar :(
Heel concreet:
* Hoe laad ik datumtijd.php in de onecheckout.php?
* Hoe laat ik de input van datumtijd.php zien in de template?
Hartelijk dank voor jullie hulp
Gewijzigd op 10/03/2011 14:01:08 door Rick -
Rick - op 10/03/2011 13:40:42:
Helemaal top, maar nu de output naar de template? dan is het probleem opgelost :)
post anders eens de code van de template waar je hem wilt hebben
Rick - op 10/03/2011 13:44:14:
post anders eens de code van de template waar je hem wilt hebben
Zelf zat ik te denken aan :
en dan in de template een [DATUMTIJD] te zetten.
als je dat wilt natuurlijk
Gewijzigd op 10/03/2011 13:50:06 door Rick -
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
/* onecheckout.php
Copyright 2008,2009,2010 Erik Bogaerts
Support site: http://www.zingiri.com
This file is part of Zingiri Web Shop.
Zingiri Apps 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.
Zingiri Apps 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 Zingiri Web Shop; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
?>
/* onecheckout.php
Copyright 2008,2009,2010 Erik Bogaerts
Support site: http://www.zingiri.com
This file is part of Zingiri Web Shop.
Zingiri Apps 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.
Zingiri Apps 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 Zingiri Web Shop; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
?>
Code (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
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
<?php
if (loggedin()) {
if (!empty($_POST['numprod'])) {
$numprod=intval($_POST['numprod']);
}
if (!empty($_REQUEST['paymentid'])) {
$paymentid=intval($_REQUEST['paymentid']);
}
if (!empty($_REQUEST['basketid'])) {
$basketid=intval($_REQUEST['basketid']);
}
if (!empty($_POST['conditions']) && $_POST['conditions']=="on") {
$conditions=true;
}
if (!empty($_POST['notes'])) {
$notes=$_POST['notes'];
}
if (!empty($_GET['prodid'])) {
$prodid=intval($_GET['prodid']);
if (!empty($_POST['numprod'][$basketid])) $numprod=$_POST['numprod'][$basketid];
}
if (isset($_REQUEST['shipping'])) {
list($weightid, $shippingid) = explode(":", $_REQUEST['shipping']);
$weightid=intval($weightid);
$shippingid=intval($shippingid);
$wsShipping=$weightid.':'.$shippingid;
}
if (isset($_POST['discount_code'])) {
$discount_code=$_POST['discount_code'];
if ($discount_code <> "") {
$discount=new wsDiscount($discount_code);
if (!$discount->exists()) {
PutWindow($gfx_dir, $txt['general12'], $txt['checkout1'], "warning.gif", "50");
$error = 1;
}
}
}
// current date
$today = getdate();
$error = 0; // no errors found
if ($action=="delete"){
$query = "DELETE FROM `".$dbtablesprefix."basket` WHERE `CUSTOMERID` = '". wsCid()."' AND `STATUS` = '0' AND `ID` = '". $basketid."'";
$sql = mysql_query($query) or die(mysql_error());
} elseif ($action=="update"){
// if we work with stock amounts, then lets check if there is enough in stock
if ($stock_enabled == 1) {
$query = "SELECT `STOCK` FROM `".$dbtablesprefix."product` WHERE `ID` = '".$prodid."'";
$sql = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_row($sql);
if ($numprod > $row[0] || $row[0] == 0) {
PutWindow($gfx_dir, $txt['general12'], $txt['checkout15']."<br />".$txt['checkout7']." ".$numprod."<br />".$txt['checkout8']." ".$row[0], "warning.gif", "50");
$error = 1;
}
}
if ($error == 0) {
$query = "UPDATE `".$dbtablesprefix."basket` SET `QTY` = ".$numprod." WHERE `CUSTOMERID` = '". wsCid()."' AND `STATUS` = '0' AND `ID` = '". $basketid."'";
$sql = mysql_query($query) or die(mysql_error());
}
}
CheckoutShowProgress();
//shipping start
$cart_weight = WeighCart(wsCid());
//check if combined shipping and weight is applicable
if ($shippingid && $weightid) {
$weight_query = "SELECT * FROM `".$dbtablesprefix."shipping_weight` WHERE '".$cart_weight."' >= `FROM` AND '".$cart_weight."' <= `TO` AND `SHIPPINGID` = '".$shippingid."'";
$weight_sql = mysql_query($weight_query) or zfdbexit($weight_query);
if ($row_weight=mysql_fetch_array($weight_sql)) {
$weightid=$row_weight['ID'];
} else {
$weightid='';
$shippingid='';
}
}
?>
if (loggedin()) {
if (!empty($_POST['numprod'])) {
$numprod=intval($_POST['numprod']);
}
if (!empty($_REQUEST['paymentid'])) {
$paymentid=intval($_REQUEST['paymentid']);
}
if (!empty($_REQUEST['basketid'])) {
$basketid=intval($_REQUEST['basketid']);
}
if (!empty($_POST['conditions']) && $_POST['conditions']=="on") {
$conditions=true;
}
if (!empty($_POST['notes'])) {
$notes=$_POST['notes'];
}
if (!empty($_GET['prodid'])) {
$prodid=intval($_GET['prodid']);
if (!empty($_POST['numprod'][$basketid])) $numprod=$_POST['numprod'][$basketid];
}
if (isset($_REQUEST['shipping'])) {
list($weightid, $shippingid) = explode(":", $_REQUEST['shipping']);
$weightid=intval($weightid);
$shippingid=intval($shippingid);
$wsShipping=$weightid.':'.$shippingid;
}
if (isset($_POST['discount_code'])) {
$discount_code=$_POST['discount_code'];
if ($discount_code <> "") {
$discount=new wsDiscount($discount_code);
if (!$discount->exists()) {
PutWindow($gfx_dir, $txt['general12'], $txt['checkout1'], "warning.gif", "50");
$error = 1;
}
}
}
// current date
$today = getdate();
$error = 0; // no errors found
if ($action=="delete"){
$query = "DELETE FROM `".$dbtablesprefix."basket` WHERE `CUSTOMERID` = '". wsCid()."' AND `STATUS` = '0' AND `ID` = '". $basketid."'";
$sql = mysql_query($query) or die(mysql_error());
} elseif ($action=="update"){
// if we work with stock amounts, then lets check if there is enough in stock
if ($stock_enabled == 1) {
$query = "SELECT `STOCK` FROM `".$dbtablesprefix."product` WHERE `ID` = '".$prodid."'";
$sql = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_row($sql);
if ($numprod > $row[0] || $row[0] == 0) {
PutWindow($gfx_dir, $txt['general12'], $txt['checkout15']."<br />".$txt['checkout7']." ".$numprod."<br />".$txt['checkout8']." ".$row[0], "warning.gif", "50");
$error = 1;
}
}
if ($error == 0) {
$query = "UPDATE `".$dbtablesprefix."basket` SET `QTY` = ".$numprod." WHERE `CUSTOMERID` = '". wsCid()."' AND `STATUS` = '0' AND `ID` = '". $basketid."'";
$sql = mysql_query($query) or die(mysql_error());
}
}
CheckoutShowProgress();
//shipping start
$cart_weight = WeighCart(wsCid());
//check if combined shipping and weight is applicable
if ($shippingid && $weightid) {
$weight_query = "SELECT * FROM `".$dbtablesprefix."shipping_weight` WHERE '".$cart_weight."' >= `FROM` AND '".$cart_weight."' <= `TO` AND `SHIPPINGID` = '".$shippingid."'";
$weight_sql = mysql_query($weight_query) or zfdbexit($weight_query);
if ($row_weight=mysql_fetch_array($weight_sql)) {
$weightid=$row_weight['ID'];
} else {
$weightid='';
$shippingid='';
}
}
?>
<form id="checkout" method="post" action="">
<table width="100%" class="datatable">
<tr>
<td colspan="4"><br />
<SELECT NAME="shipping" id="shipping"
onChange="this.form.action='';this.form.submit();"
>
Code (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
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php
// find out the shipping methods
$query="SELECT * FROM `".$dbtablesprefix."shipping` ORDER BY `id`";
$sql = mysql_query($query) or zfdbexit($query);
while ($row = mysql_fetch_row($sql)) {
// there must be at least 1 payment option available, so lets check that
$pay_query="SELECT * FROM `".$dbtablesprefix."shipping_payment` WHERE `shippingid`=".$row[0];
$pay_sql = mysql_query($pay_query) or zfdbexit($pay_query);
if (mysql_num_rows($pay_sql) <> 0) {
if ($row[2] == 0 || ($row[2] == 1 && IsCustomerFromDefaultSendCountry($send_default_country) == 1)) {
// now check the weight and the costs
$weight_query = "SELECT * FROM `".$dbtablesprefix."shipping_weight` WHERE '".$cart_weight."' >= `FROM` AND '".$cart_weight."' <= `TO` AND `SHIPPINGID` = '".$row[0]."'";
$weight_sql = mysql_query($weight_query) or zfdbexit($weight_query);
while ($weight_row = mysql_fetch_array($weight_sql)) {
if (!$shippingid) $shippingid=$row[0];
if (!$weightid) $weightid=$weight_row[0];
if ($shippingid==$row[0] && $weightid==$weight_row[0]) $selected='selected="SELECTED"'; else $selected="";
echo "<OPTION VALUE=\"".$weight_row[0].":".$row[0]."\" ".$selected." >".$row[1]." (".$currency_symbol_pre.myNumberFormat($weight_row[4],$number_format).$currency_symbol_post.")</OPTION>";
}
}
}
}
?>
// find out the shipping methods
$query="SELECT * FROM `".$dbtablesprefix."shipping` ORDER BY `id`";
$sql = mysql_query($query) or zfdbexit($query);
while ($row = mysql_fetch_row($sql)) {
// there must be at least 1 payment option available, so lets check that
$pay_query="SELECT * FROM `".$dbtablesprefix."shipping_payment` WHERE `shippingid`=".$row[0];
$pay_sql = mysql_query($pay_query) or zfdbexit($pay_query);
if (mysql_num_rows($pay_sql) <> 0) {
if ($row[2] == 0 || ($row[2] == 1 && IsCustomerFromDefaultSendCountry($send_default_country) == 1)) {
// now check the weight and the costs
$weight_query = "SELECT * FROM `".$dbtablesprefix."shipping_weight` WHERE '".$cart_weight."' >= `FROM` AND '".$cart_weight."' <= `TO` AND `SHIPPINGID` = '".$row[0]."'";
$weight_sql = mysql_query($weight_query) or zfdbexit($weight_query);
while ($weight_row = mysql_fetch_array($weight_sql)) {
if (!$shippingid) $shippingid=$row[0];
if (!$weightid) $weightid=$weight_row[0];
if ($shippingid==$row[0] && $weightid==$weight_row[0]) $selected='selected="SELECTED"'; else $selected="";
echo "<OPTION VALUE=\"".$weight_row[0].":".$row[0]."\" ".$selected." >".$row[1]." (".$currency_symbol_pre.myNumberFormat($weight_row[4],$number_format).$currency_symbol_post.")</OPTION>";
}
}
}
}
?>
</SELECT> <br />
<br />
<SELECT NAME="paymentid" id="paymentid"
onChange="this.form.action='';this.form.submit();"
>
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?php
// find out the payment methods
$query="SELECT * FROM `".$dbtablesprefix."shipping_payment` WHERE `shippingid`='".$shippingid."' ORDER BY `paymentid`";
$sql = mysql_query($query) or die(mysql_error());
while ($row = mysql_fetch_row($sql)) {
$query_pay="SELECT * FROM `".$dbtablesprefix."payment` WHERE `id`='".$row[1]."'";
$sql_pay = mysql_query($query_pay) or die(mysql_error());
while ($row_pay = mysql_fetch_array($sql_pay)) {
if (!$paymentid) $paymentid=$row_pay[0];
if ($paymentid==$row_pay[0]) $selected='selected="SELECTED"'; else $selected="";
if ($paymentid==$row_pay[0] && $row_pay['GATEWAY']=='offlinecc') {
$wsIsOfflineCC=$row_pay[0];
}
echo "<OPTION VALUE=\"".$row_pay[0]."\" ".$selected.">".$row_pay[1];
}
}
?>
// find out the payment methods
$query="SELECT * FROM `".$dbtablesprefix."shipping_payment` WHERE `shippingid`='".$shippingid."' ORDER BY `paymentid`";
$sql = mysql_query($query) or die(mysql_error());
while ($row = mysql_fetch_row($sql)) {
$query_pay="SELECT * FROM `".$dbtablesprefix."payment` WHERE `id`='".$row[1]."'";
$sql_pay = mysql_query($query_pay) or die(mysql_error());
while ($row_pay = mysql_fetch_array($sql_pay)) {
if (!$paymentid) $paymentid=$row_pay[0];
if ($paymentid==$row_pay[0]) $selected='selected="SELECTED"'; else $selected="";
if ($paymentid==$row_pay[0] && $row_pay['GATEWAY']=='offlinecc') {
$wsIsOfflineCC=$row_pay[0];
}
echo "<OPTION VALUE=\"".$row_pay[0]."\" ".$selected.">".$row_pay[1];
}
}
?>
</SELECT> </td>
</tr>
Code (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
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
<?php
if (IsAdmin() && get_option('zing_webshop_pro') && $wsIsOfflineCC) {
echo '<tr><td colspan="4">'.$txt['card1'].'</td></tr><tr>';
$wsCreditCard=new wsCreditCard(wsCid());
$i=0;
$first=true;
if (count($wsCreditCard->all()) > 0) {
foreach ($wsCreditCard->all() as $cardid => $card) {
$i++;
if ($i > 4) {
echo '</tr><tr>';
$i=1;
}
echo '<td width="25%">';
echo '<strong>'.$card['CARD_NAME'].'</strong><br />';
echo $card['CARD_TYPE'].' ';
echo $card['CARD_NUMBER'].'<br />';
if ($_POST['wscardid'] == $cardid || ($_POST['wscardid']=='' && $first)) $selected = 'CHECKED'; else $selected="";
echo '<input type="radio" name="wscardid" value="'.$cardid.'" '.$selected.'/>';
if ($cardid > 0) {
echo '<a href="index.php?zfaces=form&action=edit&form=bankcard&id='.$cardid.'&redirect='.urlencode('index.php?page=onecheckout&paymentid='.$paymentid.'&shipping='.$wsShipping).'" class="button">'.$txt['browse7'].'</a>';
echo ' ';
echo '<a href="index.php?zfaces=form&action=delete&form=bankcard&id='.$cardid.'&redirect='.urlencode('index.php?page=onecheckout&paymentid='.$paymentid.'&shipping='.$wsShipping).'" class="button">'.$txt['browse8'].'</a>';
}
echo '</td>';
$first=false;
}
}
echo '<tr><td colspan="4">';
echo '<a href="index.php?zfaces=form&action=add&form=bankcard&redirect='.urlencode('index.php?page=onecheckout&paymentid='.$paymentid.'&shipping='.$wsShipping).'" class="button">'.$txt['shippingadmin10'].'</a>';
echo '</td></tr>';
}
?>
if (IsAdmin() && get_option('zing_webshop_pro') && $wsIsOfflineCC) {
echo '<tr><td colspan="4">'.$txt['card1'].'</td></tr><tr>';
$wsCreditCard=new wsCreditCard(wsCid());
$i=0;
$first=true;
if (count($wsCreditCard->all()) > 0) {
foreach ($wsCreditCard->all() as $cardid => $card) {
$i++;
if ($i > 4) {
echo '</tr><tr>';
$i=1;
}
echo '<td width="25%">';
echo '<strong>'.$card['CARD_NAME'].'</strong><br />';
echo $card['CARD_TYPE'].' ';
echo $card['CARD_NUMBER'].'<br />';
if ($_POST['wscardid'] == $cardid || ($_POST['wscardid']=='' && $first)) $selected = 'CHECKED'; else $selected="";
echo '<input type="radio" name="wscardid" value="'.$cardid.'" '.$selected.'/>';
if ($cardid > 0) {
echo '<a href="index.php?zfaces=form&action=edit&form=bankcard&id='.$cardid.'&redirect='.urlencode('index.php?page=onecheckout&paymentid='.$paymentid.'&shipping='.$wsShipping).'" class="button">'.$txt['browse7'].'</a>';
echo ' ';
echo '<a href="index.php?zfaces=form&action=delete&form=bankcard&id='.$cardid.'&redirect='.urlencode('index.php?page=onecheckout&paymentid='.$paymentid.'&shipping='.$wsShipping).'" class="button">'.$txt['browse8'].'</a>';
}
echo '</td>';
$first=false;
}
}
echo '<tr><td colspan="4">';
echo '<a href="index.php?zfaces=form&action=add&form=bankcard&redirect='.urlencode('index.php?page=onecheckout&paymentid='.$paymentid.'&shipping='.$wsShipping).'" class="button">'.$txt['shippingadmin10'].'</a>';
echo '</td></tr>';
}
?>
Code (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
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
<?php
if (WeighCart(wsCid()) > 0) {
echo '<tr><td colspan="4">'.$txt['customer21'].'</td></tr><tr>';
$address=new wsAddress(wsCid());
$addresses=$address->getAddresses();
$i=0;
$first=true;
foreach ($addresses as $adrid => $adr) {
$i++;
if ($i > 4) {
echo '</tr><tr>';
$i=1;
}
echo '<td width="25%">';
echo '<strong>'.$adr['NAME'].'</strong><br />';
echo $adr['ADDRESS'].'<br />';
echo $adr['CITY'].','.$adr['ZIP'].'<br />';
if ($adr['STATE']) echo $adr['STATE'].'<br />';
echo $adr['COUNTRY'].'<br />';
if ($_POST['address'] == $adrid || ($_POST['address']=='' && $first)) $selected = 'CHECKED'; else $selected="";
echo '<input type="radio" name="address" value="'.$adrid.'" '.$selected.'/>';
if ($adrid > 0) {
echo '<a href="index.php?zfaces=form&action=edit&form=address&id='.$adrid.'&redirect='.urlencode('index.php?page=onecheckout').'" class="button">'.$txt['browse7'].'</a>';
echo ' ';
echo '<a href="index.php?zfaces=form&action=delete&form=address&id='.$adrid.'&redirect='.urlencode('index.php?page=onecheckout').'" class="button">'.$txt['browse8'].'</a>';
}
echo '</td>';
$first=false;
}
echo '<tr><td colspan="4">';
echo '<a href="index.php?zfaces=form&action=add&form=address&redirect='.urlencode('index.php?page=onecheckout').'" class="button">'.$txt['shippingadmin10'].'</a>';
echo '</td></tr>';
}
?>
if (WeighCart(wsCid()) > 0) {
echo '<tr><td colspan="4">'.$txt['customer21'].'</td></tr><tr>';
$address=new wsAddress(wsCid());
$addresses=$address->getAddresses();
$i=0;
$first=true;
foreach ($addresses as $adrid => $adr) {
$i++;
if ($i > 4) {
echo '</tr><tr>';
$i=1;
}
echo '<td width="25%">';
echo '<strong>'.$adr['NAME'].'</strong><br />';
echo $adr['ADDRESS'].'<br />';
echo $adr['CITY'].','.$adr['ZIP'].'<br />';
if ($adr['STATE']) echo $adr['STATE'].'<br />';
echo $adr['COUNTRY'].'<br />';
if ($_POST['address'] == $adrid || ($_POST['address']=='' && $first)) $selected = 'CHECKED'; else $selected="";
echo '<input type="radio" name="address" value="'.$adrid.'" '.$selected.'/>';
if ($adrid > 0) {
echo '<a href="index.php?zfaces=form&action=edit&form=address&id='.$adrid.'&redirect='.urlencode('index.php?page=onecheckout').'" class="button">'.$txt['browse7'].'</a>';
echo ' ';
echo '<a href="index.php?zfaces=form&action=delete&form=address&id='.$adrid.'&redirect='.urlencode('index.php?page=onecheckout').'" class="button">'.$txt['browse8'].'</a>';
}
echo '</td>';
$first=false;
}
echo '<tr><td colspan="4">';
echo '<a href="index.php?zfaces=form&action=add&form=address&redirect='.urlencode('index.php?page=onecheckout').'" class="button">'.$txt['shippingadmin10'].'</a>';
echo '</td></tr>';
}
?>
</tr>
</table>
<table>
<tr>
<td> <input type="text" id="discount_code" name="discount_code"
value=""
><input type="submit" name="discount" value=""
onclick="this.form.action='';this.form.submit();"
/></td>
</tr>
</table>
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
<?php //}
//shipping end
// read basket
$query = "SELECT * FROM ".$dbtablesprefix."basket WHERE (`CUSTOMERID` = ".wsCid()." AND `STATUS` = 0) ORDER BY ID";
$sql = mysql_query($query) or zfdbexit($query);
$count = mysql_num_rows($sql);
if ($count == 0) {
PutWindow($gfx_dir, $txt['cart1'], $txt['cart2'], "carticon.gif", "50");
}
else {
?>
//shipping end
// read basket
$query = "SELECT * FROM ".$dbtablesprefix."basket WHERE (`CUSTOMERID` = ".wsCid()." AND `STATUS` = 0) ORDER BY ID";
$sql = mysql_query($query) or zfdbexit($query);
$count = mysql_num_rows($sql);
if ($count == 0) {
PutWindow($gfx_dir, $txt['cart1'], $txt['cart2'], "carticon.gif", "50");
}
else {
?>
<table width="100%" class="datatable">
<tr>
<th colspan="2"></th>
<th></th>
<th></th>
</tr>
Code (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
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
<?php
$optel = 0;
$id=0;
$tax = new wsTaxSum();
while ($row = mysql_fetch_array($sql)) {
$id++;
$query = "SELECT * FROM `".$dbtablesprefix."product` where `ID`='" . $row[2] . "'";
$sql_details = mysql_query($query) or die(mysql_error());
while ($row_details = mysql_fetch_array($sql_details)) {
$optel = $optel +1;
if ($optel == 3) { $optel = 1; }
if ($optel == 1) { $kleur = ""; }
if ($optel == 2) { $kleur = " class=\"altrow\""; }
// is there a picture?
if ($search_prodgfx == 1 && $use_prodgfx == 1) {
if (!empty($row_details['DEFAULTIMAGE'])) { $picture = $row_details['DEFAULTIMAGE']; }
elseif ($pictureid == 1) { $picture = $row_details[0]; }
else { $picture = $row_details[1]; }
list($image_url,$height,$width)=wsDefaultProductImageUrl($picture,$row_details['DEFAULTIMAGE']);
$thumb = "<img class=\"imgleft\" src=\"".$image_url."\"".$width.$height." alt=\"\" />";
}
// make up the description to print according to the pricelist_format and max_description
$print_description=printDescription($row_details[1],$row_details[3],$row_details['EXCERPT']);
?>
$optel = 0;
$id=0;
$tax = new wsTaxSum();
while ($row = mysql_fetch_array($sql)) {
$id++;
$query = "SELECT * FROM `".$dbtablesprefix."product` where `ID`='" . $row[2] . "'";
$sql_details = mysql_query($query) or die(mysql_error());
while ($row_details = mysql_fetch_array($sql_details)) {
$optel = $optel +1;
if ($optel == 3) { $optel = 1; }
if ($optel == 1) { $kleur = ""; }
if ($optel == 2) { $kleur = " class=\"altrow\""; }
// is there a picture?
if ($search_prodgfx == 1 && $use_prodgfx == 1) {
if (!empty($row_details['DEFAULTIMAGE'])) { $picture = $row_details['DEFAULTIMAGE']; }
elseif ($pictureid == 1) { $picture = $row_details[0]; }
else { $picture = $row_details[1]; }
list($image_url,$height,$width)=wsDefaultProductImageUrl($picture,$row_details['DEFAULTIMAGE']);
$thumb = "<img class=\"imgleft\" src=\"".$image_url."\"".$width.$height." alt=\"\" />";
}
// make up the description to print according to the pricelist_format and max_description
$print_description=printDescription($row_details[1],$row_details[3],$row_details['EXCERPT']);
?>
<tr >
<td colspan="2"><a
href="
Code (php)
1
<?php zurl("index.php?page=details&prod=".$row_details[0].'&basketid='.$row['ID'],true); ?>
></a>
Code (php)
<td style="text-align: right">
Code (php)
<td style="text-align: right;"><input type="text" size="4"
name="numprod[]" value=""
> <input type="submit" value=""
onclick="form.action='
Code (php)
1
<?php zurl("?page=onecheckout&action=update&prodid=".$row_details[0].'&basketid='.$row['ID'],true)?>
name="sub"
> <br />
<input type="submit" value=""
onclick="form.action='
Code (php)
1
<?php zurl("?page=onecheckout&action=delete&prodid=".$row_details[0].'&basketid='.$row['ID'],true)?>
name="sub"
></td>
</tr>
Code (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
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
<?php
$totaal = $totaal + $subtotaal;
}
}
//end of cart contents
//manage discount
if ($discount_code <> "") {
$discount->calculate();
echo '<tr><td colspan="2" style="text-align: right">'.$txt['checkout14'];
if ($discount->percentage>0) {
// percentage
echo ' '.$discount->percentage.'%</td><td style="text-align: right">-'.$currency_symbol_pre.myNumberFormat($discount->discount,$number_format).$currency_symbol_post.'</td></tr>';
}
else {
//fixed amount
echo '</td><td style="text-align: right">-'.$currency_symbol_pre.myNumberFormat($discount->discount,$number_format).$currency_symbol_post.'</td></tr>';
}
$totaal -= $discount->discount;
}
//shipping costs
if ($shippingid) {
// first the shipping description
$query = sprintf("SELECT * FROM `".$dbtablesprefix."shipping` WHERE `id` = %s", quote_smart($shippingid));
$sql = mysql_query($query) or die(mysql_error());
if ($row = mysql_fetch_row($sql)) {
$shipping_descr = $row[1];
}
}
// read the shipping costs
if ($weightid) {
$query = sprintf("SELECT * FROM `".$dbtablesprefix."shipping_weight` WHERE `ID` = %s", quote_smart($weightid));
$sql = mysql_query($query) or die(mysql_error());
if ($row = mysql_fetch_row($sql)) $sendcosts = $row[4]; else $sendcosts = 0;
}
if ($sendcosts != 0) {
echo '<tr><td>'.$txt['checkout16'].'</td><td>'.$shipping_descr.'</td><td style="text-align: right">'.$currency_symbol_pre.myNumberFormat($sendcosts,$number_format).$currency_symbol_post.'</td></tr>';
$totaal += $sendcosts;
}
//calculate and display taxes
//$tax = new wsTax($totaal);
$totaal_ex = myNumberFormat($tax->exSum);
$totaal_in = myNumberFormat($tax->inSum);
function displayTaxes($tax) {
global $txt,$currency_symbol_pre,$number_format,$currency_symbol_post;
$taxheader=$txt['checkout102'];
if (count($tax->taxByCategory)>0) {
foreach ($tax->taxByCategory as $taxCategory => $taxes) {
if (count($taxes>0)) {
foreach ($taxes as $label => $data) {
echo '<tr>';
if ($taxheader) {
echo '<td rowspan="'.$tax->combinations.'">'.$taxheader.'</td>';
}
echo '<td>'.$label.' '.$data['RATE'].'%</td><td style="text-align: right">'.$currency_symbol_pre.myNumberFormat($data['TAX'],$number_format).$currency_symbol_post.'</td>';
if ($taxheader) {
echo '<td rowspan="'.$tax->combinations.'"></td>';
}
$taxheader="";
echo '</tr>';
}
}
}
}
}
if (!$db_prices_including_vat) displayTaxes($tax);
//total
?>
$totaal = $totaal + $subtotaal;
}
}
//end of cart contents
//manage discount
if ($discount_code <> "") {
$discount->calculate();
echo '<tr><td colspan="2" style="text-align: right">'.$txt['checkout14'];
if ($discount->percentage>0) {
// percentage
echo ' '.$discount->percentage.'%</td><td style="text-align: right">-'.$currency_symbol_pre.myNumberFormat($discount->discount,$number_format).$currency_symbol_post.'</td></tr>';
}
else {
//fixed amount
echo '</td><td style="text-align: right">-'.$currency_symbol_pre.myNumberFormat($discount->discount,$number_format).$currency_symbol_post.'</td></tr>';
}
$totaal -= $discount->discount;
}
//shipping costs
if ($shippingid) {
// first the shipping description
$query = sprintf("SELECT * FROM `".$dbtablesprefix."shipping` WHERE `id` = %s", quote_smart($shippingid));
$sql = mysql_query($query) or die(mysql_error());
if ($row = mysql_fetch_row($sql)) {
$shipping_descr = $row[1];
}
}
// read the shipping costs
if ($weightid) {
$query = sprintf("SELECT * FROM `".$dbtablesprefix."shipping_weight` WHERE `ID` = %s", quote_smart($weightid));
$sql = mysql_query($query) or die(mysql_error());
if ($row = mysql_fetch_row($sql)) $sendcosts = $row[4]; else $sendcosts = 0;
}
if ($sendcosts != 0) {
echo '<tr><td>'.$txt['checkout16'].'</td><td>'.$shipping_descr.'</td><td style="text-align: right">'.$currency_symbol_pre.myNumberFormat($sendcosts,$number_format).$currency_symbol_post.'</td></tr>';
$totaal += $sendcosts;
}
//calculate and display taxes
//$tax = new wsTax($totaal);
$totaal_ex = myNumberFormat($tax->exSum);
$totaal_in = myNumberFormat($tax->inSum);
function displayTaxes($tax) {
global $txt,$currency_symbol_pre,$number_format,$currency_symbol_post;
$taxheader=$txt['checkout102'];
if (count($tax->taxByCategory)>0) {
foreach ($tax->taxByCategory as $taxCategory => $taxes) {
if (count($taxes>0)) {
foreach ($taxes as $label => $data) {
echo '<tr>';
if ($taxheader) {
echo '<td rowspan="'.$tax->combinations.'">'.$taxheader.'</td>';
}
echo '<td>'.$label.' '.$data['RATE'].'%</td><td style="text-align: right">'.$currency_symbol_pre.myNumberFormat($data['TAX'],$number_format).$currency_symbol_post.'</td>';
if ($taxheader) {
echo '<td rowspan="'.$tax->combinations.'"></td>';
}
$taxheader="";
echo '</tr>';
}
}
}
}
}
if (!$db_prices_including_vat) displayTaxes($tax);
//total
?>
<tr>
<td colspan="2">
<div style="text-align: right;"><strong></strong></div>
</td>
<td>
<div style="text-align: right;"><br />
Code (php)
</td>
</tr>
</table>
<br />
<br />
<textarea name="notes" rows="5" style="width: 100%"></textarea><br />
<br />
<br />
<br />
<input type="hidden" name="onecheckout" value="1" /> <input type="checkbox" name="conditions"
/> <a href=""></a><br />
<div style="text-align: center;"><input type=submit name=pay value=""></div>
</form>
// op deze hoogte zou ik graag het datumtijd script willen laden!!!
code: laatste paar regels
dit zou dan gewoon moeten werken zo
Gewijzigd op 10/03/2011 14:02:04 door Rick -
Rick - op 10/03/2011 14:00:40:
Al met al werkt het niet Rick, ik heb ook in de checkout.php en de lang.txt gekeken maar zorda hij de order afdrukt (op het scherm of in de mail/print) zie je daar alleen [DATUMTIJD] staan en geen waarde :(
Backtics horen niet in een mysql query
Mysql injectie mogelijk mysql_real_escape_string
Html en php zoveel mogelijk gescheiden van elkaar houden
Gebruik goede fouthandeling geen OR DIE
!empty() is een onnodige functie gebruik isset()
Gebruik mysql_fetch_assoc ipv mysql_fetch_array
Probeer met divs te werken ipv met tabellen
Etc verder ga ik nie kijken er zouden wel meer dingen in zitten
je zet nu in de template tussen de [datumtijd] tags toch? haal die weg en zet hem gewoon ergens anders tussen en kijk dan wat hij doet dus tussen al bestaande tags
Uw ordernummer is: [WEBID]
Uw klantnummer is: [CUSTOMERID]
De volgende artikelen zijn door u besteld:
[QTY] x artikel [DESCRIPTION] [PRICE]
[LINETOTAL]
Korting Kortingscode [DISCOUNTCODE]
([DISCOUNTRATE]) -[DISCOUNTAMOUNT]
Het totaalbedrag inclusief BTW [TOTAL]
U haalt uw bestelling op: / opmerkingen
[DATUMTIJD]
[NOTES]
Contact gegevens:
[COMPANY]
[INITIALS] [MIDDLENAME] [LASTNAME]
[ADDRESS]
[ZIPCODE] [CITY]
[STATE]
[COUNTRY]
[PHONE]
Betaalwijze:
Contant of pinnen bij afhalen
Bedankt voor uw bestelling. Heeft u vragen? Neem dan contact met ons op.
wat zijn eigenlijk verder je ervaringen met deze webshop voor wordpress ik overweeg om hem ook te gaan gebruiken
Gewijzigd op 10/03/2011 14:59:58 door Rick -
Rick - op 10/03/2011 14:57:31:
wat zijn eigenlijk verder je ervaringen met deze webshop voor wordpress ik overweeg om hem ook te gaan gebruiken
wat zijn eigenlijk verder je ervaringen met deze webshop voor wordpress ik overweeg om hem ook te gaan gebruiken
Ik vind hem echt geweldig, je kan er werkelijk alles aan veranderen, ik ben en nu een dikke week mee bezig en ik vind hem echt top, ook heel makkelijk is het om prijzen en andere dingen over een product te veranderen in een excel sheet.
Ik vind hem echt super leuk.
Toevoeging op 10/03/2011 15:44:13:
Rick - op 10/03/2011 14:57:31:
aha de [DATUMTIJD] kun je er niet zomaar tussen zetten, in een ander bestand dat hem uitprint of iets dergelijks daarin stat welke tag welke tekst moet hebben daar moet je bij zetten [DATUMTIJD] = $datumtijd of zoiets neem dit niet klakkeloos over maar kijk wat het moet zijn
Je hebt ook een lang.txt file daar staan allemaal waardes in, nu had ik er
// DATUMTIJD.php bijgezet met daaronder de waarde:
$txt['DATUMTIJD']; = '<br />'
Heb de file geupload en toen deed de hele webshop niks meer dan roept ie dat er een valse string in de lang.txt zit
Gewijzigd op 10/03/2011 15:56:59 door Tiemen Jan van Dijk
moet je datumtijd.php niet ook includen en kan je niet gewooon $datumtijd plaatsen
Rick - op 10/03/2011 16:02:50:
moet je datumtijd.php niet ook includen en kan je niet gewooon $datumtijd plaatsen
hieronder een klein stukje uit de lang.txt volgens mij voegen ze alles toe door
// *.php
// stockadmin.php
$txt['stockadmin2'] = 'Toon';
$txt['stockadmin3'] = 'Voorraad beheer';
// mailinglist.php
$txt['mailinglist1'] = 'Copy/paste dit naar uw Mass mailer software';
Dus dacht ik dan zet ik er:
// DATUMTIJD.php
$txt['DATUMTIJD'] = "<br />';
Erbij maar dan accepteerd de webshop de lang.txt niet meer :(
zit fout in het moet zijn
je hebt ' en " door de war gehaald
Gewijzigd op 10/03/2011 16:37:33 door Rick -