diff --git a/beike/Admin/Http/Controllers/SettingController.php b/beike/Admin/Http/Controllers/SettingController.php index 1c2a5ce9..04d16eae 100644 --- a/beike/Admin/Http/Controllers/SettingController.php +++ b/beike/Admin/Http/Controllers/SettingController.php @@ -30,15 +30,20 @@ class SettingController extends Controller { $themes = ThemeRepo::getAllThemes(); - $tax_address = [ + $taxAddress = [ ['value' => 'shipping', 'label' => trans('admin/setting.shipping_address')], ['value' => 'payment', 'label' => trans('admin/setting.payment_address')], ]; + $multiFilter = system_setting('base.multi_filter'); + if ($attributeIds = $multiFilter['attribute'] ?? []) { + $multiFilter['attribute'] = AttributeRepo::getByIds($attributeIds); + } $data = [ 'countries' => CountryRepo::listEnabled(), 'currencies' => CurrencyRepo::listEnabled(), - 'tax_address' => $tax_address, + 'multi_filter' => $multiFilter, + 'tax_address' => $taxAddress, 'customer_groups' => CustomerGroupDetail::collection(CustomerGroupRepo::list())->jsonSerialize(), 'themes' => $themes, ]; diff --git a/beike/Admin/Services/ProductService.php b/beike/Admin/Services/ProductService.php index 93c5592c..912facdb 100644 --- a/beike/Admin/Services/ProductService.php +++ b/beike/Admin/Services/ProductService.php @@ -27,6 +27,7 @@ class ProductService DB::beginTransaction(); $data['brand_id'] = (int) $data['brand_id']; + $data['weight'] = (float) $data['weight']; $data['variables'] = json_decode($data['variables']); $product->fill($data); $product->updated_at = now(); diff --git a/beike/Repositories/ProductRepo.php b/beike/Repositories/ProductRepo.php index c1fe771c..b42f18e2 100644 --- a/beike/Repositories/ProductRepo.php +++ b/beike/Repositories/ProductRepo.php @@ -206,6 +206,11 @@ class ProductRepo ->whereNotNull('pa.attribute_id') ->distinct() ->reorder('pa.attribute_id'); + + if ($attributesIds = system_setting('base.multi_filter', [])['attribute'] ?? []) { + $builder->whereIn('pa.attribute_id', $attributesIds); + } + $productAttributes = $builder->get()->toArray(); $attributeMap = array_column(Attribute::query()->with('description')->orderBy('sort_order')->get()->toArray(), null, 'id'); diff --git a/resources/beike/admin/views/pages/setting.blade.php b/resources/beike/admin/views/pages/setting.blade.php index 66a4082a..d6fd18a4 100644 --- a/resources/beike/admin/views/pages/setting.blade.php +++ b/resources/beike/admin/views/pages/setting.blade.php @@ -113,6 +113,42 @@ +