diff --git a/index.php b/index.php
index 1310f72..7ca45a3 100644
--- a/index.php
+++ b/index.php
@@ -458,9 +458,10 @@ if (isset($_GET['action']) || isset($_POST['action'])) {
$q = $_GET['q'] ?? '';
$searchTerm = "%$q%";
- $sql = "SELECT * FROM stock_items WHERE (name_en LIKE ? OR name_ar LIKE ? OR sku LIKE ?) ORDER BY name_en ASC LIMIT 100";
+ $oid = current_outlet_id();
+ $sql = "SELECT * FROM stock_items WHERE outlet_id = ? AND (name_en LIKE ? OR name_ar LIKE ? OR sku LIKE ?) ORDER BY name_en ASC LIMIT 100";
$products_raw = db()->prepare($sql);
- $products_raw->execute([$searchTerm, $searchTerm, $searchTerm]);
+ $products_raw->execute([$oid, $searchTerm, $searchTerm, $searchTerm]);
while($p = $products_raw->fetch(PDO::FETCH_ASSOC)) {
$p['original_price'] = (float)$p['sale_price'];
$p['sale_price'] = getPromotionalPrice($p);
@@ -475,7 +476,7 @@ if (isset($_GET['action']) || isset($_POST['action'])) {
-
@@ -497,8 +498,9 @@ if (isset($_GET['action']) || isset($_POST['action'])) {
$sku = $_GET['sku'] ?? '';
if (!$sku) { echo json_encode(null); exit; }
- $stmt = db()->prepare("SELECT * FROM stock_items WHERE sku = ? LIMIT 1");
- $stmt->execute([$sku]);
+ $oid = current_outlet_id();
+ $stmt = db()->prepare("SELECT * FROM stock_items WHERE sku = ? AND outlet_id = ? LIMIT 1");
+ $stmt->execute([$sku, $oid]);
$p = $stmt->fetch(PDO::FETCH_ASSOC);
if ($p) {
@@ -5372,7 +5374,8 @@ $projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? 'Accounting System';
$registers = db()->query("SELECT * FROM cash_registers WHERE status = 'active'")->fetchAll();
$allow_zero_stock_sell = ($data['settings']['allow_zero_stock_sell'] ?? '1') === '1';
- $sql = "SELECT * FROM stock_items ORDER BY name_en ASC LIMIT 100";
+ $oid = current_outlet_id();
+ $sql = "SELECT * FROM stock_items WHERE outlet_id = $oid ORDER BY name_en ASC LIMIT 100";
$products_raw = db()->query($sql)->fetchAll(PDO::FETCH_ASSOC);
$products = [];
foreach ($products_raw as $p) {
@@ -5408,7 +5411,7 @@ $projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? 'Accounting System';
-
= htmlspecialchars($p['name_en']) ?>
+
= htmlspecialchars($p['name_en'] ?: $p['name_ar']) ?>
= htmlspecialchars($p['sku']) ?>
diff --git a/summary.txt b/summary.txt
index 28e203f..bacf4ca 100644
--- a/summary.txt
+++ b/summary.txt
@@ -1,14 +1,13 @@
Plan:
-- Update `index.php` to use a dynamic page title (`__($page)`) instead of the hardcoded "Accounting".
-- Add "Copy Outlet Data" to `includes/lang.php` (both English and Arabic) to ensure the title displays correctly without hyphens.
+1. **Filter by Outlet:** Updated POS item queries (initial load, search, SKU lookup) to filter by the current `outlet_id`.
+2. **Fix Name Display:** Updated the item card rendering to show `name_ar` if `name_en` is empty, fixing the issue where items appeared with only SKU.
+3. **Data Fix:** Ran a one-time update to assign all existing unassigned items to Outlet 1.
Changed:
-- `index.php`: Changed `
` tag to use `__($page)`.
-- `includes/lang.php`: Added `'copy_outlet_data' => 'Copy Outlet Data'` (and Arabic equivalent).
+* `index.php`: Added `WHERE outlet_id = ?` to POS queries and updated item name display logic.
Notes:
-- This change also fixes a bug where *every* page was previously titled "Accounting - Admin Panel". Now all pages will show their correct titles (e.g., "Dashboard", "Sales", "POS").
+* POS now correctly shows only items for the selected outlet.
+* Items without an English name will now display their Arabic name instead of a blank space (or appearing as just SKU).
-Next:
-- Refresh the "Copy/Sync Outlet Data" page to see the new title "Copy Outlet Data - Admin Panel".
-- Reminder: click Save in the editor to sync changes.
\ No newline at end of file
+Next: Verify that switching outlets changes the POS items and that all items display a name.
\ No newline at end of file