PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.6.5
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.6.5
1.6.5 1.6.4 1.6.3 1.6.2 1.6.1 1.6.0 1.5.4 1.5.5 1.5.3 1.5.2 1.5.1 1.5.0 1.4.2 1.4.1 1.4.0 1.3.28 1.3.27 1.3.26 1.3.25 1.3.23 1.3.22 1.3.21 1.3.20 1.3.19 trunk All 48 releases
← All changes | app/Modules/Shipping/Http/Requests/ShippingZoneRequest.php +16 -0 1.5.3 → 1.6.5 View file →
@@ -19,8 +19,24 @@
19 19 // Only include shipping_class_id if explicitly submitted — prevents wiping on edit
20 20 if (array_key_exists('shipping_class_id', $data)) {
21 21 $classId = $data['shipping_class_id'];
22 22 $data['shipping_class_id'] = $classId ? intval($classId) : null;
23 + } else {
24 + // Omitted on update means "preserve the stored class". Resolve the
25 + // effective class HERE (this return is merged into the request) so
26 + // the whole-world uniqueness rule below validates the same class
27 + // bucket the row will actually keep — and the controller writes
28 + // that same value back. Without this, a class-scoped zone going
29 + // region=all was checked against general zones: falsely rejected by
30 + // an unrelated general whole-world zone, while a real conflict in
31 + // its own class went unchecked.
32 + $currentId = Arr::get($data, 'id') ?: App::getInstance()->request->get('id');
33 + if ($currentId) {
34 + $storedClassId = \FluentCart\App\Models\ShippingZone::query()
35 + ->where('id', intval($currentId))
36 + ->value('shipping_class_id');
37 + $data['shipping_class_id'] = $storedClassId ? intval($storedClassId) : null;
38 + }
23 39 }
24 40
25 41 return $data;
26 42 }