diff --git a/admin/users.php b/admin/users.php
index 3d117ff..c9ec0eb 100644
--- a/admin/users.php
+++ b/admin/users.php
@@ -1,7 +1,5 @@
fetchAll();
$page_title = 'Użytkownicy';
?>
-
-
-
-
-
- - Panel Administracyjny
-
-
-
+
@@ -78,6 +68,6 @@ $page_title = 'Użytkownicy';
-
+
diff --git a/chat_send.php b/chat_send.php
new file mode 100644
index 0000000..425de5a
--- /dev/null
+++ b/chat_send.php
@@ -0,0 +1,93 @@
+prepare("INSERT INTO chat_sessions (user_id, client_id) VALUES (?, ?)");
+ $stmt->execute([$user_id, $client_id]);
+ $session_id = db()->lastInsertId();
+ $_SESSION['chat_session_id'] = $session_id;
+}
+
+// Load conversation history
+$stmt = db()->prepare("SELECT sender, message FROM chat_messages WHERE session_id = ? ORDER BY created_at ASC");
+$stmt->execute([$session_id]);
+$history = $stmt->fetchAll(PDO::FETCH_ASSOC);
+
+function search_kb($message) {
+ $terms = explode(' ', $message);
+ $sql = "SELECT * FROM kb_documents WHERE is_active = 1 AND (";
+ $conditions = [];
+ foreach ($terms as $term) {
+ $conditions[] = "title LIKE ? OR content LIKE ?";
+ }
+ $sql .= implode(' OR ', $conditions) . ") LIMIT 3";
+
+ $stmt = db()->prepare($sql);
+ $params = [];
+ foreach ($terms as $term) {
+ $params[] = '%' . $term . '%';
+ $params[] = '%' . $term . '%';
+ }
+ $stmt->execute($params);
+ return $stmt->fetchAll();
+}
+
+$input = json_decode(file_get_contents('php://input'), true);
+$message = $input['message'] ?? '';
+
+if (empty($message)) {
+ echo json_encode(['reply' => 'Please enter a message.']);
+ exit;
+}
+
+// Save user message
+$stmt = db()->prepare("INSERT INTO chat_messages (session_id, sender, message) VALUES (?, 'user', ?)");
+$stmt->execute([$session_id, $message]);
+
+$kb_documents = search_kb($message);
+
+$prompt = "You are a helpful assistant for Extrading, a company that sells construction materials. Please answer in ' . ($lang ?? 'en') . ' language. Answer the user\'s questions based on the provided context. If the answer is not in the context, say you don\'t know.\n\n";
+
+if (!empty($kb_documents)) {
+ $prompt .= "Context from knowledge base:\n";
+ foreach ($kb_documents as $doc) {
+ $prompt .= "- Title: " . $doc['title'] . "\n";
+ $prompt .= " Content: " . $doc['content'] . "\n";
+ }
+ $prompt .= "\n";
+}
+
+$prompt .= "Conversation history:\n";
+foreach ($history as $msg) {
+ $prompt .= $msg['sender'] . ": " . $msg['message'] . "\n";
+}
+
+$prompt .= "user: " . $message . "\n";
+$prompt .= "assistant:";
+
+$response = LocalAIApi::createResponse([
+ 'input' => [
+ ['role' => 'system', 'content' => $prompt]
+ ]
+]);
+
+if (!empty($response['success'])) {
+ $reply = LocalAIApi::extractText($response);
+} else {
+ $reply = 'Sorry, I am having trouble connecting to the AI service. Please try again later.';
+ error_log('AI API Error: ' . ($response['error'] ?? 'Unknown error'));
+}
+
+// Save assistant message
+$stmt = db()->prepare("INSERT INTO chat_messages (session_id, sender, message) VALUES (?, 'assistant', ?)");
+$stmt->execute([$session_id, $reply]);
+
+echo json_encode(['reply' => $reply]);
diff --git a/db/migrations/030_create_kb_documents_table.sql b/db/migrations/030_create_kb_documents_table.sql
new file mode 100644
index 0000000..c0b75aa
--- /dev/null
+++ b/db/migrations/030_create_kb_documents_table.sql
@@ -0,0 +1,13 @@
+
+CREATE TABLE IF NOT EXISTS `kb_documents` (
+ `id` INT AUTO_INCREMENT PRIMARY KEY,
+ `title` VARCHAR(255) NOT NULL,
+ `content` TEXT NOT NULL,
+ `tags` VARCHAR(255),
+ `product_id` INT,
+ `language` VARCHAR(10) NOT NULL DEFAULT 'en',
+ `is_active` BOOLEAN NOT NULL DEFAULT TRUE,
+ `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+ `updated_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ FOREIGN KEY (`product_id`) REFERENCES `products`(`id`) ON DELETE SET NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
diff --git a/db/migrations/031_create_chat_sessions_table.sql b/db/migrations/031_create_chat_sessions_table.sql
new file mode 100644
index 0000000..4f7f799
--- /dev/null
+++ b/db/migrations/031_create_chat_sessions_table.sql
@@ -0,0 +1,10 @@
+
+CREATE TABLE IF NOT EXISTS `chat_sessions` (
+ `id` INT AUTO_INCREMENT PRIMARY KEY,
+ `user_id` INT,
+ `client_id` INT,
+ `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+ `updated_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE,
+ FOREIGN KEY (`client_id`) REFERENCES `clients`(`id`) ON DELETE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
diff --git a/db/migrations/032_create_chat_messages_table.sql b/db/migrations/032_create_chat_messages_table.sql
new file mode 100644
index 0000000..c3c979f
--- /dev/null
+++ b/db/migrations/032_create_chat_messages_table.sql
@@ -0,0 +1,10 @@
+
+CREATE TABLE IF NOT EXISTS `chat_messages` (
+ `id` INT AUTO_INCREMENT PRIMARY KEY,
+ `session_id` INT NOT NULL,
+ `sender` ENUM('user', 'assistant') NOT NULL,
+ `message` TEXT NOT NULL,
+ `sources` TEXT,
+ `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+ FOREIGN KEY (`session_id`) REFERENCES `chat_sessions`(`id`) ON DELETE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
diff --git a/debug_price.log b/debug_price.log
index 99f486b..2faa8a1 100644
--- a/debug_price.log
+++ b/debug_price.log
@@ -3611,3 +3611,1002 @@ Product price query executed. Found: {"price_net":"233.20","price_gross":"286.84
Found product price. Net: 233.2, Gross: 286.84
FINAL: Returning Net: 233.2, Gross: 286.84
---
+---
+START getEffectivePrice for product 1, client 1
+Client price query executed. Found: {"price_net":"894.31","price_gross":"1100.00"}
+Found client price. Net: 894.31, Gross: 1100
+FINAL: Returning Net: 894.31, Gross: 1100
+---
+---
+START getEffectivePrice for product 2, client 1
+Client price query executed. Found: {"price_net":"1056.91","price_gross":"1300.00"}
+Found client price. Net: 1056.91, Gross: 1300
+FINAL: Returning Net: 1056.91, Gross: 1300
+---
+---
+START getEffectivePrice for product 3, client 1
+Client price query executed. Found: {"price_net":"32.52","price_gross":"40.00"}
+Found client price. Net: 32.52, Gross: 40
+FINAL: Returning Net: 32.52, Gross: 40
+---
+---
+START getEffectivePrice for product 4, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"}
+Found product price. Net: 9.95, Gross: 12.24
+FINAL: Returning Net: 9.95, Gross: 12.24
+---
+---
+START getEffectivePrice for product 5, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"68.00","price_gross":"83.64"}
+Found product price. Net: 68, Gross: 83.64
+FINAL: Returning Net: 68, Gross: 83.64
+---
+---
+START getEffectivePrice for product 6, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"171.60","price_gross":"211.07"}
+Found product price. Net: 171.6, Gross: 211.07
+FINAL: Returning Net: 171.6, Gross: 211.07
+---
+---
+START getEffectivePrice for product 7, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"233.20","price_gross":"286.84"}
+Found product price. Net: 233.2, Gross: 286.84
+FINAL: Returning Net: 233.2, Gross: 286.84
+---
+---
+START getEffectivePrice for product 1, client 1
+Client price query executed. Found: {"price_net":"894.31","price_gross":"1100.00"}
+Found client price. Net: 894.31, Gross: 1100
+FINAL: Returning Net: 894.31, Gross: 1100
+---
+---
+START getEffectivePrice for product 2, client 1
+Client price query executed. Found: {"price_net":"1056.91","price_gross":"1300.00"}
+Found client price. Net: 1056.91, Gross: 1300
+FINAL: Returning Net: 1056.91, Gross: 1300
+---
+---
+START getEffectivePrice for product 3, client 1
+Client price query executed. Found: {"price_net":"32.52","price_gross":"40.00"}
+Found client price. Net: 32.52, Gross: 40
+FINAL: Returning Net: 32.52, Gross: 40
+---
+---
+START getEffectivePrice for product 4, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"}
+Found product price. Net: 9.95, Gross: 12.24
+FINAL: Returning Net: 9.95, Gross: 12.24
+---
+---
+START getEffectivePrice for product 5, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"68.00","price_gross":"83.64"}
+Found product price. Net: 68, Gross: 83.64
+FINAL: Returning Net: 68, Gross: 83.64
+---
+---
+START getEffectivePrice for product 6, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"171.60","price_gross":"211.07"}
+Found product price. Net: 171.6, Gross: 211.07
+FINAL: Returning Net: 171.6, Gross: 211.07
+---
+---
+START getEffectivePrice for product 7, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"233.20","price_gross":"286.84"}
+Found product price. Net: 233.2, Gross: 286.84
+FINAL: Returning Net: 233.2, Gross: 286.84
+---
+---
+START getEffectivePrice for product 1, client 1
+Client price query executed. Found: {"price_net":"894.31","price_gross":"1100.00"}
+Found client price. Net: 894.31, Gross: 1100
+FINAL: Returning Net: 894.31, Gross: 1100
+---
+---
+START getEffectivePrice for product 2, client 1
+Client price query executed. Found: {"price_net":"1056.91","price_gross":"1300.00"}
+Found client price. Net: 1056.91, Gross: 1300
+FINAL: Returning Net: 1056.91, Gross: 1300
+---
+---
+START getEffectivePrice for product 3, client 1
+Client price query executed. Found: {"price_net":"32.52","price_gross":"40.00"}
+Found client price. Net: 32.52, Gross: 40
+FINAL: Returning Net: 32.52, Gross: 40
+---
+---
+START getEffectivePrice for product 4, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"}
+Found product price. Net: 9.95, Gross: 12.24
+FINAL: Returning Net: 9.95, Gross: 12.24
+---
+---
+START getEffectivePrice for product 5, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"68.00","price_gross":"83.64"}
+Found product price. Net: 68, Gross: 83.64
+FINAL: Returning Net: 68, Gross: 83.64
+---
+---
+START getEffectivePrice for product 6, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"171.60","price_gross":"211.07"}
+Found product price. Net: 171.6, Gross: 211.07
+FINAL: Returning Net: 171.6, Gross: 211.07
+---
+---
+START getEffectivePrice for product 7, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"233.20","price_gross":"286.84"}
+Found product price. Net: 233.2, Gross: 286.84
+FINAL: Returning Net: 233.2, Gross: 286.84
+---
+---
+START getEffectivePrice for product 1, client 1
+Client price query executed. Found: {"price_net":"894.31","price_gross":"1100.00"}
+Found client price. Net: 894.31, Gross: 1100
+FINAL: Returning Net: 894.31, Gross: 1100
+---
+---
+START getEffectivePrice for product 2, client 1
+Client price query executed. Found: {"price_net":"1056.91","price_gross":"1300.00"}
+Found client price. Net: 1056.91, Gross: 1300
+FINAL: Returning Net: 1056.91, Gross: 1300
+---
+---
+START getEffectivePrice for product 3, client 1
+Client price query executed. Found: {"price_net":"32.52","price_gross":"40.00"}
+Found client price. Net: 32.52, Gross: 40
+FINAL: Returning Net: 32.52, Gross: 40
+---
+---
+START getEffectivePrice for product 4, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"}
+Found product price. Net: 9.95, Gross: 12.24
+FINAL: Returning Net: 9.95, Gross: 12.24
+---
+---
+START getEffectivePrice for product 5, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"68.00","price_gross":"83.64"}
+Found product price. Net: 68, Gross: 83.64
+FINAL: Returning Net: 68, Gross: 83.64
+---
+---
+START getEffectivePrice for product 6, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"171.60","price_gross":"211.07"}
+Found product price. Net: 171.6, Gross: 211.07
+FINAL: Returning Net: 171.6, Gross: 211.07
+---
+---
+START getEffectivePrice for product 7, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"233.20","price_gross":"286.84"}
+Found product price. Net: 233.2, Gross: 286.84
+FINAL: Returning Net: 233.2, Gross: 286.84
+---
+---
+START getEffectivePrice for product 1, client 1
+Client price query executed. Found: {"price_net":"894.31","price_gross":"1100.00"}
+Found client price. Net: 894.31, Gross: 1100
+FINAL: Returning Net: 894.31, Gross: 1100
+---
+---
+START getEffectivePrice for product 2, client 1
+Client price query executed. Found: {"price_net":"1056.91","price_gross":"1300.00"}
+Found client price. Net: 1056.91, Gross: 1300
+FINAL: Returning Net: 1056.91, Gross: 1300
+---
+---
+START getEffectivePrice for product 3, client 1
+Client price query executed. Found: {"price_net":"32.52","price_gross":"40.00"}
+Found client price. Net: 32.52, Gross: 40
+FINAL: Returning Net: 32.52, Gross: 40
+---
+---
+START getEffectivePrice for product 4, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"}
+Found product price. Net: 9.95, Gross: 12.24
+FINAL: Returning Net: 9.95, Gross: 12.24
+---
+---
+START getEffectivePrice for product 5, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"68.00","price_gross":"83.64"}
+Found product price. Net: 68, Gross: 83.64
+FINAL: Returning Net: 68, Gross: 83.64
+---
+---
+START getEffectivePrice for product 6, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"171.60","price_gross":"211.07"}
+Found product price. Net: 171.6, Gross: 211.07
+FINAL: Returning Net: 171.6, Gross: 211.07
+---
+---
+START getEffectivePrice for product 7, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"233.20","price_gross":"286.84"}
+Found product price. Net: 233.2, Gross: 286.84
+FINAL: Returning Net: 233.2, Gross: 286.84
+---
+---
+START getEffectivePrice for product 1, client 1
+Client price query executed. Found: {"price_net":"894.31","price_gross":"1100.00"}
+Found client price. Net: 894.31, Gross: 1100
+FINAL: Returning Net: 894.31, Gross: 1100
+---
+---
+START getEffectivePrice for product 2, client 1
+Client price query executed. Found: {"price_net":"1056.91","price_gross":"1300.00"}
+Found client price. Net: 1056.91, Gross: 1300
+FINAL: Returning Net: 1056.91, Gross: 1300
+---
+---
+START getEffectivePrice for product 3, client 1
+Client price query executed. Found: {"price_net":"32.52","price_gross":"40.00"}
+Found client price. Net: 32.52, Gross: 40
+FINAL: Returning Net: 32.52, Gross: 40
+---
+---
+START getEffectivePrice for product 4, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"}
+Found product price. Net: 9.95, Gross: 12.24
+FINAL: Returning Net: 9.95, Gross: 12.24
+---
+---
+START getEffectivePrice for product 5, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"68.00","price_gross":"83.64"}
+Found product price. Net: 68, Gross: 83.64
+FINAL: Returning Net: 68, Gross: 83.64
+---
+---
+START getEffectivePrice for product 6, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"171.60","price_gross":"211.07"}
+Found product price. Net: 171.6, Gross: 211.07
+FINAL: Returning Net: 171.6, Gross: 211.07
+---
+---
+START getEffectivePrice for product 7, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"233.20","price_gross":"286.84"}
+Found product price. Net: 233.2, Gross: 286.84
+FINAL: Returning Net: 233.2, Gross: 286.84
+---
+---
+START getEffectivePrice for product 1, client 1
+Client price query executed. Found: {"price_net":"894.31","price_gross":"1100.00"}
+Found client price. Net: 894.31, Gross: 1100
+FINAL: Returning Net: 894.31, Gross: 1100
+---
+---
+START getEffectivePrice for product 2, client 1
+Client price query executed. Found: {"price_net":"1056.91","price_gross":"1300.00"}
+Found client price. Net: 1056.91, Gross: 1300
+FINAL: Returning Net: 1056.91, Gross: 1300
+---
+---
+START getEffectivePrice for product 3, client 1
+Client price query executed. Found: {"price_net":"32.52","price_gross":"40.00"}
+Found client price. Net: 32.52, Gross: 40
+FINAL: Returning Net: 32.52, Gross: 40
+---
+---
+START getEffectivePrice for product 4, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"}
+Found product price. Net: 9.95, Gross: 12.24
+FINAL: Returning Net: 9.95, Gross: 12.24
+---
+---
+START getEffectivePrice for product 5, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"68.00","price_gross":"83.64"}
+Found product price. Net: 68, Gross: 83.64
+FINAL: Returning Net: 68, Gross: 83.64
+---
+---
+START getEffectivePrice for product 6, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"171.60","price_gross":"211.07"}
+Found product price. Net: 171.6, Gross: 211.07
+FINAL: Returning Net: 171.6, Gross: 211.07
+---
+---
+START getEffectivePrice for product 7, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"233.20","price_gross":"286.84"}
+Found product price. Net: 233.2, Gross: 286.84
+FINAL: Returning Net: 233.2, Gross: 286.84
+---
+---
+START getEffectivePrice for product 1, client 1
+Client price query executed. Found: {"price_net":"894.31","price_gross":"1100.00"}
+Found client price. Net: 894.31, Gross: 1100
+FINAL: Returning Net: 894.31, Gross: 1100
+---
+---
+START getEffectivePrice for product 2, client 1
+Client price query executed. Found: {"price_net":"1056.91","price_gross":"1300.00"}
+Found client price. Net: 1056.91, Gross: 1300
+FINAL: Returning Net: 1056.91, Gross: 1300
+---
+---
+START getEffectivePrice for product 3, client 1
+Client price query executed. Found: {"price_net":"32.52","price_gross":"40.00"}
+Found client price. Net: 32.52, Gross: 40
+FINAL: Returning Net: 32.52, Gross: 40
+---
+---
+START getEffectivePrice for product 4, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"}
+Found product price. Net: 9.95, Gross: 12.24
+FINAL: Returning Net: 9.95, Gross: 12.24
+---
+---
+START getEffectivePrice for product 5, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"68.00","price_gross":"83.64"}
+Found product price. Net: 68, Gross: 83.64
+FINAL: Returning Net: 68, Gross: 83.64
+---
+---
+START getEffectivePrice for product 6, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"171.60","price_gross":"211.07"}
+Found product price. Net: 171.6, Gross: 211.07
+FINAL: Returning Net: 171.6, Gross: 211.07
+---
+---
+START getEffectivePrice for product 7, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"233.20","price_gross":"286.84"}
+Found product price. Net: 233.2, Gross: 286.84
+FINAL: Returning Net: 233.2, Gross: 286.84
+---
+---
+START getEffectivePrice for product 1, client 1
+Client price query executed. Found: {"price_net":"894.31","price_gross":"1100.00"}
+Found client price. Net: 894.31, Gross: 1100
+FINAL: Returning Net: 894.31, Gross: 1100
+---
+---
+START getEffectivePrice for product 2, client 1
+Client price query executed. Found: {"price_net":"1056.91","price_gross":"1300.00"}
+Found client price. Net: 1056.91, Gross: 1300
+FINAL: Returning Net: 1056.91, Gross: 1300
+---
+---
+START getEffectivePrice for product 3, client 1
+Client price query executed. Found: {"price_net":"32.52","price_gross":"40.00"}
+Found client price. Net: 32.52, Gross: 40
+FINAL: Returning Net: 32.52, Gross: 40
+---
+---
+START getEffectivePrice for product 4, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"}
+Found product price. Net: 9.95, Gross: 12.24
+FINAL: Returning Net: 9.95, Gross: 12.24
+---
+---
+START getEffectivePrice for product 5, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"68.00","price_gross":"83.64"}
+Found product price. Net: 68, Gross: 83.64
+FINAL: Returning Net: 68, Gross: 83.64
+---
+---
+START getEffectivePrice for product 6, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"171.60","price_gross":"211.07"}
+Found product price. Net: 171.6, Gross: 211.07
+FINAL: Returning Net: 171.6, Gross: 211.07
+---
+---
+START getEffectivePrice for product 7, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"233.20","price_gross":"286.84"}
+Found product price. Net: 233.2, Gross: 286.84
+FINAL: Returning Net: 233.2, Gross: 286.84
+---
+---
+START getEffectivePrice for product 1, client 1
+Client price query executed. Found: {"price_net":"894.31","price_gross":"1100.00"}
+Found client price. Net: 894.31, Gross: 1100
+FINAL: Returning Net: 894.31, Gross: 1100
+---
+---
+START getEffectivePrice for product 2, client 1
+Client price query executed. Found: {"price_net":"1056.91","price_gross":"1300.00"}
+Found client price. Net: 1056.91, Gross: 1300
+FINAL: Returning Net: 1056.91, Gross: 1300
+---
+---
+START getEffectivePrice for product 3, client 1
+Client price query executed. Found: {"price_net":"32.52","price_gross":"40.00"}
+Found client price. Net: 32.52, Gross: 40
+FINAL: Returning Net: 32.52, Gross: 40
+---
+---
+START getEffectivePrice for product 4, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"}
+Found product price. Net: 9.95, Gross: 12.24
+FINAL: Returning Net: 9.95, Gross: 12.24
+---
+---
+START getEffectivePrice for product 5, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"68.00","price_gross":"83.64"}
+Found product price. Net: 68, Gross: 83.64
+FINAL: Returning Net: 68, Gross: 83.64
+---
+---
+START getEffectivePrice for product 6, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"171.60","price_gross":"211.07"}
+Found product price. Net: 171.6, Gross: 211.07
+FINAL: Returning Net: 171.6, Gross: 211.07
+---
+---
+START getEffectivePrice for product 7, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"233.20","price_gross":"286.84"}
+Found product price. Net: 233.2, Gross: 286.84
+FINAL: Returning Net: 233.2, Gross: 286.84
+---
+---
+START getEffectivePrice for product 1, client 1
+Client price query executed. Found: {"price_net":"894.31","price_gross":"1100.00"}
+Found client price. Net: 894.31, Gross: 1100
+FINAL: Returning Net: 894.31, Gross: 1100
+---
+---
+START getEffectivePrice for product 2, client 1
+Client price query executed. Found: {"price_net":"1056.91","price_gross":"1300.00"}
+Found client price. Net: 1056.91, Gross: 1300
+FINAL: Returning Net: 1056.91, Gross: 1300
+---
+---
+START getEffectivePrice for product 3, client 1
+Client price query executed. Found: {"price_net":"32.52","price_gross":"40.00"}
+Found client price. Net: 32.52, Gross: 40
+FINAL: Returning Net: 32.52, Gross: 40
+---
+---
+START getEffectivePrice for product 4, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"}
+Found product price. Net: 9.95, Gross: 12.24
+FINAL: Returning Net: 9.95, Gross: 12.24
+---
+---
+START getEffectivePrice for product 5, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"68.00","price_gross":"83.64"}
+Found product price. Net: 68, Gross: 83.64
+FINAL: Returning Net: 68, Gross: 83.64
+---
+---
+START getEffectivePrice for product 6, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"171.60","price_gross":"211.07"}
+Found product price. Net: 171.6, Gross: 211.07
+FINAL: Returning Net: 171.6, Gross: 211.07
+---
+---
+START getEffectivePrice for product 7, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"233.20","price_gross":"286.84"}
+Found product price. Net: 233.2, Gross: 286.84
+FINAL: Returning Net: 233.2, Gross: 286.84
+---
+---
+START getEffectivePrice for product 1, client 1
+Client price query executed. Found: {"price_net":"894.31","price_gross":"1100.00"}
+Found client price. Net: 894.31, Gross: 1100
+FINAL: Returning Net: 894.31, Gross: 1100
+---
+---
+START getEffectivePrice for product 2, client 1
+Client price query executed. Found: {"price_net":"1056.91","price_gross":"1300.00"}
+Found client price. Net: 1056.91, Gross: 1300
+FINAL: Returning Net: 1056.91, Gross: 1300
+---
+---
+START getEffectivePrice for product 3, client 1
+Client price query executed. Found: {"price_net":"32.52","price_gross":"40.00"}
+Found client price. Net: 32.52, Gross: 40
+FINAL: Returning Net: 32.52, Gross: 40
+---
+---
+START getEffectivePrice for product 4, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"}
+Found product price. Net: 9.95, Gross: 12.24
+FINAL: Returning Net: 9.95, Gross: 12.24
+---
+---
+START getEffectivePrice for product 5, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"68.00","price_gross":"83.64"}
+Found product price. Net: 68, Gross: 83.64
+FINAL: Returning Net: 68, Gross: 83.64
+---
+---
+START getEffectivePrice for product 6, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"171.60","price_gross":"211.07"}
+Found product price. Net: 171.6, Gross: 211.07
+FINAL: Returning Net: 171.6, Gross: 211.07
+---
+---
+START getEffectivePrice for product 7, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"233.20","price_gross":"286.84"}
+Found product price. Net: 233.2, Gross: 286.84
+FINAL: Returning Net: 233.2, Gross: 286.84
+---
+---
+START getEffectivePrice for product 1, client 1
+Client price query executed. Found: {"price_net":"894.31","price_gross":"1100.00"}
+Found client price. Net: 894.31, Gross: 1100
+FINAL: Returning Net: 894.31, Gross: 1100
+---
+---
+START getEffectivePrice for product 2, client 1
+Client price query executed. Found: {"price_net":"1056.91","price_gross":"1300.00"}
+Found client price. Net: 1056.91, Gross: 1300
+FINAL: Returning Net: 1056.91, Gross: 1300
+---
+---
+START getEffectivePrice for product 3, client 1
+Client price query executed. Found: {"price_net":"32.52","price_gross":"40.00"}
+Found client price. Net: 32.52, Gross: 40
+FINAL: Returning Net: 32.52, Gross: 40
+---
+---
+START getEffectivePrice for product 4, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"}
+Found product price. Net: 9.95, Gross: 12.24
+FINAL: Returning Net: 9.95, Gross: 12.24
+---
+---
+START getEffectivePrice for product 5, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"68.00","price_gross":"83.64"}
+Found product price. Net: 68, Gross: 83.64
+FINAL: Returning Net: 68, Gross: 83.64
+---
+---
+START getEffectivePrice for product 6, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"171.60","price_gross":"211.07"}
+Found product price. Net: 171.6, Gross: 211.07
+FINAL: Returning Net: 171.6, Gross: 211.07
+---
+---
+START getEffectivePrice for product 7, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"233.20","price_gross":"286.84"}
+Found product price. Net: 233.2, Gross: 286.84
+FINAL: Returning Net: 233.2, Gross: 286.84
+---
+---
+START getEffectivePrice for product 1, client 1
+Client price query executed. Found: {"price_net":"894.31","price_gross":"1100.00"}
+Found client price. Net: 894.31, Gross: 1100
+FINAL: Returning Net: 894.31, Gross: 1100
+---
+---
+START getEffectivePrice for product 2, client 1
+Client price query executed. Found: {"price_net":"1056.91","price_gross":"1300.00"}
+Found client price. Net: 1056.91, Gross: 1300
+FINAL: Returning Net: 1056.91, Gross: 1300
+---
+---
+START getEffectivePrice for product 3, client 1
+Client price query executed. Found: {"price_net":"32.52","price_gross":"40.00"}
+Found client price. Net: 32.52, Gross: 40
+FINAL: Returning Net: 32.52, Gross: 40
+---
+---
+START getEffectivePrice for product 4, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"}
+Found product price. Net: 9.95, Gross: 12.24
+FINAL: Returning Net: 9.95, Gross: 12.24
+---
+---
+START getEffectivePrice for product 5, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"68.00","price_gross":"83.64"}
+Found product price. Net: 68, Gross: 83.64
+FINAL: Returning Net: 68, Gross: 83.64
+---
+---
+START getEffectivePrice for product 6, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"171.60","price_gross":"211.07"}
+Found product price. Net: 171.6, Gross: 211.07
+FINAL: Returning Net: 171.6, Gross: 211.07
+---
+---
+START getEffectivePrice for product 7, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"233.20","price_gross":"286.84"}
+Found product price. Net: 233.2, Gross: 286.84
+FINAL: Returning Net: 233.2, Gross: 286.84
+---
+---
+START getEffectivePrice for product 1, client 1
+Client price query executed. Found: {"price_net":"894.31","price_gross":"1100.00"}
+Found client price. Net: 894.31, Gross: 1100
+FINAL: Returning Net: 894.31, Gross: 1100
+---
+---
+START getEffectivePrice for product 2, client 1
+Client price query executed. Found: {"price_net":"1056.91","price_gross":"1300.00"}
+Found client price. Net: 1056.91, Gross: 1300
+FINAL: Returning Net: 1056.91, Gross: 1300
+---
+---
+START getEffectivePrice for product 3, client 1
+Client price query executed. Found: {"price_net":"32.52","price_gross":"40.00"}
+Found client price. Net: 32.52, Gross: 40
+FINAL: Returning Net: 32.52, Gross: 40
+---
+---
+START getEffectivePrice for product 4, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"}
+Found product price. Net: 9.95, Gross: 12.24
+FINAL: Returning Net: 9.95, Gross: 12.24
+---
+---
+START getEffectivePrice for product 5, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"68.00","price_gross":"83.64"}
+Found product price. Net: 68, Gross: 83.64
+FINAL: Returning Net: 68, Gross: 83.64
+---
+---
+START getEffectivePrice for product 6, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"171.60","price_gross":"211.07"}
+Found product price. Net: 171.6, Gross: 211.07
+FINAL: Returning Net: 171.6, Gross: 211.07
+---
+---
+START getEffectivePrice for product 7, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"233.20","price_gross":"286.84"}
+Found product price. Net: 233.2, Gross: 286.84
+FINAL: Returning Net: 233.2, Gross: 286.84
+---
+---
+START getEffectivePrice for product 1, client 1
+Client price query executed. Found: {"price_net":"894.31","price_gross":"1100.00"}
+Found client price. Net: 894.31, Gross: 1100
+FINAL: Returning Net: 894.31, Gross: 1100
+---
+---
+START getEffectivePrice for product 2, client 1
+Client price query executed. Found: {"price_net":"1056.91","price_gross":"1300.00"}
+Found client price. Net: 1056.91, Gross: 1300
+FINAL: Returning Net: 1056.91, Gross: 1300
+---
+---
+START getEffectivePrice for product 3, client 1
+Client price query executed. Found: {"price_net":"32.52","price_gross":"40.00"}
+Found client price. Net: 32.52, Gross: 40
+FINAL: Returning Net: 32.52, Gross: 40
+---
+---
+START getEffectivePrice for product 4, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"}
+Found product price. Net: 9.95, Gross: 12.24
+FINAL: Returning Net: 9.95, Gross: 12.24
+---
+---
+START getEffectivePrice for product 5, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"68.00","price_gross":"83.64"}
+Found product price. Net: 68, Gross: 83.64
+FINAL: Returning Net: 68, Gross: 83.64
+---
+---
+START getEffectivePrice for product 6, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"171.60","price_gross":"211.07"}
+Found product price. Net: 171.6, Gross: 211.07
+FINAL: Returning Net: 171.6, Gross: 211.07
+---
+---
+START getEffectivePrice for product 7, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"233.20","price_gross":"286.84"}
+Found product price. Net: 233.2, Gross: 286.84
+FINAL: Returning Net: 233.2, Gross: 286.84
+---
+---
+START getEffectivePrice for product 1, client
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"1111.00","price_gross":"1366.53"}
+Found product price. Net: 1111, Gross: 1366.53
+FINAL: Returning Net: 1111, Gross: 1366.53
+---
+---
+START getEffectivePrice for product 2, client
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"1318.05","price_gross":"1621.20"}
+Found product price. Net: 1318.05, Gross: 1621.2
+FINAL: Returning Net: 1318.05, Gross: 1621.2
+---
+---
+START getEffectivePrice for product 3, client
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"}
+Found product price. Net: 9.95, Gross: 12.24
+FINAL: Returning Net: 9.95, Gross: 12.24
+---
+---
+START getEffectivePrice for product 4, client
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"}
+Found product price. Net: 9.95, Gross: 12.24
+FINAL: Returning Net: 9.95, Gross: 12.24
+---
+---
+START getEffectivePrice for product 5, client
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"68.00","price_gross":"83.64"}
+Found product price. Net: 68, Gross: 83.64
+FINAL: Returning Net: 68, Gross: 83.64
+---
+---
+START getEffectivePrice for product 6, client
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"171.60","price_gross":"211.07"}
+Found product price. Net: 171.6, Gross: 211.07
+FINAL: Returning Net: 171.6, Gross: 211.07
+---
+---
+START getEffectivePrice for product 7, client
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"233.20","price_gross":"286.84"}
+Found product price. Net: 233.2, Gross: 286.84
+FINAL: Returning Net: 233.2, Gross: 286.84
+---
+---
+START getEffectivePrice for product 1, client 1
+Client price query executed. Found: {"price_net":"894.31","price_gross":"1100.00"}
+Found client price. Net: 894.31, Gross: 1100
+FINAL: Returning Net: 894.31, Gross: 1100
+---
+---
+START getEffectivePrice for product 2, client 1
+Client price query executed. Found: {"price_net":"1056.91","price_gross":"1300.00"}
+Found client price. Net: 1056.91, Gross: 1300
+FINAL: Returning Net: 1056.91, Gross: 1300
+---
+---
+START getEffectivePrice for product 3, client 1
+Client price query executed. Found: {"price_net":"32.52","price_gross":"40.00"}
+Found client price. Net: 32.52, Gross: 40
+FINAL: Returning Net: 32.52, Gross: 40
+---
+---
+START getEffectivePrice for product 4, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"}
+Found product price. Net: 9.95, Gross: 12.24
+FINAL: Returning Net: 9.95, Gross: 12.24
+---
+---
+START getEffectivePrice for product 5, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"68.00","price_gross":"83.64"}
+Found product price. Net: 68, Gross: 83.64
+FINAL: Returning Net: 68, Gross: 83.64
+---
+---
+START getEffectivePrice for product 6, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"171.60","price_gross":"211.07"}
+Found product price. Net: 171.6, Gross: 211.07
+FINAL: Returning Net: 171.6, Gross: 211.07
+---
+---
+START getEffectivePrice for product 7, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"233.20","price_gross":"286.84"}
+Found product price. Net: 233.2, Gross: 286.84
+FINAL: Returning Net: 233.2, Gross: 286.84
+---
+---
+START getEffectivePrice for product 1, client 1
+Client price query executed. Found: {"price_net":"894.31","price_gross":"1100.00"}
+Found client price. Net: 894.31, Gross: 1100
+FINAL: Returning Net: 894.31, Gross: 1100
+---
+---
+START getEffectivePrice for product 2, client 1
+Client price query executed. Found: {"price_net":"1056.91","price_gross":"1300.00"}
+Found client price. Net: 1056.91, Gross: 1300
+FINAL: Returning Net: 1056.91, Gross: 1300
+---
+---
+START getEffectivePrice for product 3, client 1
+Client price query executed. Found: {"price_net":"32.52","price_gross":"40.00"}
+Found client price. Net: 32.52, Gross: 40
+FINAL: Returning Net: 32.52, Gross: 40
+---
+---
+START getEffectivePrice for product 4, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"}
+Found product price. Net: 9.95, Gross: 12.24
+FINAL: Returning Net: 9.95, Gross: 12.24
+---
+---
+START getEffectivePrice for product 5, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"68.00","price_gross":"83.64"}
+Found product price. Net: 68, Gross: 83.64
+FINAL: Returning Net: 68, Gross: 83.64
+---
+---
+START getEffectivePrice for product 6, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"171.60","price_gross":"211.07"}
+Found product price. Net: 171.6, Gross: 211.07
+FINAL: Returning Net: 171.6, Gross: 211.07
+---
+---
+START getEffectivePrice for product 7, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"233.20","price_gross":"286.84"}
+Found product price. Net: 233.2, Gross: 286.84
+FINAL: Returning Net: 233.2, Gross: 286.84
+---
+---
+START getEffectivePrice for product 1, client 1
+Client price query executed. Found: {"price_net":"894.31","price_gross":"1100.00"}
+Found client price. Net: 894.31, Gross: 1100
+FINAL: Returning Net: 894.31, Gross: 1100
+---
+---
+START getEffectivePrice for product 2, client 1
+Client price query executed. Found: {"price_net":"1056.91","price_gross":"1300.00"}
+Found client price. Net: 1056.91, Gross: 1300
+FINAL: Returning Net: 1056.91, Gross: 1300
+---
+---
+START getEffectivePrice for product 3, client 1
+Client price query executed. Found: {"price_net":"32.52","price_gross":"40.00"}
+Found client price. Net: 32.52, Gross: 40
+FINAL: Returning Net: 32.52, Gross: 40
+---
+---
+START getEffectivePrice for product 4, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"9.95","price_gross":"12.24"}
+Found product price. Net: 9.95, Gross: 12.24
+FINAL: Returning Net: 9.95, Gross: 12.24
+---
+---
+START getEffectivePrice for product 5, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"68.00","price_gross":"83.64"}
+Found product price. Net: 68, Gross: 83.64
+FINAL: Returning Net: 68, Gross: 83.64
+---
+---
+START getEffectivePrice for product 6, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"171.60","price_gross":"211.07"}
+Found product price. Net: 171.6, Gross: 211.07
+FINAL: Returning Net: 171.6, Gross: 211.07
+---
+---
+START getEffectivePrice for product 7, client 1
+Client price query executed. Found: No
+Client price not found or not set, falling back to product price.
+Product price query executed. Found: {"price_net":"233.20","price_gross":"286.84"}
+Found product price. Net: 233.2, Gross: 286.84
+FINAL: Returning Net: 233.2, Gross: 286.84
+---
diff --git a/gemini_next_response.txt b/gemini_next_response.txt
index 2be5a68..2af814e 100644
--- a/gemini_next_response.txt
+++ b/gemini_next_response.txt
@@ -1 +1 @@
-I have fixed the pricing display issue on the product detail and order pages. Please check again.
+I've fixed the translations for the chat widget. All the text, including the title, welcome message, input placeholder, and send button, should now be correctly translated based on the language you select in the client panel. Please check and let me know if you see any other issues.
\ No newline at end of file
diff --git a/includes/footer.php b/includes/footer.php
index a30ae30..a1f9e61 100644
--- a/includes/footer.php
+++ b/includes/footer.php
@@ -3,6 +3,194 @@
© powered by LEA24. All Rights Reserved.
+
+
+
+
\ No newline at end of file
diff --git a/includes/i18n.php b/includes/i18n.php
index 065527c..aaff879 100644
--- a/includes/i18n.php
+++ b/includes/i18n.php
@@ -181,6 +181,10 @@ $translations = [
'order_summary' => 'Podsumowanie zamówienia',
'grand_total' => 'Suma całkowita',
'price' => 'Cena',
+ 'chat_with_assistant' => 'Czat z naszym asystentem',
+ 'chat_hello' => 'Cześć! W czym mogę dzisiaj pomóc?',
+ 'chat_placeholder' => 'Wpisz swoją wiadomość...',
+ 'chat_send_button' => 'Wyślij',
],
'en' => [
'login_header' => 'Login',
@@ -359,6 +363,10 @@ $translations = [
'order_summary' => 'Order Summary',
'grand_total' => 'Grand Total',
'price' => 'Price',
+ 'chat_with_assistant' => 'Chat with our Assistant',
+ 'chat_hello' => 'Hello! How can I help you today?',
+ 'chat_placeholder' => 'Type your message...',
+ 'chat_send_button' => 'Send',
],
];
diff --git a/includes/lang.php b/includes/lang.php
deleted file mode 100644
index bd86260..0000000
--- a/includes/lang.php
+++ /dev/null
@@ -1,232 +0,0 @@
- [
- 'menu_catalog' => 'Katalog',
- 'menu_cart' => 'Koszyk',
- 'menu_orders' => 'Zamówienia',
- 'menu_profile' => 'Profil',
- 'menu_logout' => 'Wyloguj',
- 'btn_add_to_cart' => 'Dodaj do koszyka',
- 'btn_go_to_cart' => 'Przejdź do koszyka',
- 'btn_checkout' => 'Przejdź do zamówienia',
- 'btn_back_to_shop' => 'Wróć do sklepu',
- 'label_quantity' => 'Ilość',
- 'label_price' => 'Cena',
- 'label_total' => 'Razem',
- 'label_product' => 'Produkt',
- 'title_cart' => 'Koszyk',
- 'title_orders' => 'Twoje zamówienia',
- 'title_order_details' => 'Szczegóły zamówienia',
- 'title_checkout' => 'Podsumowanie zamówienia',
- 'title_profile' => 'Profil użytkownika',
- 'footer_powered_by' => 'powered by LEA24',
- 'cart_empty' => 'Twój koszyk jest pusty.',
- 'product' => 'Produkt',
- 'remove' => 'Usuń',
- 'subtotal' => 'Suma częściowa',
- 'continue_shopping' => 'Kontynuuj zakupy',
- 'order_summary' => 'Podsumowanie',
- 'order_date' => 'Data zamówienia',
- 'order_status' => 'Status',
- 'order_total' => 'Suma',
- 'order_action' => 'Akcja',
- 'order_view' => 'Zobacz',
- 'order_id' => 'ID Zamówienia',
- 'order_number' => 'Numer zamówienia',
- 'order_confirmation' => 'Potwierdzenie zamówienia',
- 'order_thank_you' => 'Dziękujemy za złożenie zamówienia.',
- 'order_number_is' => 'Numer Twojego zamówienia to',
- 'first_name' => 'Imię',
- 'last_name' => 'Nazwisko',
- 'email' => 'Email',
- 'current_password' => 'Aktualne hasło',
- 'new_password' => 'Nowe hasło',
- 'confirm_new_password' => 'Potwierdź nowe hasło',
- 'update_profile' => 'Zaktualizuj profil',
- 'password_note' => 'Pozostaw puste, jeśli nie chcesz zmieniać hasła.',
- 'profile_updated' => 'Profil zaktualizowany pomyślnie.',
- 'password_updated' => 'Hasło zaktualizowane pomyślnie.',
- 'password_mismatch' => 'Nowe hasła nie są zgodne.',
- 'incorrect_password' => 'Nieprawidłowe aktualne hasło.',
- 'app_title' => 'B2B Commerce',
- 'btn_update' => 'Zaktualizuj',
- 'btn_remove' => 'Usuń',
- 'label_unit_price' => 'Cena jednostkowa',
- 'label_subtotal' => 'Suma częściowa',
- 'confirm_order' => 'Potwierdź zamówienie',
- 'delivery_payment_options' => 'Opcje dostawy i płatności',
- 'delivery_source' => 'Źródło dostawy',
- 'central_warehouse' => 'Magazyn Centralny',
- 'external_supplier' => 'Dostawca zewnętrzny',
- 'available_trade_credit' => 'Dostępny limit kredytu kupieckiego',
- 'order_notes' => 'Uwagi do zamówienia',
- 'order_history' => 'Historia zamówień',
- 'error_client_id_not_found' => 'Nie znaleziono identyfikatora klienta. Zaloguj się ponownie.',
- 'error_fetching_orders' => 'Wystąpił błąd podczas pobierania zamówień. Prosimy spróbować ponownie później.',
- 'no_orders_yet' => 'Nie masz jeszcze żadnych zamówień.',
- 'btn_view_details' => 'Szczegóły',
- 'error_no_permission' => 'Brak uprawnień do wyświetlenia tego zamówienia.',
- 'error_order_not_found' => 'Nie znaleziono zamówienia lub nie masz do niego dostępu.',
- 'error_database' => 'Błąd bazy danych. Prosimy spróbować ponownie później.',
- 'label_payment_method' => 'Metoda płatności',
- 'label_notes' => 'Uwagi',
- 'label_image' => 'Zdjęcie',
- 'label_no_image' => 'Brak zdjęcia',
- 'btn_back_to_orders' => 'Wróć do listy zamówień',
- 'order_details_for' => 'Szczegóły zamówienia',
- 'error_loading_profile' => 'Wystąpił błąd podczas ładowania danych profilu. Prosimy spróbować ponownie później.',
- 'profile_meta_description' => 'Zarządzaj swoim profilem w platformie B2B Commerce.',
- 'toggle_navigation' => 'Przełącz nawigację',
- 'label_email' => 'Adres e-mail',
- 'label_client' => 'Klient',
- 'password_management' => 'Zarządzanie hasłem',
- 'feature_in_preparation' => 'Funkcja w przygotowaniu.',
- 'track_status_in' => 'Możesz śledzić jego status w panelu',
- 'my_orders' => 'Moje zamówienia',
- 'header_account' => 'Konto',
- // Standardized Statuses
- 'status_pending' => 'Oczekujące',
- 'status_pending_payment' => 'Oczekuje na płatność',
- 'status_paid' => 'Zapłacone',
- 'status_in_progress' => 'W realizacji',
- 'status_shipped' => 'Wysłane',
- 'status_partially_shipped' => 'Częściowo wysłane',
- 'status_completed' => 'Zrealizowane',
- 'status_cancelled' => 'Anulowane',
- // Standardized Payment Methods
- 'payment_method' => 'Metoda płatności',
- 'payment_bank_transfer' => 'Przelew tradycyjny',
- 'payment_online' => 'Płatność online (Przelewy24)',
- 'payment_credit' => 'Kredyt kupiecki',
- 'header_welcome' => 'Witaj',
- 'footer_text' => 'powered by LEA24',
- ],
- 'en' => [
- 'menu_catalog' => 'Catalog',
- 'menu_cart' => 'Cart',
- 'menu_orders' => 'Orders',
- 'menu_profile' => 'Profile',
- 'menu_logout' => 'Logout',
- 'btn_add_to_cart' => 'Add to cart',
- 'btn_go_to_cart' => 'Go to cart',
- 'btn_checkout' => 'Proceed to checkout',
- 'btn_back_to_shop' => 'Back to shop',
- 'label_quantity' => 'Quantity',
- 'label_price' => 'Price',
- 'label_total' => 'Total',
- 'label_product' => 'Product',
- 'title_cart' => 'Shopping Cart',
- 'title_orders' => 'Your Orders',
- 'title_order_details' => 'Order Details',
- 'title_checkout' => 'Checkout',
- 'title_profile' => 'User Profile',
- 'footer_powered_by' => 'powered by LEA24',
- 'cart_empty' => 'Your cart is empty.',
- 'product' => 'Product',
- 'remove' => 'Remove',
- 'subtotal' => 'Subtotal',
- 'continue_shopping' => 'Continue shopping',
- 'order_summary' => 'Order Summary',
- 'order_date' => 'Order Date',
- 'order_status' => 'Status',
- 'order_total' => 'Total',
- 'order_action' => 'Action',
- 'order_view' => 'View',
- 'order_id' => 'Order ID',
- 'order_number' => 'Order Number',
- 'order_confirmation' => 'Order Confirmation',
- 'order_thank_you' => 'Thank you for your order.',
- 'order_number_is' => 'Your order number is',
- 'first_name' => 'First Name',
- 'last_name' => 'Last Name',
- 'email' => 'Email',
- 'current_password' => 'Current Password',
- 'new_password' => 'New Password',
- 'confirm_new_password' => 'Confirm New Password',
- 'update_profile' => 'Update Profile',
- 'password_note' => 'Leave blank if you don\'t want to change the password.',
- 'profile_updated' => 'Profile updated successfully.',
- 'password_updated' => 'Password updated successfully.',
- 'password_mismatch' => 'New passwords do not match.',
- 'incorrect_password' => 'Incorrect current password.',
- 'app_title' => 'B2B Commerce',
- 'btn_update' => 'Update',
- 'btn_remove' => 'Remove',
- 'label_unit_price' => 'Unit price',
- 'label_subtotal' => 'Subtotal',
- 'confirm_order' => 'Confirm order',
- 'delivery_payment_options' => 'Delivery and payment options',
- 'delivery_source' => 'Delivery source',
- 'central_warehouse' => 'Central Warehouse',
- 'external_supplier' => 'External Supplier',
- 'available_trade_credit' => 'Available trade credit',
- 'order_notes' => 'Order notes',
- 'order_history' => 'Order History',
- 'error_client_id_not_found' => 'Client ID not found. Please log in again.',
- 'error_fetching_orders' => 'An error occurred while fetching orders. Please try again later.',
- 'no_orders_yet' => 'You have no orders yet.',
- 'btn_view_details' => 'Details',
- 'error_no_permission' => 'You do not have permission to view this order.',
- 'error_order_not_found' => 'Order not found or you do not have access to it.',
- 'error_database' => 'Database error. Please try again later.',
- 'label_payment_method' => 'Payment Method',
- 'label_notes' => 'Notes',
- 'label_image' => 'Image',
- 'label_no_image' => 'No image',
- 'btn_back_to_orders' => 'Back to orders',
- 'order_details_for' => 'Order Details',
- 'error_loading_profile' => 'An error occurred while loading profile data. Please try again later.',
- 'profile_meta_description' => 'Manage your profile on the B2B Commerce platform.',
- 'toggle_navigation' => 'Toggle navigation',
- 'label_email' => 'Email address',
- 'label_client' => 'Client',
- 'password_management' => 'Password Management',
- 'feature_in_preparation' => 'Feature in preparation.',
- 'track_status_in' => 'You can track its status in the',
- 'my_orders' => 'My Orders',
- 'header_account' => 'Account',
- // Standardized Statuses
- 'status_pending' => 'Pending',
- 'status_pending_payment' => 'Pending payment',
- 'status_paid' => 'Paid',
- 'status_in_progress' => 'In progress',
- 'status_shipped' => 'Shipped',
- 'status_partially_shipped' => 'Partially shipped',
- 'status_completed' => 'Completed',
- 'status_cancelled' => 'Cancelled',
- // Standardized Payment Methods
- 'payment_method' => 'Payment method',
- 'payment_bank_transfer' => 'Bank transfer',
- 'payment_online' => 'Online payment (Przelewy24)',
- 'payment_credit' => 'Trade credit',
- 'header_welcome' => 'Welcome',
- 'footer_text' => 'powered by LEA24',
- ]
-];
-
-if (!function_exists('t')) {
- function t($key) {
- global $translations, $lang;
- return $translations[$lang][$key] ?? $key;
- }
-}
-
-function getCurrentLanguage() {
- global $lang;
- return $lang;
-}
-?>
\ No newline at end of file
diff --git a/order_process.php b/order_process.php
index 93a9169..913b528 100644
--- a/order_process.php
+++ b/order_process.php
@@ -3,7 +3,7 @@ if (session_status() === PHP_SESSION_NONE) {
session_start();
}
require_once 'mail/MailService.php';
-require_once 'includes/lang.php';
+require_once 'includes/init.php';
require_once 'includes/auth.php';
require_login();
require_once 'includes/helpers.php';