From 1f58f19a7615511cb53605b18f57d3493340185f Mon Sep 17 00:00:00 2001 From: merdan Date: Fri, 15 Sep 2023 14:33:37 +0500 Subject: [PATCH] search fix --- config/scout.php | 2 +- packages/Webkul/Product/src/Models/ProductFlat.php | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/config/scout.php b/config/scout.php index c73706702..3fa4c9964 100644 --- a/config/scout.php +++ b/config/scout.php @@ -120,7 +120,7 @@ return [ 'key' => env('MEILISEARCH_KEY', 'qazwsx12qazwsx12'), 'index-settings' => [ \Webkul\Product\Models\ProductFlat::class => [ - 'filterableAttributes'=> ['locale', 'channel' ], +// 'filterableAttributes'=> ['locale', 'channel' ], 'sortableAttributes' => ['name','created_at','min_price'], // Other settings fields... ], diff --git a/packages/Webkul/Product/src/Models/ProductFlat.php b/packages/Webkul/Product/src/Models/ProductFlat.php index 80cd801a8..d013dee63 100644 --- a/packages/Webkul/Product/src/Models/ProductFlat.php +++ b/packages/Webkul/Product/src/Models/ProductFlat.php @@ -53,15 +53,23 @@ class ProductFlat extends Model implements ProductFlatContract { return 'products_index'; } + + public function searchable(): bool + { + return $this->status || $this->visible_individually; + } + public function toSearchableArray():array { return [ 'id' => $this->id, 'name' => $this->name, 'meta_keywords' => $this->meta_keywords, + 'min_price' => $this->min_price, 'status' => $this->status, 'visible_individually'=> $this->visible_individually, - 'product_id' => $this->product_id + 'product_id' => $this->product_id, + 'created_at' => $this->created_at, ]; } /**