diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..fa5c670 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "php.version": "8.4" +} \ No newline at end of file diff --git a/admin/index.php b/admin/index.php index e0eff21..285997b 100644 --- a/admin/index.php +++ b/admin/index.php @@ -31,10 +31,10 @@ if (!isset($_SESSION['account_loggedin'])) { exit; } // If the user is not admin redirect them back to the shopping cart home page -$stmt = $pdo->prepare('SELECT * FROM accounts WHERE id = ?'); -$stmt->execute([ $_SESSION['account_id'] ]); -$account = $stmt->fetch(PDO::FETCH_ASSOC); -if (!$account || $account['role'] != 'Admin') { +$account = ioAPIv2('/v2/identity/userkey='.$_SESSION['account_id'].'&isverified=1','',$clientsecret); +$account = json_decode($account,true); + +if (!$account || $account[0]['profile'] != 1) { header('Location: ' . url('../index.php')); exit; } diff --git a/checkout.php b/checkout.php index 7708569..9da0169 100644 --- a/checkout.php +++ b/checkout.php @@ -6,7 +6,7 @@ defined(security_key) or exit; // Defaults // --------------------------------------- $account = [ - 'account_id' => $_POST['account_id'] ?? '', + 'account_id' => $_SESSION['account_id'] ?? '', 'email' => $_POST['email'] ?? '', 'first_name' => $_POST['first_name'] ?? '', 'last_name' => $_POST['last_name'] ?? '', @@ -58,10 +58,12 @@ if (empty($_SESSION['cart'])) { // Check if user is logged in if (isset($_SESSION['account_loggedin'])) { - $stmt = $pdo->prepare('SELECT * FROM accounts WHERE id = ?'); - $stmt->execute([ $_SESSION['account_id'] ]); - // Fetch the account from the database and return the result as an Array - $account = $stmt->fetch(PDO::FETCH_ASSOC); + $api_url = '/v2/identity/userkey='.$_SESSION['account_id']; + $account = ioAPIv2($api_url,'',$clientsecret); + if (!empty($account)){$account = json_decode($account,true);} + $account = $account[0]; + //RESET ACCOUNT_ID + $account['account_id'] = $account['userkey']; } // Update discount code @@ -119,14 +121,30 @@ if (isset($_POST['method'], $_POST['first_name'], $_POST['last_name'], $_POST['a // If the user is already logged in if (isset($_SESSION['account_loggedin'])) { // Account logged-in, update the user's details - $stmt = $pdo->prepare('UPDATE accounts SET first_name = ?, last_name = ?, address_street = ?, address_city = ?, address_state = ?, address_zip = ?, address_country = ?, address_phone = ? WHERE id = ?'); - $stmt->execute([ $_POST['first_name'], $_POST['last_name'], $_POST['address_street'], $_POST['address_city'], $_POST['address_state'], $_POST['address_zip'], $_POST['address_country'], $_POST['address_phone'], $_SESSION['account_id'] ]); - $account_id = $_SESSION['account_id']; + $payload = json_encode( + array( + "language" => $_SESSION['country_code'], + "first_name" => $_POST['first_name'], + "last_name" => $_POST['last_name'], + "address_street" => $_POST['address_street'], + "address_city" => $_POST['address_city'], + "address_state" => $_POST['address_state'], + "address_zip" => $_POST['address_zip'], + "address_country" => $_POST['address_country'], + "address_phone" => $_POST['address_phone'], + "userkey" => $_SESSION['account_id']), JSON_UNESCAPED_UNICODE); + $account_update = ioAPIv2('/v2/identity/',$payload,$clientsecret); + $account_update = json_decode($account_update,true); + $account_id = $account['account_id'] = $_SESSION['account_id']; + } else if (isset($_POST['email'], $_POST['password'], $_POST['cpassword']) && filter_var($_POST['email'], FILTER_VALIDATE_EMAIL) && !empty($_POST['password']) && !empty($_POST['cpassword'])) { // User is not logged in, check if the account already exists with the email they submitted - $stmt = $pdo->prepare('SELECT id FROM accounts WHERE email = ?'); - $stmt->execute([ $_POST['email'] ]); - if ($stmt->fetch(PDO::FETCH_ASSOC)) { + // Check if the account exists + $account = ioAPIv2('/v2/identity/email='.$_POST['email'],'',$clientsecret); + $account = json_decode($account,true); + + + if ($account) { // Email exists, user should login instead... $errors[] = $error_account_name; } @@ -139,16 +157,33 @@ if (isset($_POST['method'], $_POST['first_name'], $_POST['last_name'], $_POST['a $errors[] = $error_account_password_match; } if (!$errors) { - // Hash the password - $password = password_hash($_POST['password'], PASSWORD_DEFAULT); - // Email doesnt exist, create new account - $stmt = $pdo->prepare('INSERT INTO accounts (email, password, first_name, last_name, address_street, address_city, address_state, address_zip, address_country, address_phone) VALUES (?,?,?,?,?,?,?,?,?,?)'); - $stmt->execute([ $_POST['email'], $password, $_POST['first_name'], $_POST['last_name'], $_POST['address_street'], $_POST['address_city'], $_POST['address_state'], $_POST['address_zip'], $_POST['address_country'], $_POST['address_phone'] ]); - $account_id = $pdo->lastInsertId(); - $stmt = $pdo->prepare('SELECT * FROM accounts WHERE id = ?'); - $stmt->execute([ $account_id ]); - // Fetch the account from the database and return the result as an Array - $account = $stmt->fetch(PDO::FETCH_ASSOC); + // Account doesnt exist, create new account + $payload = json_encode( + array( + "email" => $_POST['email'], + "password" => $_POST['password'], + "language" => $_SESSION['country_code'], + "first_name" => $_POST['first_name'], + "last_name" => $_POST['last_name'], + "address_street" => $_POST['address_street'], + "address_city" => $_POST['address_city'], + "address_state" => $_POST['address_state'], + "address_zip" => $_POST['address_zip'], + "address_country" => $_POST['address_country'], + "address_phone" => $_POST['address_phone']), JSON_UNESCAPED_UNICODE); + + $account = ioAPIv2('/v2/identity/',$payload,$clientsecret); + $account= json_decode($account,true); + $account_id = $account['account_id'] = $account['accountID']; + + if ($account && isset($account['accountID'])) { + //SEND VERIFICATION EMAIL + include dirname(__FILE__).'/custom/email/email_template_register.php'; + $register_mail = $message; + + send_mail_by_PHPMailer($account['identity'], $subject, $register_mail,'', ''); + $register_error = 'Email send to verify your account'; + } } } else if (account_required) { $errors[] = $error_account; @@ -159,7 +194,7 @@ if (isset($_POST['method'], $_POST['first_name'], $_POST['last_name'], $_POST['a //Process checkout => add payment_method to checkout_input array // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ $checkout_input['payment_method'] = $_POST['method']; - + // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // Calculate shopping_cart based on session // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -205,7 +240,7 @@ if (isset($_POST['method'], $_POST['first_name'], $_POST['last_name'], $_POST['a session_regenerate_id(); $_SESSION['account_loggedin'] = TRUE; $_SESSION['account_id'] = $account_id; - $_SESSION['account_role'] = $account ? $account['role'] : 'Member'; + $_SESSION['account_role'] = $account ? $account['profile'] : 0; } // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -218,10 +253,10 @@ if (isset($_POST['method'], $_POST['first_name'], $_POST['last_name'], $_POST['a } // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - // Mollie = 0 ++++++++++++++++++++++++++++++++++++++++++++++++++ + // Mollie = 3 ++++++++++++++++++++++++++++++++++++++++++++++++++ // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - if (mollie_enabled && $_POST['method'] == 0) { + if (mollie_enabled && $_POST['method'] == 3) { try { /* @@ -290,7 +325,7 @@ if (isset($_POST['method'], $_POST['first_name'], $_POST['last_name'], $_POST['a // PayPal Payment = 1 +++++++++++++++++++++++++++++++++++++++++ // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - if (paypal_enabled && $_POST['method'] == 'paypal') { + if (paypal_enabled && $_POST['method'] == 1) { //Process Payment require_once __DIR__."/lib/paypal/paypal.php"; @@ -356,7 +391,7 @@ $view .= '

'.$account_available.' '; if (mollie_enabled){ - $view .= ' + $view .= ' ': ''; + $admin_link = isset($_SESSION['account_loggedin'], $_SESSION['account_role']) && $_SESSION['account_role'] == 1 ? ' ': ''; //check for age_consent if (age_verification_enabled){ @@ -69,10 +69,113 @@ if (veliti_analytics){ + $veliti_analytics $head + +

+
+
+
+
Loading, please wait...
+

@@ -145,7 +248,7 @@ function template_header_top($title, $head = '') { $about_link = url('index.php?page=about'); $myaccount_link = url('index.php?page=myaccount'); $cart_link = url('index.php?page=cart'); - $admin_link = isset($_SESSION['account_loggedin'], $_SESSION['account_role']) && $_SESSION['account_role'] == 'Admin' ? 'Admin' : ''; + $admin_link = isset($_SESSION['account_loggedin'], $_SESSION['account_role']) && $_SESSION['account_role'] == 1 ? 'Admin' : ''; $logout_link = isset($_SESSION['account_loggedin']) ? '' : ''; $site_name = site_name; $site_title = site_title; @@ -186,10 +289,113 @@ function template_header_top($title, $head = '') { + $veliti_analytics $head + +
+
+
+
+
Loading, please wait...
+
$banner $age_consent @@ -215,7 +421,7 @@ function template_menu(){ $default_country = isset($_SESSION['country_code']) ? strtolower($_SESSION['country_code']) : language_code; //build up settings - $admin_link = isset($_SESSION['account_loggedin'], $_SESSION['account_role']) && $_SESSION['account_role'] == 'Admin' ? ' ': ''; + $admin_link = isset($_SESSION['account_loggedin'], $_SESSION['account_role']) && $_SESSION['account_role'] == 1 ? ' ': ''; // DO NOT INDENT THE BELOW CODE @@ -346,8 +552,11 @@ function template_footer() { // Order email //++++++++++++++++++++++++++++++++++++++++++++++++++++ //Template header order email -function template_order_email_header() { - include './custom/translations/translations_'.strtoupper($_SESSION['country_code']).'.php'; +function template_order_email_header($user_language) { + + $user_language = ((isset($_SESSION['country_code']))? $_SESSION['country_code'] :$user_language); + + include './custom/translations/translations_'.strtoupper($user_language).'.php'; $home_link = url('index.php'); $myaccount_link = url('index.php?page=myaccount'); diff --git a/custom/email/email_template_register.php b/custom/email/email_template_register.php index dfb8ee1..7c43ff4 100644 --- a/custom/email/email_template_register.php +++ b/custom/email/email_template_register.php @@ -1,16 +1,4 @@ - - - CustomerPortal + + '.site_title.' - ' . $newuser_header . ', + '.$newuser_header.',

- '.$newuser_text.' '.$newuser_credential_text_1.''.$post_content['username'].' + '.$newuser_text.' '.$newuser_credential_text_1.''.$account['identity'].'

'.$newuser_credential_text_2.' @@ -68,8 +56,8 @@ $message = ' -
- Reset Password + + '.(${$verify_account} ?? 'Verify account').'
@@ -77,20 +65,20 @@ $message = ' - ' . $newuser_closure . ' -
+ '.$newuser_closure.'
- Kind regards, +
+ '.$newuser_signature.'

- Service team + '.$newuser_signature_name.'

- + diff --git a/custom/email/email_template_reset.php b/custom/email/email_template_reset.php index d727c07..b232ec9 100644 --- a/custom/email/email_template_reset.php +++ b/custom/email/email_template_reset.php @@ -1,13 +1,4 @@ - - CustomerPortal + '.site_title.' - ' . $changeuser_header . ', + '.$changeuser_header.',

'.$changeuser_text.' @@ -66,7 +57,7 @@ $message = '
- Reset Password + '.(${$reset_account} ?? 'Reset account').'
@@ -74,20 +65,20 @@ $message = ' - ' . $changeuser_closure . ' + '.$changeuser_closure.'

- Kind regards, + '.$changeuser_signature.'

- Service team + '.$changeuser_signature_name.'

- + diff --git a/custom/email/order-details-template.php b/custom/email/order-details-template.php index c0bbfdc..5205a56 100644 --- a/custom/email/order-details-template.php +++ b/custom/email/order-details-template.php @@ -1,6 +1,6 @@ - +
@@ -39,9 +39,17 @@ + - + diff --git a/custom/email/order-invoice-template.php b/custom/email/order-invoice-template.php index 5c9f20f..2ea0e4d 100644 --- a/custom/email/order-invoice-template.php +++ b/custom/email/order-invoice-template.php @@ -2,8 +2,8 @@ //(defined(security_key) or defined('admin')) or exit; ?> - - + +
@@ -39,9 +39,18 @@ + + - + diff --git a/custom/email/order-notification-template.php b/custom/email/order-notification-template.php index cae43df..f0c0382 100644 --- a/custom/email/order-notification-template.php +++ b/custom/email/order-notification-template.php @@ -1,6 +1,6 @@ - + @@ -19,8 +19,8 @@

-

Order:

-

Date:

+

:

+

:

@@ -40,9 +40,17 @@ + - + diff --git a/custom/settings/config.php b/custom/settings/config.php index cd8dcd6..5afe5e3 100644 --- a/custom/settings/config.php +++ b/custom/settings/config.php @@ -17,6 +17,7 @@ define('age_verification_enabled',false); define('veliti_analytics',false); // Default logtraffic define('log_usage',false); + /* Banners */ // Show offer at home page define('show_offer_home_page',true); @@ -24,7 +25,6 @@ define('show_offer_home_text','Free shipping on all of our watches'); // Show offer at products page define('show_offer_product_page',true); define('show_offer_product_text','Free shipping on all of our watches'); - //Banner at site entry define('banner_enabled',false); define('banner_wow','Introduction offer'); @@ -33,6 +33,14 @@ define('banner_link','https://www.kickstarter.com/projects/morvalwatches/morval- define('banner_btn_1','Continue@Kickstarter'); define('banner_btn_2','Stay@MorvalWatches'); +/*Appearance*/ +//Icon +define('icon_image','custom/assets/MORVALFavicon.svg'); +define('color','#005655c2'); +define('color_accent','#2FAC66'); +//EMAIL LOGO +define('emaillogo','custom/assets/MORVALFavicon.svg'); + /* Detailed settings */ // Homepage highlightedproducts define('category_id_highlighted_products_1','6'); @@ -93,8 +101,6 @@ define('about_morval_image_1','custom/assets/morval_about_morval_monument_detail define('about_morval_image_2','custom/assets/morval_about_morval_bordje.png'); // ABOUT MORVAL image 3 define('about_morval_image_3','custom/assets/morval_about_morval_monument_overzicht.png'); -//Icon -define('icon_image','custom/assets/MORVALFavicon.svg'); //Banner define('banner_background','custom/assets/morval_banner.jpg'); @@ -133,8 +139,6 @@ define('mail_enabled',true); define('email','info@gewoonlekkerspaans.nl'); // Receive email notifications? define('email_notifications',false); -//EMAIL LOGO -define('emaillogo','custom/assets/MORVALFavicon.svg'); //Additional phpmailer-settings define('email_host_name','gewoonlekkerspaans.nl'); define('email_reply_to','info@gewoonlekkerspaans.nl'); @@ -152,10 +156,10 @@ define('db_pass','4~gv71bM6'); // Database name define('db_name','shoppingcart_advanced'); //morvalwatches /* API */ -define('clientID','paul@veliti.nl'); //morvalwatches -define('clientsecret','test1234'); //morvalwatches +define('clientID','MorvalWatches'); //morvalwatches +define('clientsecret','MW2024!'); //morvalwatches define('api_url','https://dev.veliti.nl/api.php'); //morvalwatches -define('img_url',substr(api_url, 0, -8)); +define('img_url','https://dev.veliti.nl/'); /* Payment options */ //Pay on Delivery diff --git a/functions.php b/functions.php index 30def2e..5f3f0c8 100644 --- a/functions.php +++ b/functions.php @@ -151,7 +151,7 @@ function send_order_details_email($email, $products, $first_name, $last_name, $a return; } $subject = $subject_new_order; - $headers = 'From: ' . mail_from . "\r\n" . 'Reply-To: ' . mail_from . "\r\n" . 'Return-Path: ' . mail_from . "\r\n" . 'X-Mailer: PHP/' . phpversion() . "\r\n" . 'MIME-Version: 1.0' . "\r\n" . 'Content-Type: text/html; charset=UTF-8' . "\r\n"; + //$headers = 'From: ' . mail_from . "\r\n" . 'Reply-To: ' . mail_from . "\r\n" . 'Return-Path: ' . mail_from . "\r\n" . 'X-Mailer: PHP/' . phpversion() . "\r\n" . 'MIME-Version: 1.0' . "\r\n" . 'Content-Type: text/html; charset=UTF-8' . "\r\n"; ob_start(); include './custom/email/order-details-template.php'; $order_details_template = ob_get_clean(); @@ -163,7 +163,7 @@ function send_product_notification_email($email,$product_details){ include './custom/translations/translations_'.strtoupper($_SESSION['country_code']).'.php'; $subject = $subject_out_of_stock.' - '.$product_details; - $headers = 'From: ' . mail_from . "\r\n" . 'Reply-To: ' . $email . "\r\n" . 'Return-Path: ' . mail_from . "\r\n" . 'X-Mailer: PHP/' . phpversion() . "\r\n" . 'MIME-Version: 1.0' . "\r\n" . 'Content-Type: text/html; charset=UTF-8' . "\r\n"; + //$headers = 'From: ' . mail_from . "\r\n" . 'Reply-To: ' . $email . "\r\n" . 'Return-Path: ' . mail_from . "\r\n" . 'X-Mailer: PHP/' . phpversion() . "\r\n" . 'MIME-Version: 1.0' . "\r\n" . 'Content-Type: text/html; charset=UTF-8' . "\r\n"; $message = $product_details.' are out of stock. Please notify '.$email.' when available'; //mail(email, $subject, $message, $headers); @@ -472,10 +472,10 @@ function removeGiftCart($pdo, $orderID){ } } -function generateInvoice($invoice,$orderID){ +function generateInvoice($invoice_cust,$orderID,$user_language){ //Variables - $customer_email = htmlspecialchars($invoice['customer']['email'] ?? '', ENT_QUOTES); + $customer_email = htmlspecialchars($invoice_cust['customer']['email'] ?? '', ENT_QUOTES); //Generate invoice ob_start(); include dirname(__FILE__).'/custom/email/order-invoice-template.php'; diff --git a/home.php b/home.php index 057bf90..ab8ba9f 100644 --- a/home.php +++ b/home.php @@ -29,7 +29,7 @@ $view = ' if(show_offer_home_page){ $view .='
-

'.${show_offer_home_text} ?? show_offer_home_text .'

+

'.(${show_offer_home_text} ?? show_offer_home_text).'

'; } $view .=' diff --git a/index.php b/index.php index 8564fc1..1ea439d 100644 --- a/index.php +++ b/index.php @@ -90,6 +90,7 @@ $url = routes([ '/products/{category}/{sort}' => 'products.php', '/products/{p}/{category}/{sort}' => 'products.php', '/myaccount' => 'myaccount.php', + '/myaccount/{activation_key}' => 'myaccount.php', '/myaccount/{tab}' => 'myaccount.php', '/download/{id}' => 'download.php', '/cart' => 'cart.php', diff --git a/myaccount.php b/myaccount.php index 1336257..82f7cbc 100644 --- a/myaccount.php +++ b/myaccount.php @@ -1,6 +1,46 @@ $_GET['activation_key'], "isverified" => 1), JSON_UNESCAPED_UNICODE); + $verified = ioAPIv2('/v2/identity/',$payload,$clientsecret); + $verified = json_decode($verified,true); + + if($verified['status'] == 'updated'){ + //USER VERIFIED => LOGIN + session_regenerate_id(); + $_SESSION['account_loggedin'] = TRUE; + $_SESSION['account_id'] = $verified['accountID']; + $_SESSION['account_role'] = $account['profile']; + $_SESSION['country_code'] = $account['language']; + + $products_in_cart = isset($_SESSION['cart']) ? $_SESSION['cart'] : []; + + if ($products_in_cart) { + // user has products in cart, redirect them to the checkout page + header('Location: ' . url('index.php?page=checkout')); + } else { + // Redirect the user back to the same page, they can then see their order history + header('Location: ' . url('index.php?page=myaccount')); + } + exit; + } else { + $error = $error_myaccount; + } + + } else { + $error = $error_myaccount; + } + +} // User clicked the "Login" button, proceed with the login process... check POST data and validate email if (isset($_POST['login'], $_POST['email'], $_POST['password']) && filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) { @@ -17,13 +57,14 @@ if (isset($_POST['login'], $_POST['email'], $_POST['password']) && filter_var($_ $_SESSION['account_loggedin'] = TRUE; $_SESSION['account_id'] = $account['accountID']; $_SESSION['account_role'] = $account['profile']; + $_SESSION['country_code'] = $account['language']; $products_in_cart = isset($_SESSION['cart']) ? $_SESSION['cart'] : []; - + if ($products_in_cart) { - // user has products in cart, redirect them to the checkout page + //user has products in cart, redirect them to the checkout page header('Location: ' . url('index.php?page=checkout')); } else { - // Redirect the user back to the same page, they can then see their order history + //Redirect the user back to the same page, they can then see their order history header('Location: ' . url('index.php?page=myaccount')); } exit; @@ -36,76 +77,62 @@ $register_error = ''; // User clicked the "Register" button, proceed with the registration process... check POST data and validate email if (isset($_POST['register'], $_POST['email'], $_POST['password'], $_POST['cpassword']) && filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) { // Check if the account exists - $account = ioAPIv2('/v2/identity/email='.$_POST['email'],'',$clientsecret); $account = json_decode($account,true); - + if ($account) { // Account exists! - $register_error = $error_myaccount_exists; + $register_error = 'Account already exists'; ; } else if ($_POST['cpassword'] != $_POST['password']) { $register_error = 'Passwords do not match!'; } else if (strlen($_POST['password']) > 20 || strlen($_POST['password']) < 5) { // Password must be between 5 and 20 characters long. - $register_error = $error_account_password_rules; + $register_error = 'Password must be between 5 and 20 characters long'; } else { // Account doesnt exist, create new account - $payload = json_encode(array("login" => "consumer", "email" => $_POST['email'], "password" => $_POST['password'], "language" => $_SESSION['country_code']), JSON_UNESCAPED_UNICODE); + $payload = json_encode(array("email" => $_POST['email'], "password" => $_POST['password'], "language" => $_SESSION['country_code']), JSON_UNESCAPED_UNICODE); $account = ioAPIv2('/v2/identity/',$payload,$clientsecret); $account= json_decode($account,true); - + if ($account && isset($account['accountID'])) { //SEND VERIFICATION EMAIL - ob_start(); include dirname(__FILE__).'/custom/email/email_template_register.php'; - $register_mail= ob_get_clean(); + $register_mail = $message; - send_mail_by_PHPMailer($_POST['email'], $subject, $register_mail,'', ''); - exit; + send_mail_by_PHPMailer($account['identity'], $subject, $register_mail,'', ''); + $register_error = 'Email send to verify your account'; } } } + // Determine the current tab page -$tab = isset($_GET['tab']) ? $_GET['tab'] : 'orders'; +$tab = (isset($_GET['activation_key']) && strlen($_GET['activation_key']) != 50 ) ? $_GET['activation_key'] : 'orders'; + // If user is logged in if (isset($_SESSION['account_loggedin'])) { - // Select all the users transations, which will appear under "My Orders" - $stmt = $pdo->prepare('SELECT * FROM transactions WHERE account_id = ? ORDER BY created DESC'); - $stmt->execute([ $_SESSION['account_id'] ]); - $transactions = $stmt->fetchAll(PDO::FETCH_ASSOC); - // Select all the users transations, which will appear under "My Orders" - $stmt = $pdo->prepare('SELECT - p.name, - p.id AS product_id, - t.txn_id, - t.payment_status, - t.created AS transaction_date, - ti.item_price AS price, - ti.item_quantity AS quantity, - ti.item_id, - (SELECT m.full_path FROM products_media pm JOIN media m ON m.id = pm.media_id WHERE pm.product_id = p.id ORDER BY pm.position ASC LIMIT 1) AS img - FROM transactions t - JOIN transactions_items ti ON ti.txn_id = t.txn_id - JOIN accounts a ON a.id = t.account_id - JOIN products p ON p.id = ti.item_id - WHERE t.account_id = ? - ORDER BY t.created DESC'); - $stmt->execute([ $_SESSION['account_id'] ]); - $transactions_items = $stmt->fetchAll(PDO::FETCH_ASSOC); - // Retrieve the digital downloads - $transactions_ids = array_column($transactions_items, 'product_id'); - if ($transactions_ids) { - $stmt = $pdo->prepare('SELECT product_id, file_path, id FROM products_downloads WHERE product_id IN (' . trim(str_repeat('?,',count($transactions_ids)),',') . ') ORDER BY position ASC'); - $stmt->execute($transactions_ids); - $downloads = $stmt->fetchAll(PDO::FETCH_GROUP); - } else { - $downloads = []; - } + + //CALL TO API + $api_url = '/v2/transactions_items/account_id='.$_SESSION['account_id']; + $orders = ioAPIv2($api_url,'',$clientsecret); + //Decode Payload + if (!empty($orders)){$orders = json_decode($orders,true);}else{$orders = null;} + // Retrieve account details - $stmt = $pdo->prepare('SELECT * FROM accounts WHERE id = ?'); - $stmt->execute([ $_SESSION['account_id'] ]); - $account = $stmt->fetch(PDO::FETCH_ASSOC); + $api_url = '/v2/identity/userkey='.$_SESSION['account_id']; + $identity = ioAPIv2($api_url,'',$clientsecret); + //Decode Payload + if (!empty($identity)){$identity = json_decode($identity,true);}else{$identity = null;} + $identity = $identity[0]; + + //CALL TO API FOR shipping + $api_url = '/v2/taxes/'; + $countries = ioAPIv2($api_url,'',$clientsecret); + //Decode Payload + if (!empty($countries)){$countries = json_decode($countries,true);}else{$countries = null;} + //CountryID mapping + $countryMap = array_column($countries, 'country', 'id'); + // Update settings if (isset($_POST['save_details'], $_POST['email'], $_POST['password'])) { // Assign and validate input data @@ -117,235 +144,231 @@ if (isset($_SESSION['account_loggedin'])) { $address_zip = isset($_POST['address_zip']) ? $_POST['address_zip'] : ''; $address_country = isset($_POST['address_country']) ? $_POST['address_country'] : ''; $address_phone = isset($_POST['address_phone']) ? $_POST['address_phone'] : ''; + // Check if account exists with captured email - $stmt = $pdo->prepare('SELECT * FROM accounts WHERE email = ?'); - $stmt->execute([ $_POST['email'] ]); - // Validation - if ($_POST['email'] != $account['email'] && $stmt->fetch(PDO::FETCH_ASSOC)) { - $error = 'Account already exists with that email!'; - } else if ($_POST['password'] && (strlen($_POST['password']) > 20 || strlen($_POST['password']) < 5)) { - $error = 'Password must be between 5 and 20 characters long!'; - } else { - // Update account details in database - $password = $_POST['password'] ? password_hash($_POST['password'], PASSWORD_DEFAULT) : $account['password']; - $stmt = $pdo->prepare('UPDATE accounts SET email = ?, password = ?, first_name = ?, last_name = ?, address_street = ?, address_city = ?, address_state = ?, address_zip = ?, address_country = ?, address_phone = ? WHERE id = ?'); - $stmt->execute([ $_POST['email'], $password, $first_name, $last_name, $address_street, $address_city, $address_state, $address_zip, $address_country, $address_phone, $_SESSION['account_id'] ]); + if ($_POST['email'] != $identity['email']) { + // Check if the account exists + $account = ioAPIv2('/v2/identity/email='.$_POST['email'],'',$clientsecret); + $account = json_decode($account,true); + + if ($account) { + // Account exists with change email + $error = $error_myaccount_exists; + } + } + elseif (strlen($_POST['password']) > 20 || strlen($_POST['password']) < 5) { + // Password must be between 5 and 20 characters long. + $error = $error_account_password_rules; + } + elseif (!$error){ + //UPDATE DATA + $payload = json_encode(array( + "email" => $_POST['email'], + "first_name" => $first_name, + "last_name" => $last_name, + "address_street" => $address_street, + "address_city" => $address_city, + "address_state" => $address_state, + "address_zip" => $address_zip, + "address_country" => $address_country, + "address_phone" => $address_phone, + "password" => $_POST['password'], + "language" => $_SESSION['country_code'], + "userkey" => $_SESSION['account_id']), JSON_UNESCAPED_UNICODE); + $update_identity = ioAPIv2('/v2/identity/',$payload,$clientsecret); + $update_identity = json_decode($update_identity,true); // Redirect to settings page header('Location: ' . url('index.php?page=myaccount&tab=settings')); - exit; - } + exit; + } } } -?> - -
+template_header($myaccount_text); - +$view = ' - +
'; - +//++++++++++++++++++++++++++++++++++++++++ +//MY ACCOUNT DETAILS +//++++++++++++++++++++++++++++++++++++++++ -

+} else { + +$view .= '

'.$h1_myaccount.'

+ '; - -
+if($tab == 'orders'){ + $view .= '
-

+

'.$h2_myorders.'

'; - -

- - -
+ if(empty($orders)){ + $view .= '

'.$myorders_message.'

'; + } + + foreach($orders as $order){ + + //Translate status INT to STR + $payment_status = 'payment_status_'.$order['header']['payment_status']; + + $view .= '
-
#
-
-
+
'.$myorders_order.'# '.$order['header']['id'].'
+
'.$myorders_date.''.date('F j, Y', strtotime($order['header']['created'])).'
+
'.$myorders_status.''.(${$payment_status} ?? $order['header']['payment_status']).'
-
-
+
'.$myorders_shipping.''.currency_code.''.number_format($order['header']['shipping_amount'],2).'
+
'.$myorders_total.''.currency_code.''.number_format($order['header']['payment_amount'],2).'
- - - - - - - - - - + '; + foreach($order['items'] as $transaction_item){ + $view .= ' + + + + '; + } + + $view .= '
- - <?=$transaction_item['name']?> - - x
'; + if(!empty($transaction_item['full_path'])){ + $view .= ''.(${$transaction_item['item_name']} ?? $transaction_item['item_name']).''; + } + $view .= ''.$transaction_item['item_quantity'].' x '.(${$transaction_item['item_name']} ?? $transaction_item['item_name']).''.currency_code.''.number_format($transaction_item['item_price'] * $transaction_item['item_quantity'],2).'
-
- +
'; + + } +$view .= ' +
'; +} + +elseif($tab == 'settings'){ -
- -
+ $view .= '
-

- - -

- - - - - - - - - - - - - - - - - - - - - - -
- - <?=$item['name']?> - - - - - -
- - -
- -
- -

+

'.$h2_settings.'

- - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - '; + + foreach($countries as $country){ + $view .= ' '; + } + $view .= ' - +
-
+
'; + } - +} +$view .= ''; - +//OUTPUT +echo $view; - - - \ No newline at end of file +template_footer(); \ No newline at end of file diff --git a/product.php b/product.php index 431aebb..243ba37 100644 --- a/product.php +++ b/product.php @@ -194,14 +194,14 @@ $view .='
'; $output .= ' '; } else { $output .= ' '; } @@ -229,14 +229,14 @@ $view .=''; $output .= ' '; } else { $output .= ' '; } @@ -267,12 +267,12 @@ $view .=''; $IMG_small_id = img_url.$attribute['full_path']; //URL TO SMALL IMAGE $output .= ' - '; + '; } else { $output .= ' - '; + '; } @@ -303,12 +303,24 @@ $view .= ' '; } diff --git a/products.php b/products.php index 0a6a435..4ddf00f 100644 --- a/products.php +++ b/products.php @@ -61,7 +61,7 @@ $view .='

'.$h1_content_top.'

if(show_offer_product_page){ $view .= '
-

'.${show_offer_product_text} ?? show_offer_product_text.'

+

'.(${show_offer_product_text} ?? show_offer_product_text).'

'; } @@ -140,7 +140,7 @@ $view .= '
'; $view .= '
- '.(${$product['productname']} ?? $product['productname']).' + '.(${$product['productname']} ?? $product['productname']).' '; //CHECK IF CONFIGURATION SETTING IS FOUND AND NOT EMPTY => USE GROUP TO DISPLAY IMAGES diff --git a/script.js b/script.js index bdad906..2df8411 100644 --- a/script.js +++ b/script.js @@ -16,13 +16,27 @@ searchInput.onkeyup = event => { }; if (document.querySelector('.product-img-small')) { let imgs = document.querySelectorAll('.product-img-small img'); + let mainImg = document.querySelector('.product-img-large img'); + let originalSrc = mainImg.src; // Store the original image source + imgs.forEach(img => { img.onmouseover = () => { document.querySelector('.product-img-large img').src = img.src; imgs.forEach(i => i.parentElement.classList.remove('selected')); img.parentElement.classList.add('selected'); }; - /*img.onclick = () => { + // On mouse out - restore to the original image + img.onmouseout = () => { + mainImg.src = originalSrc; + imgs.forEach(i => i.parentElement.classList.remove('selected')); + // Optionally re-select the original thumbnail + imgs.forEach(i => { + if (i.src === originalSrc) { + i.parentElement.classList.add('selected'); + } + }); + }; + img.onclick = () => { document.body.insertAdjacentHTML('beforeend', `
@@ -39,13 +53,19 @@ if (document.querySelector('.product-img-small')) { document.querySelector('.img-modal').onclick = event => { if (event.target.classList.contains('img-modal')) document.querySelector('.img-modal').remove(); }; - };*/ + }; }); } if (document.querySelector('.product #product-form')) { let updatePrice = () => { let price = parseFloat(document.querySelector('.product .price').dataset.price); - let rrp = parseFloat(document.querySelector('.product .rrp').dataset.rrp); + + let rrp = document.querySelector('.product .rrp') ?? 0; + + if (rrp !=0) + { + rrp = parseFloat(document.querySelector('.product .rrp').dataset.rrp) ?? 0; + } document.querySelectorAll('.product #product-form .option').forEach(e => { if (e.value) { @@ -62,8 +82,10 @@ if (document.querySelector('.product #product-form')) { } }); document.querySelector('.product .price').innerHTML = currency_code + (price > 0.00 ? price.toFixed(2) : 0.00); - document.querySelector('.product .rrp').innerHTML = currency_code + (rrp > 0.00 ? rrp.toFixed(2) : 0.00); - + if (rrp !=0) + { + document.querySelector('.product .rrp').innerHTML = currency_code + (rrp > 0.00 ? rrp.toFixed(2) : 0.00); + } }; document.querySelectorAll('.product #product-form .option').forEach(ele => ele.onchange = () => updatePrice()); updatePrice(); diff --git a/uploads/1-Morval-Watches2024-V1-Blue-Black-Date normaal.png b/uploads/1-Morval-Watches2024-V1-Blue-Black-Date normaal.png new file mode 100644 index 0000000..e63de24 Binary files /dev/null and b/uploads/1-Morval-Watches2024-V1-Blue-Black-Date normaal.png differ diff --git a/uploads/1-Morval-Watches2024-V1-Blue-Brown-Date normaal.png b/uploads/1-Morval-Watches2024-V1-Blue-Brown-Date normaal.png new file mode 100644 index 0000000..e3df3c2 Binary files /dev/null and b/uploads/1-Morval-Watches2024-V1-Blue-Brown-Date normaal.png differ diff --git a/uploads/1-Morval-Watches2024-V1-Blue-Calf-Date normaal.png b/uploads/1-Morval-Watches2024-V1-Blue-Calf-Date normaal.png new file mode 100644 index 0000000..4347d7f Binary files /dev/null and b/uploads/1-Morval-Watches2024-V1-Blue-Calf-Date normaal.png differ diff --git a/uploads/1-Morval-Watches2024-V1-Blue-DarkBlue-Date normaal.png b/uploads/1-Morval-Watches2024-V1-Blue-DarkBlue-Date normaal.png new file mode 100644 index 0000000..ca628e6 Binary files /dev/null and b/uploads/1-Morval-Watches2024-V1-Blue-DarkBlue-Date normaal.png differ diff --git a/uploads/1-Morval-Watches2024-V1-Blue-Steel-Date normaal.png b/uploads/1-Morval-Watches2024-V1-Blue-Steel-Date normaal.png new file mode 100644 index 0000000..234da73 Binary files /dev/null and b/uploads/1-Morval-Watches2024-V1-Blue-Steel-Date normaal.png differ diff --git a/uploads/1-Morval-Watches2024-V1-DarkGrey-Black-Soft normaal.png b/uploads/1-Morval-Watches2024-V1-DarkGrey-Black-Soft normaal.png new file mode 100644 index 0000000..d8943a1 Binary files /dev/null and b/uploads/1-Morval-Watches2024-V1-DarkGrey-Black-Soft normaal.png differ diff --git a/uploads/1-Morval-Watches2024-V1-DarkGrey-Brown-Date normaal.png b/uploads/1-Morval-Watches2024-V1-DarkGrey-Brown-Date normaal.png new file mode 100644 index 0000000..b94e1df Binary files /dev/null and b/uploads/1-Morval-Watches2024-V1-DarkGrey-Brown-Date normaal.png differ diff --git a/uploads/1-Morval-Watches2024-V1-DarkGrey-Calf-Date normaal.png b/uploads/1-Morval-Watches2024-V1-DarkGrey-Calf-Date normaal.png new file mode 100644 index 0000000..d10832d Binary files /dev/null and b/uploads/1-Morval-Watches2024-V1-DarkGrey-Calf-Date normaal.png differ diff --git a/uploads/1-Morval-Watches2024-V1-Darkgrey-Black-Date normaal.png b/uploads/1-Morval-Watches2024-V1-Darkgrey-Black-Date normaal.png new file mode 100644 index 0000000..cbdf9f7 Binary files /dev/null and b/uploads/1-Morval-Watches2024-V1-Darkgrey-Black-Date normaal.png differ diff --git a/uploads/1-Morval-Watches2024-V1-Darkgrey-DarkBlue normaal.png b/uploads/1-Morval-Watches2024-V1-Darkgrey-DarkBlue normaal.png new file mode 100644 index 0000000..189713a Binary files /dev/null and b/uploads/1-Morval-Watches2024-V1-Darkgrey-DarkBlue normaal.png differ diff --git a/uploads/1-Morval-Watches2024-V1-Darkgrey-DarkBlue-Date normaal.png b/uploads/1-Morval-Watches2024-V1-Darkgrey-DarkBlue-Date normaal.png new file mode 100644 index 0000000..3c6e8d7 Binary files /dev/null and b/uploads/1-Morval-Watches2024-V1-Darkgrey-DarkBlue-Date normaal.png differ diff --git a/uploads/1-Morval-Watches2024-V1-Darkgrey-Steel-Date normaal.png b/uploads/1-Morval-Watches2024-V1-Darkgrey-Steel-Date normaal.png new file mode 100644 index 0000000..260f28e Binary files /dev/null and b/uploads/1-Morval-Watches2024-V1-Darkgrey-Steel-Date normaal.png differ diff --git a/uploads/1-Morval-Watches2024-V1-LightBlue-DarkBlue normaal.png b/uploads/1-Morval-Watches2024-V1-LightBlue-DarkBlue normaal.png new file mode 100644 index 0000000..edeb083 Binary files /dev/null and b/uploads/1-Morval-Watches2024-V1-LightBlue-DarkBlue normaal.png differ diff --git a/uploads/Morval-Watches2024-V1-Blue-Black normaal.png b/uploads/Morval-Watches2024-V1-Blue-Black normaal.png new file mode 100644 index 0000000..ff77427 Binary files /dev/null and b/uploads/Morval-Watches2024-V1-Blue-Black normaal.png differ diff --git a/uploads/Morval-Watches2024-V1-Blue-Black-Date normaal.png b/uploads/Morval-Watches2024-V1-Blue-Black-Date normaal.png new file mode 100644 index 0000000..e63de24 Binary files /dev/null and b/uploads/Morval-Watches2024-V1-Blue-Black-Date normaal.png differ diff --git a/uploads/Morval-Watches2024-V1-Blue-Brown normaal.png b/uploads/Morval-Watches2024-V1-Blue-Brown normaal.png new file mode 100644 index 0000000..620f56f Binary files /dev/null and b/uploads/Morval-Watches2024-V1-Blue-Brown normaal.png differ diff --git a/uploads/Morval-Watches2024-V1-Blue-Brown-Date normaal.png b/uploads/Morval-Watches2024-V1-Blue-Brown-Date normaal.png new file mode 100644 index 0000000..e3df3c2 Binary files /dev/null and b/uploads/Morval-Watches2024-V1-Blue-Brown-Date normaal.png differ diff --git a/uploads/Morval-Watches2024-V1-Blue-Calf normaal.png b/uploads/Morval-Watches2024-V1-Blue-Calf normaal.png new file mode 100644 index 0000000..c0d2845 Binary files /dev/null and b/uploads/Morval-Watches2024-V1-Blue-Calf normaal.png differ diff --git a/uploads/Morval-Watches2024-V1-Blue-Calf-Date normaal.png b/uploads/Morval-Watches2024-V1-Blue-Calf-Date normaal.png new file mode 100644 index 0000000..4347d7f Binary files /dev/null and b/uploads/Morval-Watches2024-V1-Blue-Calf-Date normaal.png differ diff --git a/uploads/Morval-Watches2024-V1-Blue-DarkBlue normaal.png b/uploads/Morval-Watches2024-V1-Blue-DarkBlue normaal.png new file mode 100644 index 0000000..668d797 Binary files /dev/null and b/uploads/Morval-Watches2024-V1-Blue-DarkBlue normaal.png differ diff --git a/uploads/Morval-Watches2024-V1-Blue-DarkBlue-Date normaal.png b/uploads/Morval-Watches2024-V1-Blue-DarkBlue-Date normaal.png new file mode 100644 index 0000000..ca628e6 Binary files /dev/null and b/uploads/Morval-Watches2024-V1-Blue-DarkBlue-Date normaal.png differ diff --git a/uploads/Morval-Watches2024-V1-Blue-Steel normaal.png b/uploads/Morval-Watches2024-V1-Blue-Steel normaal.png new file mode 100644 index 0000000..ff6788b Binary files /dev/null and b/uploads/Morval-Watches2024-V1-Blue-Steel normaal.png differ diff --git a/uploads/Morval-Watches2024-V1-Blue-Steel-Date normaal.png b/uploads/Morval-Watches2024-V1-Blue-Steel-Date normaal.png new file mode 100644 index 0000000..234da73 Binary files /dev/null and b/uploads/Morval-Watches2024-V1-Blue-Steel-Date normaal.png differ diff --git a/uploads/Morval-Watches2024-V1-DarkGrey-Black-Soft normaal.png b/uploads/Morval-Watches2024-V1-DarkGrey-Black-Soft normaal.png new file mode 100644 index 0000000..d8943a1 Binary files /dev/null and b/uploads/Morval-Watches2024-V1-DarkGrey-Black-Soft normaal.png differ diff --git a/uploads/Morval-Watches2024-V1-DarkGrey-Brown normaal.png b/uploads/Morval-Watches2024-V1-DarkGrey-Brown normaal.png new file mode 100644 index 0000000..8fd2e79 Binary files /dev/null and b/uploads/Morval-Watches2024-V1-DarkGrey-Brown normaal.png differ diff --git a/uploads/Morval-Watches2024-V1-DarkGrey-Brown-Date normaal.png b/uploads/Morval-Watches2024-V1-DarkGrey-Brown-Date normaal.png new file mode 100644 index 0000000..b94e1df Binary files /dev/null and b/uploads/Morval-Watches2024-V1-DarkGrey-Brown-Date normaal.png differ diff --git a/uploads/Morval-Watches2024-V1-DarkGrey-Calf normaal.png b/uploads/Morval-Watches2024-V1-DarkGrey-Calf normaal.png new file mode 100644 index 0000000..f3ef1ad Binary files /dev/null and b/uploads/Morval-Watches2024-V1-DarkGrey-Calf normaal.png differ diff --git a/uploads/Morval-Watches2024-V1-DarkGrey-Calf-Date normaal.png b/uploads/Morval-Watches2024-V1-DarkGrey-Calf-Date normaal.png new file mode 100644 index 0000000..d10832d Binary files /dev/null and b/uploads/Morval-Watches2024-V1-DarkGrey-Calf-Date normaal.png differ diff --git a/uploads/Morval-Watches2024-V1-DarkGrey-Steel normaal.png b/uploads/Morval-Watches2024-V1-DarkGrey-Steel normaal.png new file mode 100644 index 0000000..dc0d6c6 Binary files /dev/null and b/uploads/Morval-Watches2024-V1-DarkGrey-Steel normaal.png differ diff --git a/uploads/Morval-Watches2024-V1-Darkgrey-Black-Date normaal.png b/uploads/Morval-Watches2024-V1-Darkgrey-Black-Date normaal.png new file mode 100644 index 0000000..cbdf9f7 Binary files /dev/null and b/uploads/Morval-Watches2024-V1-Darkgrey-Black-Date normaal.png differ diff --git a/uploads/Morval-Watches2024-V1-Darkgrey-DarkBlue normaal.png b/uploads/Morval-Watches2024-V1-Darkgrey-DarkBlue normaal.png new file mode 100644 index 0000000..189713a Binary files /dev/null and b/uploads/Morval-Watches2024-V1-Darkgrey-DarkBlue normaal.png differ diff --git a/uploads/Morval-Watches2024-V1-Darkgrey-DarkBlue-Date normaal.png b/uploads/Morval-Watches2024-V1-Darkgrey-DarkBlue-Date normaal.png new file mode 100644 index 0000000..3c6e8d7 Binary files /dev/null and b/uploads/Morval-Watches2024-V1-Darkgrey-DarkBlue-Date normaal.png differ diff --git a/uploads/Morval-Watches2024-V1-Darkgrey-Steel-Date normaal.png b/uploads/Morval-Watches2024-V1-Darkgrey-Steel-Date normaal.png new file mode 100644 index 0000000..260f28e Binary files /dev/null and b/uploads/Morval-Watches2024-V1-Darkgrey-Steel-Date normaal.png differ diff --git a/uploads/Morval-Watches2024-V1-Green-Black normaal.png b/uploads/Morval-Watches2024-V1-Green-Black normaal.png new file mode 100644 index 0000000..9b0d748 Binary files /dev/null and b/uploads/Morval-Watches2024-V1-Green-Black normaal.png differ diff --git a/uploads/Morval-Watches2024-V1-Green-Black-Date normaal.png b/uploads/Morval-Watches2024-V1-Green-Black-Date normaal.png new file mode 100644 index 0000000..b424ba1 Binary files /dev/null and b/uploads/Morval-Watches2024-V1-Green-Black-Date normaal.png differ diff --git a/uploads/Morval-Watches2024-V1-Green-Brown-Date normaal.png b/uploads/Morval-Watches2024-V1-Green-Brown-Date normaal.png new file mode 100644 index 0000000..fa82b71 Binary files /dev/null and b/uploads/Morval-Watches2024-V1-Green-Brown-Date normaal.png differ diff --git a/uploads/Morval-Watches2024-V1-Green-Calf-Date normaal.png b/uploads/Morval-Watches2024-V1-Green-Calf-Date normaal.png new file mode 100644 index 0000000..c081792 Binary files /dev/null and b/uploads/Morval-Watches2024-V1-Green-Calf-Date normaal.png differ diff --git a/uploads/Morval-Watches2024-V1-Green-DarkBlue normaal.png b/uploads/Morval-Watches2024-V1-Green-DarkBlue normaal.png new file mode 100644 index 0000000..79c195e Binary files /dev/null and b/uploads/Morval-Watches2024-V1-Green-DarkBlue normaal.png differ diff --git a/uploads/Morval-Watches2024-V1-Green-DarkBlue-Date normaal.png b/uploads/Morval-Watches2024-V1-Green-DarkBlue-Date normaal.png new file mode 100644 index 0000000..b09c59d Binary files /dev/null and b/uploads/Morval-Watches2024-V1-Green-DarkBlue-Date normaal.png differ diff --git a/uploads/Morval-Watches2024-V1-Green-Steel-Date normaal.png b/uploads/Morval-Watches2024-V1-Green-Steel-Date normaal.png new file mode 100644 index 0000000..4815362 Binary files /dev/null and b/uploads/Morval-Watches2024-V1-Green-Steel-Date normaal.png differ diff --git a/uploads/Morval-Watches2024-V1-Grey-Black normaal.png b/uploads/Morval-Watches2024-V1-Grey-Black normaal.png new file mode 100644 index 0000000..deee56f Binary files /dev/null and b/uploads/Morval-Watches2024-V1-Grey-Black normaal.png differ diff --git a/uploads/Morval-Watches2024-V1-Grey-Black-Date normaal.png b/uploads/Morval-Watches2024-V1-Grey-Black-Date normaal.png new file mode 100644 index 0000000..6c09695 Binary files /dev/null and b/uploads/Morval-Watches2024-V1-Grey-Black-Date normaal.png differ diff --git a/uploads/Morval-Watches2024-V1-Grey-Brown-Date normaal.png b/uploads/Morval-Watches2024-V1-Grey-Brown-Date normaal.png new file mode 100644 index 0000000..2789db1 Binary files /dev/null and b/uploads/Morval-Watches2024-V1-Grey-Brown-Date normaal.png differ diff --git a/uploads/Morval-Watches2024-V1-Grey-Calf-Date normaal.png b/uploads/Morval-Watches2024-V1-Grey-Calf-Date normaal.png new file mode 100644 index 0000000..57b817c Binary files /dev/null and b/uploads/Morval-Watches2024-V1-Grey-Calf-Date normaal.png differ diff --git a/uploads/Morval-Watches2024-V1-Grey-DarkBlue normaal.png b/uploads/Morval-Watches2024-V1-Grey-DarkBlue normaal.png new file mode 100644 index 0000000..a38d0a7 Binary files /dev/null and b/uploads/Morval-Watches2024-V1-Grey-DarkBlue normaal.png differ diff --git a/uploads/Morval-Watches2024-V1-Grey-DarkBlue-Date normaal.png b/uploads/Morval-Watches2024-V1-Grey-DarkBlue-Date normaal.png new file mode 100644 index 0000000..d3065f7 Binary files /dev/null and b/uploads/Morval-Watches2024-V1-Grey-DarkBlue-Date normaal.png differ diff --git a/uploads/Morval-Watches2024-V1-Grey-Steel-Date normaal.png b/uploads/Morval-Watches2024-V1-Grey-Steel-Date normaal.png new file mode 100644 index 0000000..0a85be8 Binary files /dev/null and b/uploads/Morval-Watches2024-V1-Grey-Steel-Date normaal.png differ diff --git a/uploads/Morval-Watches2024-V1-LighBlue-Steel-Date normaal.png b/uploads/Morval-Watches2024-V1-LighBlue-Steel-Date normaal.png new file mode 100644 index 0000000..594ea33 Binary files /dev/null and b/uploads/Morval-Watches2024-V1-LighBlue-Steel-Date normaal.png differ diff --git a/uploads/Morval-Watches2024-V1-LightBlue-Black normaal.png b/uploads/Morval-Watches2024-V1-LightBlue-Black normaal.png new file mode 100644 index 0000000..9085101 Binary files /dev/null and b/uploads/Morval-Watches2024-V1-LightBlue-Black normaal.png differ diff --git a/uploads/Morval-Watches2024-V1-LightBlue-Calf-Date normaal.png b/uploads/Morval-Watches2024-V1-LightBlue-Calf-Date normaal.png new file mode 100644 index 0000000..e4cce5c Binary files /dev/null and b/uploads/Morval-Watches2024-V1-LightBlue-Calf-Date normaal.png differ diff --git a/uploads/Morval-Watches2024-V1-LightBlue-DarkBlue normaal.png b/uploads/Morval-Watches2024-V1-LightBlue-DarkBlue normaal.png new file mode 100644 index 0000000..edeb083 Binary files /dev/null and b/uploads/Morval-Watches2024-V1-LightBlue-DarkBlue normaal.png differ diff --git a/uploads/Morval-Watches2024-V1-LightBlue-DarkBlue-Date normaal.png b/uploads/Morval-Watches2024-V1-LightBlue-DarkBlue-Date normaal.png new file mode 100644 index 0000000..a4a5ae7 Binary files /dev/null and b/uploads/Morval-Watches2024-V1-LightBlue-DarkBlue-Date normaal.png differ diff --git a/uploads/Morval-Watches2024-V1-Lightblue-Black-Date normaal.png b/uploads/Morval-Watches2024-V1-Lightblue-Black-Date normaal.png new file mode 100644 index 0000000..70ddd78 Binary files /dev/null and b/uploads/Morval-Watches2024-V1-Lightblue-Black-Date normaal.png differ diff --git a/uploads/Morval-Watches2024-V1-Lightblue-Brown-Date normaal.png b/uploads/Morval-Watches2024-V1-Lightblue-Brown-Date normaal.png new file mode 100644 index 0000000..cb77fb7 Binary files /dev/null and b/uploads/Morval-Watches2024-V1-Lightblue-Brown-Date normaal.png differ diff --git a/uploads/Morval_achterkant.png b/uploads/Morval_achterkant.png new file mode 100644 index 0000000..4f72459 Binary files /dev/null and b/uploads/Morval_achterkant.png differ diff --git a/uploads/ThomasI-II-limited.png b/uploads/ThomasI-II-limited.png new file mode 100644 index 0000000..de387b8 Binary files /dev/null and b/uploads/ThomasI-II-limited.png differ diff --git a/uploads/morval-crown.jpg b/uploads/morval-crown.jpg new file mode 100644 index 0000000..ac92362 Binary files /dev/null and b/uploads/morval-crown.jpg differ diff --git a/uploads/morval_band_connect1.jpg b/uploads/morval_band_connect1.jpg new file mode 100644 index 0000000..1d5c2c5 Binary files /dev/null and b/uploads/morval_band_connect1.jpg differ diff --git a/uploads/morval_band_connect2.jpg b/uploads/morval_band_connect2.jpg new file mode 100644 index 0000000..6ede1a2 Binary files /dev/null and b/uploads/morval_band_connect2.jpg differ diff --git a/uploads/morval_box.jpg b/uploads/morval_box.jpg new file mode 100644 index 0000000..2acddc2 Binary files /dev/null and b/uploads/morval_box.jpg differ diff --git a/uploads/morval_closure.jpg b/uploads/morval_closure.jpg new file mode 100644 index 0000000..299eba1 Binary files /dev/null and b/uploads/morval_closure.jpg differ diff --git a/webhook.php b/webhook.php index 145c07e..11a2f7b 100644 --- a/webhook.php +++ b/webhook.php @@ -5,8 +5,8 @@ define('interface', true); //+++++++++++++++++++++++++++++++++++++++++++++++++++++ // Includes //+++++++++++++++++++++++++++++++++++++++++++++++++++++ -include '/custom/settings/config.php'; -include 'functions.php'; +include './custom/settings/config.php'; +include './functions.php'; //+++++++++++++++++++++++++++++++++++++++++++++++++++++ //LOGIN TO API @@ -76,7 +76,9 @@ try { //++++++++++++++++++++++++++++++++++++++++++++++++++++++ //Send the invoice when status is Paid //++++++++++++++++++++++++++++++++++++++++++++++++++++++ - list($data,$customer_email,$order_id) = generateInvoice($invoice_cust,$orderId); + $invoice_language = strtoupper($invoice_cust['customer']['language']!= '' ? $invoice_cust['customer']['language'] : $responses['language']); + + list($data,$customer_email,$order_id) = generateInvoice($invoice_cust,$orderId,$invoice_language); //CREATE PDF $dompdf->loadHtml($data); @@ -157,4 +159,4 @@ try { } } catch (\Mollie\Api\Exceptions\ApiException $e) { echo "API call failed: " . htmlspecialchars($e->getMessage()); -} \ No newline at end of file +} diff --git a/webhook_paypal.php b/webhook_paypal.php index 58d8752..3f22709 100644 --- a/webhook_paypal.php +++ b/webhook_paypal.php @@ -1,8 +1,8 @@ loadHtml($data);