diff --git a/.gitignore b/.gitignore index 49893ec..5a888e9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ productold.php test.php +find_undeclared_vars.php.php diff --git a/admin/account.php b/admin/account.php deleted file mode 100644 index 760e32d..0000000 --- a/admin/account.php +++ /dev/null @@ -1,131 +0,0 @@ - '', - 'password' => '', - 'role' => 'Member', - 'first_name' => '', - 'last_name' => '', - 'address_street' => '', - 'address_city' => '', - 'address_state' => '', - 'address_zip' => '', - 'address_country' => '', - 'registered' => date('Y-m-d\TH:i'), - 'address_phone' => '' -]; -if (isset($_GET['id'])) { - // Retrieve the account from the database - $stmt = $pdo->prepare('SELECT * FROM accounts WHERE id = ?'); - $stmt->execute([ $_GET['id'] ]); - $account = $stmt->fetch(PDO::FETCH_ASSOC); - // ID param exists, edit an existing account - $page = 'Edit'; - if (isset($_POST['submit'])) { - // Update the account - $password = !empty($_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 = ?, role = ?, registered = ?, address_phone = ? WHERE id = ?'); - $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['role'], date('Y-m-d H:i:s', strtotime($_POST['registered'])), $_POST['address_phone'],$_GET['id'] ]); - header('Location: index.php?page=accounts&success_msg=2'); - exit; - } - if (isset($_POST['delete'])) { - // Delete the account - $stmt = $pdo->prepare('DELETE FROM accounts WHERE id = ?'); - $stmt->execute([ $_GET['id'] ]); - header('Location: index.php?page=accounts&success_msg=3'); - exit; - } -} else { - // Create a new account - $page = 'Create'; - if (isset($_POST['submit'])) { - $password = password_hash($_POST['password'], PASSWORD_DEFAULT); - $stmt = $pdo->prepare('INSERT INTO accounts (email,password,first_name,last_name,address_street,address_city,address_state,address_zip,address_country,role,registered, 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['role'], date('Y-m-d H:i:s', strtotime($_POST['registered'])), $_POST['address_phone'] ]); - header('Location: index.php?page=accounts&success_msg=1'); - exit; - } -} -?> - - -
- -
-

Account

- Cancel - - - - -
- -
- General - Shipping Address -
- -
- -
- - - - - - > - - - - - - - - - - - - - -
- -
- -
- -
- - - - - - - - - - - - - - - - - - - -
- -
- -
- - \ No newline at end of file diff --git a/admin/accounts.php b/admin/accounts.php deleted file mode 100644 index 49ca59f..0000000 --- a/admin/accounts.php +++ /dev/null @@ -1,138 +0,0 @@ -prepare('SELECT COUNT(*) AS total FROM accounts a ' . $where); -if ($search) $stmt->bindParam('search', $param3, PDO::PARAM_STR); -$stmt->execute(); -$accounts_total = $stmt->fetchColumn(); -// SQL query to get all products from the "products" table -$stmt = $pdo->prepare('SELECT a.*, count(t.id) AS orders FROM accounts a LEFT JOIN transactions t ON t.account_id = a.id ' . $where . ' GROUP BY a.id, a.email, a.password, a.role, a.first_name, a.last_name, a.address_street, a.address_city, a.address_state, a.address_zip, a.address_country, a.registered ORDER BY ' . $order_by . ' ' . $order . ' LIMIT :start_results,:num_results'); -// Bind params -$stmt->bindParam('start_results', $param1, PDO::PARAM_INT); -$stmt->bindParam('num_results', $param2, PDO::PARAM_INT); -if ($search) $stmt->bindParam('search', $param3, PDO::PARAM_STR); -$stmt->execute(); -// Retrieve query results -$accounts = $stmt->fetchAll(PDO::FETCH_ASSOC); -// Handle success messages -if (isset($_GET['success_msg'])) { - if ($_GET['success_msg'] == 1) { - $success_msg = 'Account created successfully!'; - } - if ($_GET['success_msg'] == 2) { - $success_msg = 'Account updated successfully!'; - } - if ($_GET['success_msg'] == 3) { - $success_msg = 'Account deleted successfully!'; - } -} -// Determine the URL -$url = 'index.php?page=accounts&search=' . $search; -?> - - -
-
- -
-

Accounts

-

View, create, and edit accounts.

-
-
-
- - -
- -

- -
- - - -
- Create Account -
- - -
-
- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#EmailNameAddressRoleOrders PlacedRegistered DateActions
There are no accounts
- - - - - - Edit
-
-
- - - - \ No newline at end of file diff --git a/admin/categories.php b/admin/categories.php deleted file mode 100644 index 31881d1..0000000 --- a/admin/categories.php +++ /dev/null @@ -1,83 +0,0 @@ -prepare('SELECT * FROM categories'); -$stmt->execute(); -$categories = $stmt->fetchAll(PDO::FETCH_ASSOC); -// Handle success messages -if (isset($_GET['success_msg'])) { - if ($_GET['success_msg'] == 1) { - $success_msg = 'Category created successfully!'; - } - if ($_GET['success_msg'] == 2) { - $success_msg = 'Category updated successfully!'; - } - if ($_GET['success_msg'] == 3) { - $success_msg = 'Category deleted successfully!'; - } -} -// Populate categories function -function admin_populate_categories($categories, $parent_id = 0, $n = 0) { - $html = ''; - foreach ($categories as $category) { - if ($parent_id == $category['parent_id']) { - $html .= ' - - -' . str_repeat('----', $n) . '' . $category['name'] . ' - Edit (ID =' . $category['id'] . ') - - '; - $html .= admin_populate_categories($categories, $category['id'], $n+1); - } - } - return $html; -} -?> - - -
-
- -
-

Categories

-

View, create, and edit categories.

-
-
-
- - -
- -

- -
- - - -
- Create Category -
- -
-
- - - - - - - - - - - - - - - - -
NameActions
There are no categories
-
-
- - \ No newline at end of file diff --git a/admin/category.php b/admin/category.php deleted file mode 100644 index 59a222b..0000000 --- a/admin/category.php +++ /dev/null @@ -1,85 +0,0 @@ - '', - 'parent_id' => 0, - 'status' => 1 -]; -if (isset($_GET['id'])) { - // Retrieve all the categories - $stmt = $pdo->prepare('SELECT * FROM categories WHERE id != ?'); - $stmt->execute([ $_GET['id'] ]); - $categories = $stmt->fetchAll(PDO::FETCH_ASSOC); - // ID param exists, edit an existing category - $page = 'Edit'; - if (isset($_POST['submit'])) { - // Update the category - $stmt = $pdo->prepare('UPDATE categories SET name = ?, parent_id = ?, status = ? WHERE id = ?'); - $stmt->execute([ $_POST['name'], $_POST['parent_id'], $_POST['status'], $_GET['id'] ]); - header('Location: index.php?page=categories&success_msg=2'); - exit; - } - if (isset($_POST['delete'])) { - // Delete the category - $stmt = $pdo->prepare('DELETE c, pc FROM categories c LEFT JOIN products_categories pc ON pc.category_id = c.id WHERE c.id = ?'); - $stmt->execute([ $_GET['id'] ]); - header('Location: index.php?page=categories&success_msg=3'); - exit; - } - // Get the category from the database - $stmt = $pdo->prepare('SELECT * FROM categories WHERE id = ?'); - $stmt->execute([ $_GET['id'] ]); - $category = $stmt->fetch(PDO::FETCH_ASSOC); -} else { - // Retrieve all the categories - $stmt = $pdo->prepare('SELECT * FROM categories'); - $stmt->execute(); - $categories = $stmt->fetchAll(PDO::FETCH_ASSOC); - // Create a new category - $page = 'Create'; - if (isset($_POST['submit'])) { - $stmt = $pdo->prepare('INSERT INTO categories (name,parent_id,status) VALUES (?,?,?)'); - $stmt->execute([ $_POST['name'], $_POST['parent_id'], $_POST['status'] ]); - header('Location: index.php?page=categories&success_msg=1'); - exit; - } -} -?> - - -
- -
-

Category

- Cancel - - - - -
- -
-
- - - - - - - - -
-
- -
- - \ No newline at end of file diff --git a/admin/discount.php b/admin/discount.php deleted file mode 100644 index 974bb31..0000000 --- a/admin/discount.php +++ /dev/null @@ -1,154 +0,0 @@ - '', - 'product_ids' => '', - 'discount_code' => '', - 'discount_type' => 'Percentage', - 'discount_value' => 0, - 'start_date' => date('Y-m-d\TH:i'), - 'end_date' => date('Y-m-d\TH:i', strtotime('+1 month', strtotime(date('Y-m-d\TH:i')))), - 'categories' => [], - 'products' => [] -]; -$types = ['Percentage', 'Fixed']; -// Get all the categories from the database -$stmt = $pdo->query('SELECT * FROM categories'); -$stmt->execute(); -$categories = $stmt->fetchAll(PDO::FETCH_ASSOC); -// Get all the products from the database -$stmt = $pdo->query('SELECT * FROM products'); -$stmt->execute(); -$products = $stmt->fetchAll(PDO::FETCH_ASSOC); -if (isset($_GET['id'])) { - // ID param exists, edit an existing discount - $page = 'Edit'; - if (isset($_POST['submit'])) { - // Update the discount - $categories_list = isset($_POST['categories']) ? implode(',', $_POST['categories']) : ''; - $products_list = isset($_POST['products']) ? implode(',', $_POST['products']) : ''; - $stmt = $pdo->prepare('UPDATE discounts SET category_ids = ?, product_ids = ?, discount_code = ?, discount_type = ?, discount_value = ?, start_date = ?, end_date = ? WHERE id = ?'); - $stmt->execute([ $categories_list, $products_list, $_POST['discount_code'], $_POST['discount_type'], $_POST['discount_value'], date('Y-m-d H:i:s', strtotime($_POST['start_date'])), date('Y-m-d H:i:s', strtotime($_POST['end_date'])), $_GET['id'] ]); - // Remove session discount code - if (isset($_SESSION['discount'])) { - unset($_SESSION['discount']); - } - header('Location: index.php?page=discounts&success_msg=2'); - exit; - } - if (isset($_POST['delete'])) { - // Delete the discount - $stmt = $pdo->prepare('DELETE FROM discounts WHERE id = ?'); - $stmt->execute([ $_GET['id'] ]); - // Remove session discount code - if (isset($_SESSION['discount'])) { - unset($_SESSION['discount']); - } - header('Location: index.php?page=discounts&success_msg=3'); - exit; - } - // Get the discount from the database - $stmt = $pdo->prepare('SELECT * FROM discounts WHERE id = ?'); - $stmt->execute([ $_GET['id'] ]); - $discount = $stmt->fetch(PDO::FETCH_ASSOC); - // Get the discount categories - $stmt = $pdo->prepare('SELECT c.name, c.id FROM discounts d JOIN categories c ON FIND_IN_SET(c.id, d.category_ids) WHERE d.id = ?'); - $stmt->execute([ $_GET['id'] ]); - $discount['categories'] = $stmt->fetchAll(PDO::FETCH_ASSOC); - // Get the discount products - $stmt = $pdo->prepare('SELECT p.name, p.id FROM discounts d JOIN products p ON FIND_IN_SET(p.id, d.product_ids) WHERE d.id = ?'); - $stmt->execute([ $_GET['id'] ]); - $discount['products'] = $stmt->fetchAll(PDO::FETCH_ASSOC); -} else { - // Create a new discount - $page = 'Create'; - if (isset($_POST['submit'])) { - $categories_list = isset($_POST['categories']) ? implode(',', $_POST['categories']) : ''; - $products_list = isset($_POST['products']) ? implode(',', $_POST['products']) : ''; - $stmt = $pdo->prepare('INSERT INTO discounts (category_ids,product_ids,discount_code,discount_type,discount_value,start_date,end_date) VALUES (?,?,?,?,?,?,?)'); - $stmt->execute([ $categories_list, $products_list, $_POST['discount_code'], $_POST['discount_type'], $_POST['discount_value'], date('Y-m-d H:i:s', strtotime($_POST['start_date'])), date('Y-m-d H:i:s', strtotime($_POST['end_date'])) ]); - // Remove session discount code - if (isset($_SESSION['discount'])) { - unset($_SESSION['discount']); - } - header('Location: index.php?page=discounts&success_msg=1'); - exit; - } -} -?> - - -
- -
-

Discount

- Cancel - - - - -
- -
- -
- - - - - -
- - - × - - - - -
- - - -
-
- - -
- - - × - - - - -
- - - -
-
- - - - - - - - - - - - - -
- -
- -
- - \ No newline at end of file diff --git a/admin/discounts.php b/admin/discounts.php deleted file mode 100644 index 0d2b79a..0000000 --- a/admin/discounts.php +++ /dev/null @@ -1,89 +0,0 @@ -prepare('SELECT d.*, GROUP_CONCAT(DISTINCT p.name) product_names, GROUP_CONCAT(DISTINCT c.name) category_names FROM discounts d LEFT JOIN products p ON FIND_IN_SET(p.id, d.product_ids) LEFT JOIN categories c ON FIND_IN_SET(c.id, d.category_ids) GROUP BY d.id, d.category_ids, d.product_ids, d.discount_code, d.discount_type, d.discount_type, d.discount_value, d.start_date, d.end_date'); -$stmt->execute(); -$discounts = $stmt->fetchAll(PDO::FETCH_ASSOC); -// Get the current date -$current_date = strtotime((new DateTime())->format('Y-m-d H:i:s')); -// Handle success messages -if (isset($_GET['success_msg'])) { - if ($_GET['success_msg'] == 1) { - $success_msg = 'Discount created successfully!'; - } - if ($_GET['success_msg'] == 2) { - $success_msg = 'Discount updated successfully!'; - } - if ($_GET['success_msg'] == 3) { - $success_msg = 'Discount deleted successfully!'; - } -} -?> - - -
-
- -
-

Discounts

-

View, create, and edit discounts.

-
-
-
- - -
- -

- -
- - -
- Create Discount -
- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#CodeActiveCategoriesProductsTypeValueStart DateEnd DateActions
There are no discounts
= strtotime($discount['start_date']) && $current_date <= strtotime($discount['end_date']) ? 'Yes' : 'No'?>Edit
-
-
- - \ No newline at end of file diff --git a/admin/emailtemplates.php b/admin/emailtemplates.php index d085f8a..e5f9a97 100644 --- a/admin/emailtemplates.php +++ b/admin/emailtemplates.php @@ -3,15 +3,15 @@ defined('admin') or exit; // Capture post data if (isset($_POST['emailtemplate'], $_POST['emailtemplate2'])) { // Save templates - file_put_contents('../order-details-template.php', $_POST['emailtemplate']); - file_put_contents('../order-notification-template.php', $_POST['emailtemplate2']); + file_put_contents(dirname(__FILE__,-1).'/custom/mail/order-details-template.php', $_POST['emailtemplate']); + file_put_contents(dirname(__FILE__,-1).'/custom/mail/order-notification-template.php', $_POST['emailtemplate2']); header('Location: index.php?page=emailtemplates&success_msg=1'); exit; } // Read the order details template PHP file -$contents = file_get_contents('../order-details-template.php'); +$contents = file_get_contents(dirname(__FILE__,-1).'/custom/mail/order-details-template.php'); // Read the order notification template PHP file -$contents2 = file_get_contents('../order-notification-template.php'); +$contents2 = file_get_contents(dirname(__FILE__,-1).'/custom/mail/order-notification-template.php'); // Handle success messages if (isset($_GET['success_msg'])) { if ($_GET['success_msg'] == 1) { diff --git a/admin/factuur.php b/admin/factuur.php deleted file mode 100644 index 8bedda4..0000000 --- a/admin/factuur.php +++ /dev/null @@ -1,60 +0,0 @@ -loadHtml($data); - -// (Optional) Setup the paper size and orientation -$dompdf->setPaper('A4', 'portrait'); - -// Render the HTML as PDF -$dompdf->render(); - -$file_name = 'Factuur - '.$order_id; - -// Output the generated PDF to Browser -if (isset($_POST['email_invoice']) || $_POST['status'] == 'Paid'){ - $to = $customer_email; - $subject = 'Factuur - '.$order_id; - $message = $data; - $attachment = $dompdf->output(); - $attachment_name = $file_name; - - $header_redirect = 'Location: index.php?page=order&id='.$order_id; - //Send to PHPMailer - send_mail_by_PHPMailer($to, $subject, $message, $attachment, $attachment_name); - header($header_redirect); - exit; -} - -if (isset($_POST['email_invoice_to_admin']) || $_POST['status'] == 'Paid'){ - $to = $customer_email; - $subject = 'Factuur - '.$order_id; - $message = $data; - $attachment = $dompdf->output(); - $attachment_name = $file_name; - - $header_redirect = 'Location: index.php?page=order&id='.$order_id; - //Send to PHPMailer - if(invoice_bookkeeping){ - send_mail_by_PHPMailer(email_bookkeeping, $subject, $data, $attachment, $subject); - } - - header($header_redirect); - exit; -} - -if (isset($_POST['show_invoice'])){ - ob_end_clean(); - $dompdf->stream("Factuur.pdf", array("Attachment" => false)); - exit; -} - - -?> \ No newline at end of file diff --git a/admin/language.php b/admin/language.php index f1b06f7..420587e 100644 --- a/admin/language.php +++ b/admin/language.php @@ -3,15 +3,15 @@ defined('admin') or exit; // Capture post data if (isset($_POST['language_US'], $_POST['language_NL'])) { // Save templates - file_put_contents('../custom/translations/translations_US.php', $_POST['language_US']); - file_put_contents('../custom/translations/translations_NL.php', $_POST['language_NL']); + file_put_contents(dirname(__FILE__,-1).'/custom/translations/translations_US.php', $_POST['language_US']); + file_put_contents(dirname(__FILE__,-1).'/custom/translations/translations_NL.php', $_POST['language_NL']); header('Location: index.php?page=language&success_msg=1'); exit; } // Read language_US template PHP file -$contents = file_get_contents('../custom/translations/translations_US.php'); +$contents = file_get_contents(dirname(__FILE__,-1).'/custom/translations/translations_US.php'); // Read language template PHP file -$contents2 = file_get_contents('../custom/translations/translations_NL.php'); +$contents2 = file_get_contents(dirname(__FILE__,-1).'/custom/translations/translations_NL.php'); // Handle success messages if (isset($_GET['success_msg'])) { if ($_GET['success_msg'] == 1) { diff --git a/admin/media.php b/admin/media.php deleted file mode 100644 index 36be3cb..0000000 --- a/admin/media.php +++ /dev/null @@ -1,99 +0,0 @@ -prepare('SELECT COUNT(*) AS total FROM media ' . $where); -if ($search) $stmt->bindParam('search', $param3, PDO::PARAM_STR); -$stmt->execute(); -$media_total = $stmt->fetchColumn(); -// SQL query to get all media from the "media" table -$stmt = $pdo->prepare('SELECT * FROM media ' . $where . ' ORDER BY ' . $order_by . ' ' . $order . ' LIMIT :start_results,:num_results'); -// Bind params -$stmt->bindParam('start_results', $param1, PDO::PARAM_INT); -$stmt->bindParam('num_results', $param2, PDO::PARAM_INT); -if ($search) $stmt->bindParam('search', $param3, PDO::PARAM_STR); -$stmt->execute(); -// Retrieve query results -$media = $stmt->fetchAll(PDO::FETCH_ASSOC); -// Determine the URL -$url = 'index.php?page=media&search=' . $search; -?> - - -
-
- -
-

Media

-

View, manage, and search media files.

-
-
-
- - -
- -

- -
- - - -
- Upload -
- - - - -
-
- -
-
- - - <?=$m['caption']?> - - -
-
- - - - \ No newline at end of file diff --git a/admin/order.php b/admin/order.php deleted file mode 100644 index 49b5ae3..0000000 --- a/admin/order.php +++ /dev/null @@ -1,290 +0,0 @@ -prepare('SELECT ti.*, p.productcode, p.name FROM transactions t JOIN transactions_items ti ON ti.txn_id = t.txn_id LEFT JOIN products p ON p.id = ti.item_id WHERE t.id = ?'); -$stmt->execute([ $_GET['id'] ]); -$order_items = $stmt->fetchAll(PDO::FETCH_ASSOC); -// Retrieve order details -$stmt = $pdo->prepare('SELECT a.email, a.id AS a_id, a.first_name AS a_first_name, a.last_name AS a_last_name, a.address_street AS a_address_street, a.address_city AS a_address_city, a.address_state AS a_address_state, a.address_zip AS a_address_zip, a.address_country AS a_address_country, a.address_phone AS a_address_phone, t.* FROM transactions t LEFT JOIN transactions_items ti ON ti.txn_id = t.txn_id LEFT JOIN accounts a ON a.id = t.account_id WHERE t.id = ?'); -$stmt->execute([ $_GET['id'] ]); -$order = $stmt->fetch(PDO::FETCH_ASSOC); - -// Get tax -$stmt = $pdo->prepare('SELECT * FROM taxes WHERE country = ?'); -$stmt->execute([$order['a_address_country']]); -$tax = $stmt->fetch(PDO::FETCH_ASSOC); -$tax_rate = $tax ? $tax['rate'] : 0.00; - -//Add giftcards -if (isset($_GET['add_giftcard'])){ - createGiftCart($pdo, $order['txn_id']); -} - -//Get connected giftcards -$giftcards_template = $order['txn_id'].'#%#%'; -$stmt = $pdo->prepare('SELECT * from discounts WHERE discount_code like ?'); -$stmt->execute([$giftcards_template]); -$giftcards = $stmt->fetchAll(PDO::FETCH_ASSOC); - -// Get the current date -$current_date = strtotime((new DateTime())->format('Y-m-d H:i:s')); - -// Delete transaction -if (isset($_GET['delete'])) { - // Delete the transaction - $stmt = $pdo->prepare('DELETE t, ti FROM transactions t LEFT JOIN transactions_items ti ON ti.txn_id = t.txn_id WHERE t.id = ?'); - $stmt->execute([ $_GET['id'] ]); - - // Deactive giftcards - removeGiftCart($pdo, $_GET['txn']); - - header('Location: index.php?page=orders&success_msg=3'); - exit; -} -if (!$order) { - exit('Invalid ID!'); -} - -?> - - -
-

Order #

- Cancel - Delete - Edit -
- -
-
-
- Order Details -
-
-

Order ID

-

-
-
-

Transaction ID

-

-
- -
-

Shipping Method

-

-
- -
-

Payment Method

-

-
-
-

Payment Status

-

-
-
-

Date

-

-
- -
-

Discount Code

-

-
- -
- -
-
- Account Details -
- -
-

Email

-

-
-
-

Name

-

-
-
-

Address

-


-
-
-
- -

-
-
-

Contact

-

-

-
- -

The order is not associated with an account.

- -
- -
-
- Customer Details -
-
-

Email

-

-
-
-

Name

-

-
-
-

Address

-


-
-
-
- -

-
-
-

Contact

-

-

-
-
-
- -
-
- Order -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ProductOptionsQtyPriceTotal
There are no order items
Subtotal
Shipping
Discount
VAT
Total
-
-
- -
-
- Giftcards -
-
- Relate giftcards - - - - - - - - - - - - - - - - - - - - - - - - - - -
GiftcardValidValue
There are no order items
= strtotime($giftcard['start_date']) && $current_date <= strtotime($giftcard['end_date']) ? 'Yes' : 'No'?>
-
-
- -
-
- Invoice -
-
- - - - - - -
-
- - -
-
-
- - -
-
-
- - -
-
-
-
- - \ No newline at end of file diff --git a/admin/order_manage.php b/admin/order_manage.php deleted file mode 100644 index daa29d7..0000000 --- a/admin/order_manage.php +++ /dev/null @@ -1,261 +0,0 @@ - '', - 'payment_amount' => '', - 'payment_status' => '', - 'payer_email' => '', - 'first_name' => '', - 'last_name' => '', - 'account_id' => '', - 'payment_method' => '', - 'discount_code' => '', - 'address_street' => '', - 'address_city' => '', - 'address_state' => '', - 'address_zip' => '', - 'address_country' => '', - 'shipping_method' => '', - 'shipping_amount' => '', - 'created' => date('Y-m-d\TH:i'), - 'address_phone' => '' -]; -// Retrieve the products from the database -$stmt = $pdo->prepare('SELECT * FROM products ORDER BY id'); -$stmt->execute(); -$products = $stmt->fetchAll(PDO::FETCH_ASSOC); -// Retrieve the accounts from the database -$stmt = $pdo->prepare('SELECT * FROM accounts ORDER BY id'); -$stmt->execute(); -$accounts = $stmt->fetchAll(PDO::FETCH_ASSOC); -// Add transactions items to the database -function addOrderItems($pdo, $txn_id) { - if (isset($_POST['item_id']) && is_array($_POST['item_id']) && count($_POST['item_id']) > 0) { - // Iterate items - $delete_list = []; - for ($i = 0; $i < count($_POST['item_id']); $i++) { - // If the item doesnt exist in the database - if (!intval($_POST['item_id'][$i])) { - // Insert new item - $stmt = $pdo->prepare('INSERT INTO transactions_items (txn_id,item_id,item_price,item_quantity,item_options) VALUES (?,?,?,?,?)'); - $stmt->execute([ $txn_id, $_POST['item_product'][$i], $_POST['item_price'][$i], $_POST['item_quantity'][$i], $_POST['item_options'][$i] ]); - $delete_list[] = $pdo->lastInsertId(); - } else { - // Update existing item - $stmt = $pdo->prepare('UPDATE transactions_items SET txn_id = ?, item_id = ?, item_price = ?, item_quantity = ?, item_options = ? WHERE id = ?'); - $stmt->execute([ $txn_id, $_POST['item_product'][$i], $_POST['item_price'][$i], $_POST['item_quantity'][$i], $_POST['item_options'][$i], $_POST['item_id'][$i] ]); - $delete_list[] = $_POST['item_id'][$i]; - } - } - // Delete item - $in = str_repeat('?,', count($delete_list) - 1) . '?'; - $stmt = $pdo->prepare('DELETE FROM transactions_items WHERE txn_id = ? AND id NOT IN (' . $in . ')'); - $stmt->execute(array_merge([ $txn_id ], $delete_list)); - } else { - // No item exists, delete all - $stmt = $pdo->prepare('DELETE FROM transactions_items WHERE txn_id = ?'); - $stmt->execute([ $txn_id ]); - } -} -// Save captured data -if (isset($_GET['id'])) { - // Retrieve the transaction from the database - $stmt = $pdo->prepare('SELECT * FROM transactions WHERE id = ?'); - $stmt->execute([ $_GET['id'] ]); - $transaction = $stmt->fetch(PDO::FETCH_ASSOC); - // Retrieve the transaction items from the database - $stmt = $pdo->prepare('SELECT * FROM transactions_items WHERE txn_id = ?'); - $stmt->execute([ $transaction['txn_id'] ]); - $transactions_items = $stmt->fetchAll(PDO::FETCH_ASSOC); - // ID param exists, edit an existing transaction - $page = 'Edit'; - if (isset($_POST['submit'])) { - // Update the transaction - $stmt = $pdo->prepare('UPDATE transactions SET txn_id = ?, payment_amount = ?, payment_status = ?, created = ?, payer_email = ?, first_name = ?, last_name = ?, address_street = ?, address_city = ?, address_state = ?, address_zip = ?, address_country = ?, account_id = ?, payment_method = ?, discount_code = ?, shipping_method = ?, shipping_amount = ?, address_phone= ? WHERE id = ?'); - $stmt->execute([ $_POST['txn_id'], $_POST['amount'], $_POST['status'], date('Y-m-d H:i:s', strtotime($_POST['created'])), $_POST['email'], $_POST['first_name'], $_POST['last_name'], $_POST['address_street'], $_POST['address_city'], $_POST['address_state'], $_POST['address_zip'], $_POST['address_country'], empty($_POST['account']) ? NULL : $_POST['account'], $_POST['method'], $_POST['discount_code'], $_POST['shipping_method'], $_POST['shipping_amount'], $_POST['address_phone'], $_GET['id'] ]); - addOrderItems($pdo, $_POST['txn_id']); - - if ($_POST['status'] == 'Paid'){ - createGiftCart($pdo, $_POST['txn_id']); - include_once('./factuur.php'); - } - - header('Location: index.php?page=orders&success_msg=2'); - exit; - } - if (isset($_POST['delete'])) { - // Delete the transaction - $stmt = $pdo->prepare('DELETE t, ti FROM transactions t LEFT JOIN transactions_items ti ON ti.txn_id = t.txn_id WHERE t.id = ?'); - $stmt->execute([ $_GET['id'] ]); - - // Deactive giftcards - removeGiftCart($pdo, $_POST['txn_id']); - - header('Location: index.php?page=orders&success_msg=3'); - exit; - } -} else { - // Create a new transaction - $page = 'Create'; - if (isset($_POST['submit'])) { - $stmt = $pdo->prepare('INSERT INTO transactions (txn_id,payment_amount,payment_status,created,payer_email,first_name,last_name,address_street,address_city,address_state,address_zip,address_country,account_id,payment_method,discount_code,shipping_method,shipping_amount, address_phone) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)'); - $stmt->execute([ $_POST['txn_id'], $_POST['amount'], $_POST['status'], date('Y-m-d H:i:s', strtotime($_POST['created'])), $_POST['email'], $_POST['first_name'], $_POST['last_name'], $_POST['address_street'], $_POST['address_city'], $_POST['address_state'], $_POST['address_zip'], $_POST['address_country'], empty($_POST['account']) ? NULL : $_POST['account'], $_POST['method'], $_POST['discount_code'], $_POST['shipping_method'], $_POST['shipping_amount'], $_POST['address_phone'] ]); - addOrderItems($pdo, $_POST['txn_id']); - header('Location: index.php?page=orders&success_msg=1'); - exit; - } -} -?> - - -
- -
-

Order

- Cancel - - - - -
- -
- Details - Address - Items -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- -
- -
- - - - - - - - - - - - - - - - - - - -
- -
- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
ProductPriceQuantityOptions
There are no order items
- - -
- Add Item -
-
- -
- - \ No newline at end of file diff --git a/admin/orders.php b/admin/orders.php deleted file mode 100644 index ce7fb23..0000000 --- a/admin/orders.php +++ /dev/null @@ -1,172 +0,0 @@ -prepare('SELECT COUNT(DISTINCT t.id) AS total FROM transactions t LEFT JOIN transactions_items ti ON ti.txn_id = t.txn_id ' . $where); -if ($search) $stmt->bindParam('search', $param3, PDO::PARAM_STR); -if ($account_id) $stmt->bindParam('account_id', $account_id, PDO::PARAM_INT); -$stmt->execute(); -$orders_total = $stmt->fetchColumn(); -// Retrieve transactions -$stmt = $pdo->prepare('SELECT t.*, COUNT(ti.id) AS total_products FROM transactions t LEFT JOIN transactions_items ti ON ti.txn_id = t.txn_id ' . $where . ' GROUP BY t.id, t.txn_id, t.payment_amount, t.payment_status, t.created, t.payer_email, t.first_name, t.last_name, t.address_street, t.address_city, t.address_state, t.address_zip, t.address_country, t.account_id, t.payment_method, t.discount_code, t.shipping_method, t.shipping_amount ORDER BY ' . $order_by . ' ' . $order . ' LIMIT :start_results,:num_results'); -// Bind params -$stmt->bindParam('start_results', $param1, PDO::PARAM_INT); -$stmt->bindParam('num_results', $param2, PDO::PARAM_INT); -if ($search) $stmt->bindParam('search', $param3, PDO::PARAM_STR); -if ($account_id) $stmt->bindParam('account_id', $account_id, PDO::PARAM_INT); -$stmt->execute(); -// Retrieve query results -$orders = $stmt->fetchAll(PDO::FETCH_ASSOC); -// Determine the URL -$url = 'index.php?page=orders&search=' . $search . '&status=' . $status . '&method=' . $method . '&account_id=' . $account_id; -// Handle success messages -if (isset($_GET['success_msg'])) { - if ($_GET['success_msg'] == 1) { - $success_msg = 'Order created successfully!'; - } - if ($_GET['success_msg'] == 2) { - $success_msg = 'Order updated successfully!'; - } - if ($_GET['success_msg'] == 3) { - $success_msg = 'Order deleted successfully!'; - } -} -?> - - -
-
- -
-

Orders

-

View, create, and search orders.

-
-
-
- - -
- -

- -
- - -
- Create Order -
- -
- Filters -
- - - -
-
- -
-
- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#CustomerEmailProductsTotalMethodStatusDateActions
There are no orders
View Edit
-
-
- - - - \ No newline at end of file diff --git a/admin/product.php b/admin/product.php deleted file mode 100644 index de5483c..0000000 --- a/admin/product.php +++ /dev/null @@ -1,437 +0,0 @@ - '', - 'description' => '', - 'price' => '', - 'rrp' => '', - 'quantity' => '', - 'date_added' => date('Y-m-d\TH:i'), - 'media' => [], - 'categories' => [], - 'options' => [], - 'downloads' => [], - 'weight' => '', - 'url_slug' => '', - 'status' => 1, - 'productcode' => '' -]; -// Get all the categories from the database -$stmt = $pdo->query('SELECT * FROM categories'); -$stmt->execute(); -$categories = $stmt->fetchAll(PDO::FETCH_ASSOC); -// Add product images to the database -function addProductImages($pdo, $product_id) { - // Get the total number of media - if (isset($_POST['media']) && is_array($_POST['media']) && count($_POST['media']) > 0) { - // Iterate media - $delete_list = []; - for ($i = 0; $i < count($_POST['media']); $i++) { - // If the media doesnt exist in the database - if (!intval($_POST['media_product_id'][$i])) { - // Insert new media - $stmt = $pdo->prepare('INSERT INTO products_media (product_id,media_id,position) VALUES (?,?,?)'); - $stmt->execute([ $product_id, $_POST['media'][$i], $_POST['media_position'][$i] ]); - $delete_list[] = $pdo->lastInsertId(); - } else { - // Update existing media - $stmt = $pdo->prepare('UPDATE products_media SET position = ? WHERE id = ?'); - $stmt->execute([ $_POST['media_position'][$i], $_POST['media_product_id'][$i] ]); - $delete_list[] = $_POST['media_product_id'][$i]; - } - } - // Delete media - $in = str_repeat('?,', count($delete_list) - 1) . '?'; - $stmt = $pdo->prepare('DELETE FROM products_media WHERE product_id = ? AND id NOT IN (' . $in . ')'); - $stmt->execute(array_merge([ $product_id ], $delete_list)); - } else { - // No media exists, delete all - $stmt = $pdo->prepare('DELETE FROM products_media WHERE product_id = ?'); - $stmt->execute([ $product_id ]); - } -} -// Add product categories to the database -function addProductCategories($pdo, $product_id) { - if (isset($_POST['categories']) && is_array($_POST['categories']) && count($_POST['categories']) > 0) { - $in = str_repeat('?,', count($_POST['categories']) - 1) . '?'; - $stmt = $pdo->prepare('DELETE FROM products_categories WHERE product_id = ? AND category_id NOT IN (' . $in . ')'); - $stmt->execute(array_merge([ $product_id ], $_POST['categories'])); - foreach ($_POST['categories'] as $cat) { - $stmt = $pdo->prepare('INSERT IGNORE INTO products_categories (product_id,category_id) VALUES (?,?)'); - $stmt->execute([ $product_id, $cat ]); - } - } else { - $stmt = $pdo->prepare('DELETE FROM products_categories WHERE product_id = ?'); - $stmt->execute([ $product_id ]); - } -} -// Add product options to the database -function addProductOptions($pdo, $product_id) { - if (isset($_POST['option_title']) && is_array($_POST['option_title']) && count($_POST['option_title']) > 0) { - $delete_list = []; - for ($i = 0; $i < count($_POST['option_title']); $i++) { - $delete_list[] = $_POST['option_title'][$i] . '__' . $_POST['option_name'][$i]; - $stmt = $pdo->prepare('INSERT INTO products_options (title,name,quantity,price,price_modifier,weight,weight_modifier,type,required,position,product_id) VALUES (?,?,?,?,?,?,?,?,?,?,?) ON DUPLICATE KEY UPDATE quantity = VALUES(quantity), price = VALUES(price), price_modifier = VALUES(price_modifier), weight = VALUES(weight), weight_modifier = VALUES(weight_modifier), type = VALUES(type), required = VALUES(required), position = VALUES(position)'); - $stmt->execute([ $_POST['option_title'][$i], $_POST['option_name'][$i], empty($_POST['option_quantity'][$i]) ? -1 : $_POST['option_quantity'][$i], empty($_POST['option_price'][$i]) ? 0.00 : $_POST['option_price'][$i], $_POST['option_price_modifier'][$i], empty($_POST['option_weight'][$i]) ? 0.00 : $_POST['option_weight'][$i], $_POST['option_weight_modifier'][$i], $_POST['option_type'][$i], $_POST['option_required'][$i], $_POST['option_position'][$i], $product_id ]); - } - $in = str_repeat('?,', count($delete_list) - 1) . '?'; - $stmt = $pdo->prepare('DELETE FROM products_options WHERE product_id = ? AND CONCAT(title, "__", name) NOT IN (' . $in . ')'); - $stmt->execute(array_merge([ $product_id ], $delete_list)); - } else { - $stmt = $pdo->prepare('DELETE FROM products_options WHERE product_id = ?'); - $stmt->execute([ $product_id ]); - } -} -// Add product downloads to the database -function addProductDownloads($pdo, $product_id) { - if (isset($_POST['download_file_path']) && is_array($_POST['download_file_path']) && count($_POST['download_file_path']) > 0) { - $delete_list = []; - for ($i = 0; $i < count($_POST['download_file_path']); $i++) { - $delete_list[] = $_POST['download_file_path'][$i]; - $stmt = $pdo->prepare('INSERT INTO products_downloads (product_id,file_path,position) VALUES (?,?,?) ON DUPLICATE KEY UPDATE position = VALUES(position)'); - $stmt->execute([ $product_id, $_POST['download_file_path'][$i], $_POST['download_position'][$i] ]); - } - $in = str_repeat('?,', count($delete_list) - 1) . '?'; - $stmt = $pdo->prepare('DELETE FROM products_downloads WHERE product_id = ? AND file_path NOT IN (' . $in . ')'); - $stmt->execute(array_merge([ $product_id ], $delete_list)); - } else { - $stmt = $pdo->prepare('DELETE FROM products_downloads WHERE product_id = ?'); - $stmt->execute([ $product_id ]); - } -} -if (isset($_GET['id'])) { - // ID param exists, edit an existing product - $page = 'Edit'; - if (isset($_POST['submit'])) { - - //decode product_config to JSON - $product_config = $_POST['product_config'] ?? ''; - $productcode = $_POST['productcode'] ?? ''; - // Update the product - $stmt = $pdo->prepare('UPDATE products SET name = ?, description = ?, price = ?, rrp = ?, quantity = ?, date_added = ?, weight = ?, url_slug = ?, status = ?, product_config = ?, productcode = ? WHERE id = ?'); - $stmt->execute([ $_POST['name'], $_POST['description'], empty($_POST['price']) ? 0.00 : $_POST['price'], empty($_POST['rrp']) ? 0.00 : $_POST['rrp'], $_POST['quantity'], date('Y-m-d H:i:s', strtotime($_POST['date'])), empty($_POST['weight']) ? 0.00 : $_POST['weight'], $_POST['url_slug'], $_POST['status'], $product_config, $productcode, $_GET['id'] ]); - addProductImages($pdo, $_GET['id']); - addProductCategories($pdo, $_GET['id']); - addProductOptions($pdo, $_GET['id']); - addProductDownloads($pdo, $_GET['id']); - // Clear session cart - if (isset($_SESSION['cart'])) { - unset($_SESSION['cart']); - } - header('Location: index.php?page=products&success_msg=2'); - exit; - } - if (isset($_POST['delete'])) { - // Redirect and delete product - header('Location: index.php?page=products&delete=' . $_GET['id']); - exit; - } - // Get the product and its images from the database - $stmt = $pdo->prepare('SELECT * FROM products WHERE id = ?'); - $stmt->execute([ $_GET['id'] ]); - $product = $stmt->fetch(PDO::FETCH_ASSOC); - // get product media - $stmt = $pdo->prepare('SELECT m.*, pm.position, pm.id AS product_id FROM media m JOIN products_media pm ON pm.media_id = m.id JOIN products p ON p.id = pm.product_id WHERE p.id = ? ORDER BY pm.position'); - $stmt->execute([ $_GET['id'] ]); - $product['media'] = $stmt->fetchAll(PDO::FETCH_ASSOC); - // Get the product categories - $stmt = $pdo->prepare('SELECT c.name, c.id FROM products_categories pc JOIN categories c ON c.id = pc.category_id WHERE pc.product_id = ?'); - $stmt->execute([ $_GET['id'] ]); - $product['categories'] = $stmt->fetchAll(PDO::FETCH_ASSOC); - // Get the product options - $stmt = $pdo->prepare('SELECT title, type, GROUP_CONCAT(name) AS list FROM products_options WHERE product_id = ? GROUP BY title, type, position ORDER BY position'); - $stmt->execute([ $_GET['id'] ]); - $product['options'] = $stmt->fetchAll(PDO::FETCH_ASSOC); - // Get the product full options - $stmt = $pdo->prepare('SELECT * FROM products_options WHERE product_id = ? ORDER BY id'); - $stmt->execute([ $_GET['id'] ]); - $product['options_full'] = $stmt->fetchAll(PDO::FETCH_ASSOC); - // Get the product downloads - $stmt = $pdo->prepare('SELECT * FROM products_downloads WHERE product_id = ? ORDER BY position'); - $stmt->execute([ $_GET['id'] ]); - $product['downloads'] = $stmt->fetchAll(PDO::FETCH_ASSOC); -} else { - // Create a new product - $page = 'Create'; - if (isset($_POST['submit'])) { - $product_config = $_POST['product_config'] ?? ''; - $productcode = $_POST['productcode'] ?? ''; - $stmt = $pdo->prepare('INSERT INTO products (name,description,price,rrp,quantity,date_added,weight,url_slug,status, product_config, productcode) VALUES (?,?,?,?,?,?,?,?,?,?,?)'); - $stmt->execute([ $_POST['name'], $_POST['description'], empty($_POST['price']) ? 0.00 : $_POST['price'], empty($_POST['rrp']) ? 0.00 : $_POST['rrp'], $_POST['quantity'], date('Y-m-d H:i:s', strtotime($_POST['date'])), empty($_POST['weight']) ? 0.00 : $_POST['weight'], $_POST['url_slug'], $_POST['status'], $product_config, $productcode ]); - $id = $pdo->lastInsertId(); - addProductImages($pdo, $id); - addProductCategories($pdo, $id); - addProductOptions($pdo, $id); - addProductDownloads($pdo, $id); - // Clear session cart - if (isset($_SESSION['cart'])) { - unset($_SESSION['cart']); - } - header('Location: index.php?page=products&success_msg=1'); - exit; - } -} -?> - - -
- -
-

Product

- Cancel - - - - -
- -
- General - Media - Configuration - Options - Downloads -
- - -
- -
- - - - - - - - - - - - - - - - - - - - - - -
- - - × - - - - -
- - - -
-
- - - - - - - - - - -
- -
- - -
- -
- -

Images

- -
- - $media): ?> -
- - - - -
-

-

-
-
- - - -
- - - -
- - - -

There are no images.

- -
- - Add Media - -
- -
- - -
- -
- -

Available Images

- -
- -
- $media): ?> - - - - - - - -
- - -

There are no images.

- -
- -

Available Options

-
- - $option): ?> -
- - -

- -

- -
- - - -

There are no options.

- -
- -

Configuration JSON Profile

- - -
- -
- - -
- -
- -

Options (be aware of changing optionIDs)

- -
- - $option): ?> -
- -
-

()

-

-
-
- - - - -
- - -
- - - - - - - - - - -
- -
- - - -

There are no options.

- -
- - Add Option - -
- -
- - -
- -
- -

Digital Downloads

- -
- - $download): ?> - -
- -
-

-

,

-
-
- - - -
-
- - -
-
- - - -

There are no digital downloads.

- -
- - Add Digital Download - -
- -
- -
- - \ No newline at end of file diff --git a/admin/products.php b/admin/products.php deleted file mode 100644 index fdcc11e..0000000 --- a/admin/products.php +++ /dev/null @@ -1,177 +0,0 @@ -prepare('SELECT COUNT(*) AS total FROM products p ' . $where); -if ($search) $stmt->bindParam('search', $param3, PDO::PARAM_STR); -$stmt->execute(); -$products_total = $stmt->fetchColumn(); -// SQL query to get all products from the "products" table -$stmt = $pdo->prepare('SELECT p.*, GROUP_CONCAT(m2.full_path) AS imgs FROM products p LEFT JOIN (SELECT pm.id, pm.product_id, m.full_path FROM products_media pm JOIN media m ON m.id = pm.media_id GROUP BY pm.id, pm.product_id, m.full_path) m2 ON m2.product_id = p.id ' . $where . ' GROUP BY p.id, p.name, p.description, p.price, p.rrp, p.quantity, p.date_added, p.weight, p.url_slug, p.status ORDER BY ' . $order_by . ' ' . $order . ' LIMIT :start_results,:num_results'); -// Bind params -$stmt->bindParam('start_results', $param1, PDO::PARAM_INT); -$stmt->bindParam('num_results', $param2, PDO::PARAM_INT); -if ($search) $stmt->bindParam('search', $param3, PDO::PARAM_STR); -$stmt->execute(); -// Retrieve query results -$products = $stmt->fetchAll(PDO::FETCH_ASSOC); -// Delete product -if (isset($_GET['delete'])) { - // Delete the product - $stmt = $pdo->prepare('DELETE p, pm, po, pc FROM products p LEFT JOIN products_media pm ON pm.product_id = p.id LEFT JOIN products_options po ON po.product_id = p.id LEFT JOIN products_categories pc ON pc.product_id = p.id WHERE p.id = ?'); - $stmt->execute([ $_GET['delete'] ]); - // Clear session cart - if (isset($_SESSION['cart'])) { - unset($_SESSION['cart']); - } - header('Location: index.php?page=products&success_msg=3'); - exit; -} -// Handle success messages -if (isset($_GET['success_msg'])) { - if ($_GET['success_msg'] == 1) { - $success_msg = 'Product created successfully!'; - } - if ($_GET['success_msg'] == 2) { - $success_msg = 'Product updated successfully!'; - } - if ($_GET['success_msg'] == 3) { - $success_msg = 'Product deleted successfully!'; - } -} -// Determine the URL -$url = 'index.php?page=products&search=' . $search . '&status=' . $status . '&quantity=' . $quantity; -?> - - -
-
- -
-

Products

-

View, manage, and search products.

-
-
-
- - -
- -

- -
- - -
- Create Product -
- -
- Filters -
- - - - -
-
- -
-
- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#ProductcodeNamePriceQuantityImagesDate AddedStatusActions
There are no products
- - - <?=$img?> - - - Edit
-
-
- - - - \ No newline at end of file diff --git a/admin/settings.php b/admin/settings.php deleted file mode 100644 index ebd1f98..0000000 --- a/admin/settings.php +++ /dev/null @@ -1,109 +0,0 @@ -' . format_key($key) . ''; - if ($type == 'checkbox') { - $html .= ''; - } - $html .= ''; - return $html; -} -// Format tabs -function format_tabs($contents) { - $rows = explode("\n", $contents); - echo '
'; - echo 'General'; - for ($i = 0; $i < count($rows); $i++) { - preg_match('/\/\*(.*?)\*\//', $rows[$i], $match); - if ($match) { - echo '' . $match[1] . ''; - } - } - echo '
'; -} -// Format form -function format_form($contents) { - $rows = explode("\n", $contents); - echo '
'; - for ($i = 0; $i < count($rows); $i++) { - preg_match('/\/\*(.*?)\*\//', $rows[$i], $match); - if ($match) { - echo '
'; - } - preg_match('/define\(\'(.*?)\', ?(.*?)\)/', $rows[$i], $match); - if ($match) { - echo format_var_html($match[1], $match[2]); - } - } - echo '
'; -} -if (!empty($_POST)) { - // Update the configuration file with the new keys and values - foreach ($_POST as $k => $v) { - $v = in_array(strtolower($v), ['true', 'false']) ? strtolower($v) : '\'' . $v . '\''; - $contents = preg_replace('/define\(\'' . $k . '\'\, ?(.*?)\)/s', 'define(\'' . $k . '\',' . $v . ')', $contents); - } - file_put_contents('../custom/settings/config.php', $contents); - header('Location: index.php?page=settings&success_msg=1'); - exit; -} -// Handle success messages -if (isset($_GET['success_msg'])) { - if ($_GET['success_msg'] == 1) { - $success_msg = 'Settings updated successfully!'; - } -} -?> - - -
- -
-

Settings

- -
- - -
- -

- -
- - - -
-
- -
-
- -
- - - - \ No newline at end of file diff --git a/admin/shipping.php b/admin/shipping.php deleted file mode 100644 index 702ab30..0000000 --- a/admin/shipping.php +++ /dev/null @@ -1,83 +0,0 @@ -prepare('SELECT * FROM shipping'); -$stmt->execute(); -$shipping = $stmt->fetchAll(PDO::FETCH_ASSOC); -// Handle success messages -if (isset($_GET['success_msg'])) { - if ($_GET['success_msg'] == 1) { - $success_msg = 'Shipping method created successfully!'; - } - if ($_GET['success_msg'] == 2) { - $success_msg = 'Shipping method updated successfully!'; - } - if ($_GET['success_msg'] == 3) { - $success_msg = 'Shipping method deleted successfully!'; - } -} -?> - - -
-
- -
-

Shipping

-

View, create, and edit shipping methods.

-
-
-
- - -
- -

- -
- - -
- Create Shipping Method -
- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#NameTypeCountriesPrice RangeWeight RangeTotal Shipping PriceActions
There are no shipping methods
- lbs - lbsEdit
-
-
- - \ No newline at end of file diff --git a/admin/shipping_process.php b/admin/shipping_process.php deleted file mode 100644 index b92e945..0000000 --- a/admin/shipping_process.php +++ /dev/null @@ -1,116 +0,0 @@ - '', - 'price_from' => '', - 'price_to' => '', - 'weight_from' => '', - 'weight_to' => '', - 'price' => '', - 'type' => 'Single Product', - 'countries' => '' -]; -$types = ['Single Product', 'Entire Order']; -if (isset($_GET['id'])) { - // ID param exists, edit an existing shipping method - $page = 'Edit'; - if (isset($_POST['submit'])) { - // Update the shipping method - $countries_list = isset($_POST['countries']) ? implode(',', $_POST['countries']) : ''; - $stmt = $pdo->prepare('UPDATE shipping SET name = ?, price_from = ?, price_to = ?, weight_from = ?, weight_to = ?, price = ?, type = ?, countries = ? WHERE id = ?'); - $stmt->execute([ $_POST['name'], $_POST['price_from'], $_POST['price_to'], $_POST['weight_from'], $_POST['weight_to'], $_POST['price'], $_POST['type'], $countries_list, $_GET['id'] ]); - header('Location: index.php?page=shipping&success_msg=2'); - exit; - } - if (isset($_POST['delete'])) { - // Delete the shipping method - $stmt = $pdo->prepare('DELETE FROM shipping WHERE id = ?'); - $stmt->execute([ $_GET['id'] ]); - header('Location: index.php?page=shipping&success_msg=3'); - exit; - } - // Get the shipping method from the database - $stmt = $pdo->prepare('SELECT * FROM shipping WHERE id = ?'); - $stmt->execute([ $_GET['id'] ]); - $shipping = $stmt->fetch(PDO::FETCH_ASSOC); -} else { - // Create a new shipping method - $page = 'Create'; - if (isset($_POST['submit'])) { - $countries_list = isset($_POST['countries']) ? implode(',', $_POST['countries']) : ''; - $stmt = $pdo->prepare('INSERT INTO shipping (name, price_from, price_to, weight_from, weight_to, price, type, countries) VALUES (?,?,?,?,?,?,?,?)'); - $stmt->execute([ $_POST['name'], $_POST['price_from'], $_POST['price_to'], $_POST['weight_from'], $_POST['weight_to'], $_POST['price'], $_POST['type'], $countries_list ]); - header('Location: index.php?page=shipping&success_msg=1'); - exit; - } -} -?> - - -
- -
-

Shipping Method

- Cancel - - - - -
- -
- -
- - - - - - - - -
- - - - × - - - - -
- - - -
-
- - -
- -    —    - -
- - -
- -    —    - -
- - - - -
- -
- -
- - \ No newline at end of file diff --git a/admin/tax.php b/admin/tax.php deleted file mode 100644 index d616b08..0000000 --- a/admin/tax.php +++ /dev/null @@ -1,75 +0,0 @@ - '', - 'rate' => 0.00 -]; -if (isset($_GET['id'])) { - // ID param exists, edit an existing tax - $page = 'Edit'; - if (isset($_POST['submit'])) { - // Update the tax - $categories_list = isset($_POST['categories']) ? implode(',', $_POST['categories']) : ''; - $products_list = isset($_POST['products']) ? implode(',', $_POST['products']) : ''; - $stmt = $pdo->prepare('UPDATE taxes SET country = ?, rate = ? WHERE id = ?'); - $stmt->execute([ $_POST['country'], $_POST['rate'], $_GET['id'] ]); - header('Location: index.php?page=taxes&success_msg=2'); - exit; - } - if (isset($_POST['delete'])) { - // Delete the tax - $stmt = $pdo->prepare('DELETE FROM taxes WHERE id = ?'); - $stmt->execute([ $_GET['id'] ]); - header('Location: index.php?page=taxes&success_msg=3'); - exit; - } - // Get the tax from the database - $stmt = $pdo->prepare('SELECT * FROM taxes WHERE id = ?'); - $stmt->execute([ $_GET['id'] ]); - $tax = $stmt->fetch(PDO::FETCH_ASSOC); -} else { - // Create a new tax - $page = 'Create'; - if (isset($_POST['submit'])) { - $stmt = $pdo->prepare('INSERT INTO taxes (country,rate) VALUES (?,?)'); - $stmt->execute([ $_POST['country'], $_POST['rate'] ]); - header('Location: index.php?page=taxes&success_msg=1'); - exit; - } -} -?> - - -
- -
-

Tax

- Cancel - - - - -
- -
- -
- - - - - - - -
- -
- -
- - \ No newline at end of file diff --git a/admin/taxes.php b/admin/taxes.php deleted file mode 100644 index 26e40f9..0000000 --- a/admin/taxes.php +++ /dev/null @@ -1,75 +0,0 @@ -prepare('SELECT * FROM taxes ORDER BY country ASC'); -$stmt->execute(); -$taxes = $stmt->fetchAll(PDO::FETCH_ASSOC); -// Handle success messages -if (isset($_GET['success_msg'])) { - if ($_GET['success_msg'] == 1) { - $success_msg = 'Tax created successfully!'; - } - if ($_GET['success_msg'] == 2) { - $success_msg = 'Tax updated successfully!'; - } - if ($_GET['success_msg'] == 3) { - $success_msg = 'Tax deleted successfully!'; - } -} -?> - - -
-
- -
-

Taxes

-

View, create, and edit taxes.

-
-
-
- - -
- -

- -
- - -
- Create Tax -
- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - -
#CountryTax RateActions
There are no taxes
%Edit
-
-
- - \ No newline at end of file diff --git a/cart.php b/cart.php index 562dee1..02de368 100644 --- a/cart.php +++ b/cart.php @@ -1,6 +1,9 @@ Admin' : ''; $logout_link = isset($_SESSION['account_loggedin']) ? '' : ''; $site_name = site_name; $site_title = site_title; $base_url = base_url; $icon_image = icon_image; + $basename = url('index.php?'); + $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' ? ' ': ''; + //check for age_consent if (age_verification_enabled){ @@ -80,7 +84,6 @@ if (veliti_analytics){ $home_text $products_text $about_text - $admin_link