You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have simpleCart in use together with db with Items.
On load of the website all items available are loaded. If someone puts an item in the cart the 'available' status of this ite is set to 'reserved' in the db through the item_id of it.
This is done with:
simpleCart.bind( "afterAdd" , function( item ){
$.ajax({
url: 'reserved.php',
type: 'post',
data: 'item_id='+item.id(),
});
});
and in the reserved.php by
$items = intval($_POST['item_id']);
$sql = "UPDATE item SET status='RESERVED' WHERE itemnr = '$items'";
This part without any trouble.(HURRAY!)
If someone wants to checkout (im my case through paypal) the status of the item(s) in the cart should be set to 'sold', basically in the same way as above.
This should be done with:
simpleCart.bind( "beforeCheckout" , function(data){
data.id = document.getElementsByClassName("item_id").value;
var item = document.getElementsByClassName("simpleCart_items");
$.ajax({
url: 'sold.php',
type: 'post',
data: 'item_id='+item.id(),
});
});
and in the sold.php by
$items = intval($_POST['item_id']);
$sql = "UPDATE item SET status='SOLD' WHERE itemnr = '$items'";
This doesn't work, message in the log: Type Error item.id() is not a function
Some part is obviously missing and perhaps it is quite simple, but I am lost here..
Does anybody have suggestions ?
Thx in advance
The text was updated successfully, but these errors were encountered:
I have simpleCart in use together with db with Items.
On load of the website all items available are loaded. If someone puts an item in the cart the 'available' status of this ite is set to 'reserved' in the db through the item_id of it.
This is done with:
simpleCart.bind( "afterAdd" , function( item ){
$.ajax({
url: 'reserved.php',
type: 'post',
data: 'item_id='+item.id(),
});
});
and in the reserved.php by
$items = intval($_POST['item_id']);
$sql = "UPDATE item SET status='RESERVED' WHERE itemnr = '$items'";
This part without any trouble.(HURRAY!)
If someone wants to checkout (im my case through paypal) the status of the item(s) in the cart should be set to 'sold', basically in the same way as above.
This should be done with:
simpleCart.bind( "beforeCheckout" , function(data){
data.id = document.getElementsByClassName("item_id").value;
var item = document.getElementsByClassName("simpleCart_items");
$.ajax({
url: 'sold.php',
type: 'post',
data: 'item_id='+item.id(),
});
});
and in the sold.php by
$items = intval($_POST['item_id']);
$sql = "UPDATE item SET status='SOLD' WHERE itemnr = '$items'";
This doesn't work, message in the log: Type Error item.id() is not a function
Some part is obviously missing and perhaps it is quite simple, but I am lost here..
Does anybody have suggestions ?
Thx in advance
The text was updated successfully, but these errors were encountered: