Beste mensen
Ik heb hier een soort webshop maar bij het het winkelmandje doet die het en laat hij de juiste prijs zien.
Maar zodra ik op afrekenen druk telt hij maar 1 item.
De site waar het script op staat kunt u hier vinden.
http://ikleerhacken.nl
Wie zou mij ff willen door naar de code te kijken
Mvg
Danny
Aankopen (afrekenen gebeurt hier)
Winkelen (hier stop je de goederen in je mandje)PHP Code:
<?php
error_reporting(E_ALL);
include("common.php");
require_once 'Mollie/Wallie.php';
require('Mollie/class.micropayment-mollie.php');
$regel;
$m = new micropayment();
$molliePartnerID = 184351; // Fill in your own Mollie Partner ID!
$m->setPartnerID($molliePartnerID);
$wallie = new Mollie_Wallie($molliePartnerID);
$error = "";
$my_sFirstName = "";
$my_sLastName = "";
$my_clientEmail ="";
$my_clientIp ="";
$q1 = "select * from cart, items where cart.OrderID = '".GetCartId()."' and cart.ItemID = items.ItemID order by items.ItemName";
$r1 = mysql_query($q1) or die(mysql_error());
$col = "white";
$rows = "";
$order_total = 0;
$discount = mysql_query("SELECT discount FROM korting");
while($a1 = mysql_fetch_array($r1)){
if($col == "white"){
$col = "dddddd";
}else{
$col = "white";
}
$a1['ItemTotal'] = ( $a1['ItemPrice'] * $a1['ItemQty'] );
$rows .= "<tr bgcolor=\"$col\">\n\t<td class=BlackLink>".$a1['ItemName']."</td>\n<td align=right>$aset[currency_sign] $a1[ItemPrice]</td>\t\n\t<td align=center>$a1[ItemQty]</td>\n\t<td align=right>$aset[currency_sign] $a1[ItemTotal]</td>\n</tr>\n\n";
$order = ($a1['ItemPrice'] * $a1['ItemQty']);
$showdiscount = ($order * $discount) / 100;
$order_total = $order - $showdiscount;
}
$order_total = number_format($order_total, 2, ".", ",");
if(isset($_POST['submit_out']) || isset($_POST['submit_out_x'])){
$my_sFirstName = strip_trim($_POST['sFirstName']);
$my_sLastName = strip_trim($_POST['sLastName']);
$my_clientEmail = strip_trim($_POST['clientEmail']);
$my_clientIp = $_SERVER['REMOTE_ADDR'];
if(empty($my_sFirstName)){
$error = "<span class=RedLink>Gelieve je voornaam in te geven</span>";
}elseif(empty($my_sLastName)){
$error = "<span class=RedLink>Gelieve je naam in te geven</span>";
}elseif(empty($my_clientEmail) || !ereg("@", $my_clientEmail)){
$error = "<span class=RedLink>Gelieve je e-mail adres in te geven</span>";
}
if(empty($error)){
$q1 = "insert into orders_info set
FirstName = '$my_sFirstName',
LastName = '$my_sLastName',
email = '$my_clientEmail',
ip = '$my_clientIp',
order_date = '$t',
order_total = '$order_total' ";
mysql_query($q1) or die(mysql_error());
$order_id = mysql_insert_id();
$q2 = "update cart set OrderID = '$order_id' where OrderID = '".GetCartId()."' ";
mysql_query($q2) or die(mysql_error());
$check = "select * from newsletter where nEmail = '$my_clientEmail'";
$result = mysql_query($check);
if(mysql_num_rows($result) == 0 ) {
$q3 = "insert into newsletter set
nEmail = '$my_clientEmail' ";
mysql_query($q3);
}
$payment_option = $_POST['payment_option'];
if($payment_option == '2') {
//redirect to paypal
header("location:https://www.paypal.com/xclick?business=$aset[PayPalEmail]&item_name=OrderID $order_id&first_name=$my_sFirstName&last_name=$my_sLastName&email=$my_clientEmail&item_number=1&custom=$order_id&amount=$order_total¤cy_code=$aset[currency_id]¬ify_url=$site_url/download_link.php&return=$site_url/bedankt.php");
exit();
} elseif($payment_option == '3') {
$prijs = $order_total;
$amount = str_replace(".", "", $prijs);
$siteReportUrl = $site_url/aankopen.php;
$siteReturnUrl = $site_url/bedankt.php;
if ($wallie->createPayment($amount, $siteReportUrl, $siteReturnUrl)) {
// Payment created, You could(/should) save the payment information in your database
// Get the url of the chosen bank to redirect the user to,
// to complete the payment
header('location: ' . $wallie->getWallieUrl());
}
else {
// show message that the payment could not be created
// the function $wallie->getStatus() returns the status
// message that Mollie returns
echo $wallie->getStatus();
}
if (isset($_GET['payment_type']) and $_GET['payment_type'] == 'wallie' and isset($_GET['transaction_id']) and isset($_GET['amount'])) {
// Check if payment is OK.
$checkPayment = $wallie->checkPayment($_GET['transaction_id'], $_GET['amount']);
// Mollie makes sure a transaction can only
// be used one time!
if ($checkPayment == true) {
// Get the amount of money the user has payed
$paymentAmount = $wallie->getAmount();
header('location: ' . $site_url/download_link.php);
// Set in your database the paymentstatus to OK.
}
}
}elseif($payment_option == '4'){
?>
<form action="bellen_pay.php" method="post" name="myForm">
<input type="hidden" name="order_total" value="<? echo $order_total; ?>" />
<input type="submit" value="Ga door naar betaalpagina" />
</form>
<script type='text/javascript'>document.myForm.submit();</script>
<?
}
}
}
require_once("templates/hoofdtemplate.php");
include_once("templates/afrekenen.php");
include_once("templates/voetnoot.php");
?>
PHP Code:
<?
error_reporting(e_all);
include("common.php");
require_once("templates/hoofdtemplate.php");
if ($_POST[a]) $a=$_POST[a];
else $a=$_GET[a];
switch ($a){
case "add":
AddItem($_GET["item"],1);
$totalCost = ShowCart();
// print $totalCost;
break;
case "update":
$myqty = $_REQUEST['qty'];
while(list($k,$v) = each($_REQUEST[ids])){
$qty = $myqty[$k];
if( $qty == 0 ){
RemoveItem($v);
}else{
UpdateItem($v, $qty);
}
}
$totalCost = ShowCart();
break;
case "remove":
RemoveItem($_GET["item"]);
$totalCost = ShowCart();
break;
default:
$totalCost = ShowCart();
break;
}
require_once("templates/voetnoot.php");
function AddItem($item,$qty=1){
//get the product info
$q1 = "select * from items where ItemID = '$item' ";
$r1 = mysql_query($q1) or die(mysql_error());
$a1 = mysql_fetch_array($r1);
//add to cart
$chk = mysql_query("SELECT * FROM cart WHERE OrderID='".GetCartId()."' AND ItemID='$a1[ItemID]'");
if( mysql_num_rows($chk) > 0 ){
UpdateItem($item,2);
}else{
$q2 = "insert into cart set
OrderID = '".GetCartId()."',
ItemID = '$a1[ItemID]',
ItemPrice = '$a1[ItemPrice]',
ItemQty = '$qty',
ItemTotal = '$a1[ItemPrice]' ";
mysql_query($q2) or die(mysql_error());
}
}
function UpdateItem($item,$qty){
//get the product info
$q1 = "select * from items where ItemID = '$item' ";
$r1 = mysql_query($q1) or die(mysql_error());
$a1 = mysql_fetch_array($r1);
//add to cart
$q2 = "UPDATE cart SET ItemQty = '$qty' WHERE OrderID = '".GetCartId()."' AND ItemID = '$a1[ItemID]'";
mysql_query($q2) or die(mysql_error());
}
function RemoveItem($item){
mysql_query("DELETE FROM cart WHERE OrderID= '" . GetCartId() . "' and ItemID = '$item'");
}
function ShowCart(){
//get the cart content
$q1 = "select * from cart, items where cart.OrderID = '".GetCartId()."' and cart.ItemID = items.ItemID order by items.ItemName";
$r1 = mysql_query($q1) or die(mysql_error());
if(mysql_num_rows($r1) == '0'){
include_once("templates/niets-in-winkelmandje.php");
}else{
$col = "white";
while($a1 = mysql_fetch_array($r1)){
if($col == "white"){
$col = "dddddd";
}else{
$col = "white";
}
$a1[ItemTotal] = ( $a1[ItemPrice] * $a1[ItemQty] );
$rows .= "<tr bgcolor=\"$col\">\n\t<td class=BlackLink>$a1[ItemName]</td>\n<td align=right>€ $a1[ItemPrice]</td>\t\n\t<td align=center>\n\t\t<input type=text size=3 class=\"vullen\" name=\"qty[]\" value=\"$a1[ItemQty]\">\n\t\t<input type=hidden name=\"ids[]\" value=\"$a1[ItemID]\">\n\t</td>\n\t<td align=right>€ $a1[ItemTotal]</td>\n</tr>\n\n";
$order = $order + ( $a1[ItemPrice] * $a1[ItemQty] );
$showdiscount = ($order * $discount) / 100;
$order_total = $order - $showdiscount;
}
$order_total = number_format($order_total, 2, ".", ",");
include_once("templates/bekijk-mandje.php");
}
}
?>
- Optel probleem van goederen
-
11-11-2010, 12:27 #1
- Berichten
- 1.025
- Lid sinds
- 14 Jaar
Optel probleem van goederen
Laatst aangepast door Danny vs : 11-11-2010 om 13:10
-
Plaats een
- + Advertentie
- + Onderwerp
Marktplaats
Webmasterforum
- Websites algemeen
- Sitechecks
- Marketing
- Domeinen algemeen
- Waardebepaling
- CMS
- Wordpress
- Joomla
- Magento
- Google algemeen
- SEO
- Analytics
- Adsense
- Adwords
- HTML / XHTML
- CSS
- Programmeren
- PHP
- Javascript
- JQuery
- MySQL
- Ondernemen algemeen
- Belastingen
- Juridisch
- Grafisch ontwerp
- Hosting Algemeen
- Hardware Info
- Offtopic