Wersja produkcyjna 1.0
This commit is contained in:
parent
b7781fccaa
commit
b56539d828
4
cart.php
4
cart.php
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/includes/header.php';
|
||||
require_once __DIR__ . '/includes/currency.php';
|
||||
require_once __DIR__ . '/includes/init.php';
|
||||
require_once __DIR__ . '/includes/html_head.php';
|
||||
require_once __DIR__ . '/includes/header.php';
|
||||
require_login();
|
||||
|
||||
$page_title = t('cart_header');
|
||||
|
||||
@ -69,7 +69,7 @@ $page_title = t('checkout_title');
|
||||
|
||||
require_once __DIR__ . '/includes/html_head.php';
|
||||
require_once __DIR__ . '/includes/header.php';
|
||||
require_once __DIR__ . '/includes/currency.php';
|
||||
|
||||
?>
|
||||
|
||||
<main class="container my-5">
|
||||
@ -147,4 +147,4 @@ require_once __DIR__ . '/includes/currency.php';
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<?php require_once __DIR__ . '/includes/footer.php'; ?>
|
||||
<?php require_once __DIR__ . '/includes/footer.php'; ?>
|
||||
1306
debug_price.log
1306
debug_price.log
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/init.php';
|
||||
|
||||
|
||||
|
||||
|
||||
@ -30,6 +30,15 @@ function get_status_translation(string $key): string {
|
||||
return $translated;
|
||||
}
|
||||
|
||||
function get_item_status_translation(string $key): string {
|
||||
$translation_key = 'status_' . $key;
|
||||
$translated = t($translation_key);
|
||||
if ($translated === $translation_key) {
|
||||
return ucfirst(str_replace('_', ' ', $key));
|
||||
}
|
||||
return $translated;
|
||||
}
|
||||
|
||||
|
||||
function sanitize_filename($filename) {
|
||||
// Keep the original extension
|
||||
@ -37,7 +46,7 @@ function sanitize_filename($filename) {
|
||||
$filename_without_ext = pathinfo($filename, PATHINFO_FILENAME);
|
||||
|
||||
// Replace spaces and special characters with underscores in the filename part
|
||||
$sanitized_filename = preg_replace('/[\s\\\/:*?"<>|.]+/', '_', $filename_without_ext);
|
||||
$sanitized_filename = preg_replace('/[\s\/:*?"<>|.]+/', '_', $filename_without_ext);
|
||||
|
||||
// Remove any leading/trailing underscores
|
||||
$sanitized_filename = trim($sanitized_filename, '_');
|
||||
@ -142,4 +151,4 @@ function getEffectivePrice(PDO $db, int $productId, ?int $clientId): array {
|
||||
|
||||
file_put_contents($logFile, "FINAL: Returning Net: $net, Gross: $gross\n---\n", FILE_APPEND);
|
||||
return ['net' => $net, 'gross' => $gross];
|
||||
}
|
||||
}
|
||||
@ -5,6 +5,9 @@ if (session_status() === PHP_SESSION_NONE) {
|
||||
}
|
||||
|
||||
require_once __DIR__ . '/i18n.php';
|
||||
require_once __DIR__ . '/../db/config.php';
|
||||
require_once __DIR__ . '/helpers.php';
|
||||
require_once __DIR__ . '/currency.php';
|
||||
|
||||
if (isset($_GET['lang'])) {
|
||||
set_lang($_GET['lang']);
|
||||
@ -24,5 +27,4 @@ if (isset($_GET['lang'])) {
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once __DIR__ . '/auth.php';
|
||||
require_once __DIR__ . '/helpers.php';
|
||||
require_once __DIR__ . '/auth.php';
|
||||
@ -1,10 +1,10 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/includes/init.php';
|
||||
require_once __DIR__ . '/includes/currency.php';
|
||||
|
||||
$page_title = t('catalog_title');
|
||||
|
||||
require_once __DIR__ . '/includes/html_head.php';
|
||||
require_once __DIR__ . '/includes/header.php';
|
||||
$page_title = t('catalog_title');
|
||||
require_once 'includes/helpers.php';
|
||||
|
||||
try {
|
||||
$pdo = db();
|
||||
@ -148,4 +148,4 @@ try {
|
||||
|
||||
</main>
|
||||
|
||||
<?php require_once __DIR__ . '/includes/footer.php'; ?>
|
||||
<?php require_once __DIR__ . '/includes/footer.php'; ?>
|
||||
@ -1,14 +1,6 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once 'includes/auth.php';
|
||||
require_once 'db/config.php';
|
||||
require_once 'includes/i18n.php';
|
||||
require_once 'includes/helpers.php';
|
||||
|
||||
if (!is_logged_in()) {
|
||||
header('Location: login.php');
|
||||
exit;
|
||||
}
|
||||
require_once __DIR__ . '/includes/init.php';
|
||||
require_login();
|
||||
|
||||
$order_id = isset($_GET['order_id']) ? (int)$_GET['order_id'] : 0;
|
||||
|
||||
@ -26,27 +18,19 @@ if (!$order) {
|
||||
header('Location: orders.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
$page_title = t('order_confirmation');
|
||||
|
||||
require_once __DIR__ . '/includes/html_head.php';
|
||||
require_once __DIR__ . '/includes/header.php';
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="<?= get_lang() ?>">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title><?= t('order_confirmation') ?></title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="assets/css/custom.css" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
<?php require_once 'includes/header.php'; ?>
|
||||
<div class="container mt-5">
|
||||
<div class="alert alert-success" role="alert">
|
||||
<h4 class="alert-heading"><?= t('thank_you_for_your_order') ?></h4>
|
||||
<p><?= t('your_order_number') ?> <strong>#<?php echo $order['id']; ?></strong> <?= t('has_been_placed_successfully') ?></p>
|
||||
<hr>
|
||||
<p class="mb-0"><?= t('order_details_will_be_sent') ?> <a href="orders.php"><?= t('orders') ?></a>.</p>
|
||||
</div>
|
||||
<a href="index.php" class="btn btn-primary"><?= t('continue_shopping') ?></a>
|
||||
<div class="container mt-5">
|
||||
<div class="alert alert-success" role="alert">
|
||||
<h4 class="alert-heading"><?= t('thank_you_for_your_order') ?></h4>
|
||||
<p><?= t('your_order_number') ?> <strong>#<?php echo $order['id']; ?></strong> <?= t('has_been_placed_successfully') ?></p>
|
||||
<hr>
|
||||
<p class="mb-0"><?= t('order_details_will_be_sent') ?> <a href="orders.php"><?= t('orders') ?></a>.</p>
|
||||
</div>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
<a href="index.php" class="btn btn-primary"><?= t('continue_shopping') ?></a>
|
||||
</div>
|
||||
<?php require_once __DIR__ . '/includes/footer.php'; ?>
|
||||
@ -63,7 +63,7 @@ $page_title = $order ? str_replace('{order_id}', $order['id'], t('order_details_
|
||||
|
||||
require_once __DIR__ . '/includes/html_head.php';
|
||||
require_once __DIR__ . '/includes/header.php';
|
||||
require_once __DIR__ . '/includes/currency.php';
|
||||
|
||||
?>
|
||||
|
||||
<main class="container my-5">
|
||||
@ -101,7 +101,7 @@ require_once __DIR__ . '/includes/currency.php';
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
<?php
|
||||
$vatRate = 1.23;
|
||||
foreach ($order_items as $item):
|
||||
$image_url = $product_images[$item['product_id']] ?? 'https://placehold.co/100x100/EEE/31343C?text=' . urlencode(t('no_image_placeholder'));
|
||||
@ -128,4 +128,4 @@ require_once __DIR__ . '/includes/currency.php';
|
||||
<?php endif; ?>
|
||||
</main>
|
||||
|
||||
<?php require_once __DIR__ . '/includes/footer.php'; ?>
|
||||
<?php require_once __DIR__ . '/includes/footer.php'; ?>
|
||||
@ -22,9 +22,8 @@ if (!isset($_SESSION['client_id'])) {
|
||||
|
||||
$page_title = t('title_orders');
|
||||
|
||||
require_once 'includes/header.php';
|
||||
require_once 'includes/currency.php';
|
||||
require_once 'includes/html_head.php';
|
||||
require_once 'includes/header.php';
|
||||
?>
|
||||
|
||||
<main class="container my-5">
|
||||
|
||||
47
product.php
47
product.php
@ -1,14 +1,7 @@
|
||||
<?php
|
||||
if (session_status() === PHP_SESSION_NONE) {
|
||||
session_start();
|
||||
}
|
||||
require_once 'includes/auth.php';
|
||||
require_login();
|
||||
require_once 'includes/helpers.php';
|
||||
|
||||
// This line is now required at the top of pages that use the header.
|
||||
require_once 'includes/i18n.php';
|
||||
require_once 'includes/currency.php';
|
||||
require_once __DIR__ . '/includes/init.php';
|
||||
require_login();
|
||||
|
||||
$product_id = $_GET['id'] ?? null;
|
||||
|
||||
@ -43,23 +36,13 @@ try {
|
||||
|
||||
$page_title = htmlspecialchars($product['name']);
|
||||
|
||||
require_once __DIR__ . '/includes/html_head.php';
|
||||
require_once __DIR__ . '/includes/header.php';
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="<?= get_lang() ?>">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title><?php echo $page_title; ?> - ExtraB2B</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
||||
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
||||
</head>
|
||||
<body>
|
||||
<?php require_once 'includes/header.php'; ?>
|
||||
|
||||
<main class="container my-5">
|
||||
<a href="index.php" class="btn btn-outline-secondary mb-3">
|
||||
← <?= t('back_to_product_list') ?>
|
||||
<a href="index.php" class="btn btn-outline-secondary mb-3">
|
||||
← <?= t('back_to_product_list') ?>
|
||||
</a>
|
||||
<div class="row">
|
||||
<!-- Product Image Gallery -->
|
||||
@ -90,7 +73,7 @@ $page_title = htmlspecialchars($product['name']);
|
||||
<!-- Product Details -->
|
||||
<div class="col-lg-6">
|
||||
<h1 class="mb-3"><?= htmlspecialchars($product['name']) ?></h1>
|
||||
|
||||
|
||||
<div class="bg-light p-4 rounded mb-4">
|
||||
<p class="h4 fw-bold mb-1"><?= format_money($prices['gross'], $_SESSION['lang'] ?? 'pl', $pdo) ?> <span class="fs-6 fw-normal"><?= t('gross') ?></span></p>
|
||||
<p class="text-muted mb-0"><?= format_money($prices['net'], $_SESSION['lang'] ?? 'pl', $pdo) ?> <span class="fs-6 fw-normal"><?= t('net') ?></span></p>
|
||||
@ -174,11 +157,11 @@ $page_title = htmlspecialchars($product['name']);
|
||||
<div class="tab-pane fade" id="related" role="tabpanel" aria-labelledby="related-tab">
|
||||
<div class="row">
|
||||
<?php
|
||||
$related_sql = "SELECT
|
||||
$related_sql = "SELECT
|
||||
p.*,
|
||||
(SELECT file_path FROM product_images WHERE product_id = p.id ORDER BY is_primary DESC, id ASC LIMIT 1) AS image_path
|
||||
FROM products p
|
||||
JOIN product_relations pr ON p.id = pr.related_product_id
|
||||
FROM products p
|
||||
JOIN product_relations pr ON p.id = pr.related_product_id
|
||||
WHERE pr.product_id = ?";
|
||||
$related_products_stmt = $pdo->prepare($related_sql);
|
||||
$related_products_stmt->execute([$product_id]);
|
||||
@ -189,7 +172,7 @@ $page_title = htmlspecialchars($product['name']);
|
||||
$related_image_url = !empty($related_product['image_path'])
|
||||
? BASE_URL . 'uploads/products/' . htmlspecialchars($related_product['image_path'])
|
||||
: 'https://placehold.co/300x300/EEE/31343C?text='.t('no_image_placeholder');
|
||||
|
||||
|
||||
echo '<div class="col-md-3 mb-3">';
|
||||
echo '<div class="card h-100 product-card shadow-sm">';
|
||||
echo '<a href="product.php?id=' . $related_product['id'] . '">';
|
||||
@ -211,7 +194,7 @@ $page_title = htmlspecialchars($product['name']);
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<?php require_once 'includes/footer.php'; ?>
|
||||
<?php require_once __DIR__ . '/includes/footer.php'; ?>
|
||||
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
@ -222,12 +205,10 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
thumbnail.addEventListener('click', function(event) {
|
||||
event.preventDefault();
|
||||
mainImage.src = this.href;
|
||||
|
||||
|
||||
thumbnails.forEach(t => t.classList.remove('active'));
|
||||
this.classList.add('active');
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</script>
|
||||
35
profile.php
35
profile.php
@ -1,14 +1,6 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once 'includes/auth.php';
|
||||
require_once 'db/config.php';
|
||||
require_once 'includes/i18n.php';
|
||||
require_once 'includes/helpers.php';
|
||||
|
||||
if (!is_logged_in()) {
|
||||
header('Location: login.php');
|
||||
exit;
|
||||
}
|
||||
require_once __DIR__ . '/includes/init.php';
|
||||
require_login();
|
||||
|
||||
$user_id = $_SESSION['user_id'];
|
||||
$db = db();
|
||||
@ -25,19 +17,12 @@ if (!empty($user['client_id'])) {
|
||||
$stmt->execute([$user['client_id']]);
|
||||
$client = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
}
|
||||
|
||||
$page_title = t('profile_header');
|
||||
|
||||
require_once __DIR__ . '/includes/html_head.php';
|
||||
require_once __DIR__ . '/includes/header.php';
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="<?= get_lang() ?>">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title><?= t('profile_user_profile') ?></title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
|
||||
<link href="<?php echo BASE_URL; ?>assets/css/custom.css" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
<?php require_once 'includes/header.php'; ?>
|
||||
<div class="container mt-5">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
@ -74,6 +59,6 @@ if (!empty($user['client_id'])) {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
require_once __DIR__ . '/includes/footer.php';
|
||||
?>
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/includes/header.php';
|
||||
require_once __DIR__ . '/includes/currency.php';
|
||||
require_once __DIR__ . '/includes/init.php';
|
||||
require_once __DIR__ . '/includes/html_head.php';
|
||||
require_once __DIR__ . '/includes/header.php';
|
||||
require_login();
|
||||
|
||||
$page_title = t('related_suggestions_title');
|
||||
|
||||
@ -1,10 +1,7 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once __DIR__ . '/../includes/lang.php';
|
||||
require_once __DIR__ . '/../includes/auth.php';
|
||||
require_once __DIR__ . '/../includes/init.php';
|
||||
require_role('supplier');
|
||||
require_once __DIR__ . '/../db/config.php';
|
||||
require_once __DIR__ . '/../includes/helpers.php';
|
||||
|
||||
require_once __DIR__ . '/../includes/status_updater.php';
|
||||
|
||||
$supplier_id = $_SESSION['user_id']; // Assuming the supplier is a user and their ID is in the session
|
||||
@ -53,7 +50,8 @@ $order_items = $stmt->fetchAll();
|
||||
$item_statuses = ['pending', 'in_progress', 'shipped'];
|
||||
|
||||
$pageTitle = t('my_order_items');
|
||||
include '../includes/header.php';
|
||||
require_once __DIR__ . '/../includes/html_head.php';
|
||||
require_once __DIR__ . '/../includes/header.php';
|
||||
?>
|
||||
|
||||
<main class="container mt-4">
|
||||
@ -110,4 +108,4 @@ include '../includes/header.php';
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<?php include '../includes/footer.php'; ?>
|
||||
<?php require_once __DIR__ . '/../includes/footer.php'; ?>
|
||||
Loading…
x
Reference in New Issue
Block a user