From 5490221133a7ae03b8e993d37378037b59a900e8 Mon Sep 17 00:00:00 2001 From: Taras Date: Tue, 17 Nov 2026 16:13:42 +0200 Subject: [PATCH] fix(catalog): prefer the current category row for product position --- src/sCommerce.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/sCommerce.php b/src/sCommerce.php index c58e3dc..57b4012 100644 --- a/src/sCommerce.php +++ b/src/sCommerce.php @@ -187,6 +187,8 @@ public function getProducts(array|QueryBuilder $productIds, ?string $lang = null ->where('s_product_category.category', $this->getCategoryId()) ->orWhere('s_product_category.scope', 'primary'); }) + // Prefer the row of the current category (manual order from admin) over the primary one + ->orderByRaw('(' . DB::getTablePrefix() . 's_product_category.category = ' . (int)$this->getCategoryId() . ') desc') ->limit(1) ]) ->whereIn('id', $productIds)