CMXX - Webhooks and giftcards

This commit is contained in:
“VeLiTi”
2025-02-19 12:11:44 +01:00
parent d85923c299
commit 0e9d133ff9
10 changed files with 358 additions and 335 deletions

View File

@@ -2,19 +2,6 @@
// Prevent direct access to file
defined(security_key) or exit;
//+++++++++++++++++++++++++++++++++++++++++++++
// TODO
//+++++++++++++++++++++++++++++++++++++++++++++
/*
3. product notifier when out of stock
*/
//+++++++++++++++++++++++++++++++++++++++++++++
// END TODO
//+++++++++++++++++++++++++++++++++++++++++++++
// Check to make sure the id parameter is specified in the URL
if (isset($_GET['id'])) {
@@ -45,12 +32,10 @@ if (isset($_GET['id'])) {
// If the user clicked the add to cart button
if (isset($_POST['product'])) {
//VALIDATE THE INPUT FOR THE SHOPPING CART
$payload = json_encode($_POST['product'], JSON_UNESCAPED_UNICODE);
$product_to_cart = ioAPIv2('/v2/shopping_cart/',$payload,$clientsecret);
$product_to_cart = json_decode($product_to_cart,true);
// Check if the product exists (array is not empty)
if ($product_to_cart['quantity'] > 0) {
// Product exists in database, now we can create/update the session variable for the cart
@@ -69,8 +54,7 @@ if (isset($_GET['id'])) {
}
// Prevent form resubmission...
header('Location: ' . url('index.php?page=cart'));
exit;
exit;
}