Browse Source

商品属性根据商品分类获取

wechat_public_accounts
linyaostalker 5 years ago
parent
commit
d76802339e
  1. 58
      vendor/antgoods/goods/src/assets/custom/sku.dd9a085c7b4ca26936f9.js
  2. 14
      vendor/antgoods/goods/src/controllers/GoodsController.php
  3. 1
      vendor/antgoods/goods/src/views/goods/update.php
  4. 2
      vendor/antgoods/goods/src/web/GoodsAttributeAsset.php

58
vendor/antgoods/goods/src/assets/custom/sku.dd9a085c7b4ca26936f9.js
File diff suppressed because it is too large
View File

14
vendor/antgoods/goods/src/controllers/GoodsController.php

@ -4,6 +4,7 @@ namespace antgoods\goods\controllers;
use antgoods\goods\models\ars\GoodsAttr;
use antgoods\goods\models\ars\GoodsSku;
use common\models\ars\OrderGoods;
use common\models\ars\TemFile;
use MongoDB\Driver\Manager;
use Yii;
@ -15,6 +16,7 @@ use yii\filters\VerbFilter;
use antgoods\goods\logic\goods\GoodsManager;
use common\models\ars\File;
use yii\web\Response;
use antgoods\goods\models\ars\Attribute;
/**
* GoodsController implements the CRUD actions for Goods model.
@ -331,4 +333,16 @@ class GoodsController extends Controller
$data['attributes'] = GoodsManager::getAttrs($id, $type);
return $data;
}
/**
* @return false|string
* 根据商品分类获取商品属性
*/
public function actionFilterAttribute()
{
$catId = Yii::$app->request->get('catId')??0;
$goodsId = Yii::$app->request->get('goodsId')??0;
$allAttr = Attribute::find()->where(['type' => Attribute::TYPE_ATTR])->andWhere(['cat_id' => [0,$catId]])->asArray()->all();
return json_encode($allAttr);
}
}

1
vendor/antgoods/goods/src/views/goods/update.php

@ -40,6 +40,7 @@ Yii::$app->params['bsVersion'] = '4.x';
'content' => $this->render('attribute', [
'model' => $attributeModel,
'attrValue' => $attrValue,
'goodsModel' => $model,
]),
],
[

2
vendor/antgoods/goods/src/web/GoodsAttributeAsset.php

@ -13,7 +13,7 @@ class GoodsAttributeAsset extends AssetBundle
public $css = [
];
public $js = [
'custom/sku.99cb07c4f1a205e0a84a.js'
'custom/sku.dd9a085c7b4ca26936f9.js'
];
public $depends = [
'yii\web\YiiAsset',

Loading…
Cancel
Save