Преглед изворни кода

Merge branch 'variant' of http://gogs.hnwmzp.cn/chengwenliang/nshop into variant

chengwl пре 8 часа
родитељ
комит
f4a66682e4

+ 3 - 3
packages/Longyi/Core/src/Http/Controllers/Admin/FlexibleVariantController.php

@@ -306,7 +306,7 @@ class FlexibleVariantController extends Controller
         }
     }
 
-    public function saveVariants($request){
+    public function saveVariants(Request $request){
         $this->validate($request,[
             'selected_options' => 'array',
             'selected_options.*.code' => 'required|string',
@@ -393,7 +393,7 @@ class FlexibleVariantController extends Controller
                         ];
                 });
             //同步选项
-            $this->_product->productOptions()->sync($productOptions);
+            $this->_product->options()->sync($productOptions);
             
             $variantIds=collect($variants)->pluck('id');
             //删除无用的变体
@@ -427,7 +427,7 @@ class FlexibleVariantController extends Controller
                 fn ($o) => $o['code'] == $option
             );
             $valueId = collect($selectedOption['option_values'])->first(
-                fn ($v) => $v['code'] == $value
+                fn ($v) => $v['code'] == $value['code']
             )['id'];
             $valueIds[] = $valueId;
         }