From d0fda0a168f78d1b4b92b132818552e19e1803c7 Mon Sep 17 00:00:00 2001 From: Kevin Meijer Date: Wed, 19 Aug 2026 11:42:38 +0200 Subject: [PATCH 1/2] Added fix for filterable check in query --- .../CP/ProductAttributeController.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/Http/Controllers/CP/ProductAttributeController.php b/src/Http/Controllers/CP/ProductAttributeController.php index a7e1e62..adf7d84 100644 --- a/src/Http/Controllers/CP/ProductAttributeController.php +++ b/src/Http/Controllers/CP/ProductAttributeController.php @@ -13,8 +13,19 @@ public function index() return []; } - return $model::with('attributeOptions') - ->filterable() - ->get(); + $query = $model::with('attributeOptions'); + + // Pick the correct filter strategy for the configured model. + if (is_a($model, \Rapidez\StatamicQueryBuilder\Models\ProductAttribute::class, true)) { + $query->filterable(); + } else { + $query->whereIn('eav_attribute.attribute_id', function ($subQuery) { + $subQuery->select('attribute_id') + ->from('catalog_eav_attribute') + ->where('is_filterable', '>', 0); + }); + } + + return $query->get(); } } From 02790ff77885753857e0724796dafe0223f0a4e8 Mon Sep 17 00:00:00 2001 From: Kevin Meijer Date: Wed, 19 Aug 2026 11:47:01 +0200 Subject: [PATCH 2/2] Fixed pint error --- src/Http/Controllers/CP/ProductAttributeController.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Http/Controllers/CP/ProductAttributeController.php b/src/Http/Controllers/CP/ProductAttributeController.php index adf7d84..490cd10 100644 --- a/src/Http/Controllers/CP/ProductAttributeController.php +++ b/src/Http/Controllers/CP/ProductAttributeController.php @@ -2,6 +2,7 @@ namespace Rapidez\StatamicQueryBuilder\Http\Controllers\CP; +use Rapidez\StatamicQueryBuilder\Models\ProductAttribute as QueryBuilderProductAttribute; use Statamic\Http\Controllers\CP\CpController; class ProductAttributeController extends CpController @@ -16,7 +17,7 @@ public function index() $query = $model::with('attributeOptions'); // Pick the correct filter strategy for the configured model. - if (is_a($model, \Rapidez\StatamicQueryBuilder\Models\ProductAttribute::class, true)) { + if (is_a($model, QueryBuilderProductAttribute::class, true)) { $query->filterable(); } else { $query->whereIn('eav_attribute.attribute_id', function ($subQuery) {