NoteStar 5 лет назад
Родитель
Сommit
e105a62e56

+ 5 - 1
vendor/fancyecommerce/fecshop/app/appadmin/modules/Catalog/block/productinfo/Manageredit.php

@@ -423,7 +423,11 @@ class Manageredit extends AppadminbaseBlockEdit implements AppadminbaseBlockEdit
                 //exit;
             }
         }
-        
+
+        if (Yii::$app->request->post('plbj') == 'ok') {
+            $this->_param['plbj'] = 'ok';
+        }
+
         $this->_service->save($this->_param, 'catalog/product/index');
         
         $errors = Yii::$service->helper->errors->get();

+ 1 - 0
vendor/fancyecommerce/fecshop/app/appadmin/theme/base/default/catalog/productinfo/manageredit.php

@@ -226,6 +226,7 @@ function thissubmit(thiss){
 							<p class="edit_p">
 								<?= $attrGroup ?>
 							</p>
+                            <p><input type="checkbox"  value="ok" size="30" name="plbj" class="textInput ">&nbsp;&nbsp;批量编辑</p>
 						</div>
 					</fieldset>
 					<?= $baseInfo ?>

+ 16 - 0
vendor/fancyecommerce/fecshop/services/product/ProductMysqldb.php

@@ -10,6 +10,7 @@
 
 namespace fecshop\services\product;
 
+use fecshop\models\mysqldb\Product;
 use fecshop\services\Service;
 use yii\db\Query;
 use Yii;
@@ -431,6 +432,21 @@ class ProductMysqldb extends Service implements ProductInterface
         
         if ($primaryVal) {
             $model = $this->_productModel->findOne($primaryVal);
+
+            if($one['plbj'] == 'ok'){
+                $updata = [
+                    'name' => serialize($one['name']),
+                    'status' => $one['status'],
+                    'meta_title' => serialize($one['meta_title']),
+                    'meta_keywords' => serialize($one['meta_keywords']),
+                    'meta_description' => serialize($one['meta_description']),
+                    'short_description' => serialize($one['short_description']),
+                    'description' => serialize($one['description']),
+                ];
+                Product::updateAll($updata,['spu'=>$one['spu']]);
+                return $model;
+            }
+
             if (!$model) {
                 Yii::$service->helper->errors->add('Product {primaryKey} is not exist', ['primaryKey'=>$this->getPrimaryKey()]);