Commit 067092f74e20f7b9c2c659b23ddb385790f455ee
1 parent
db5497ee
-
Showing
6 changed files
with
14 additions
and
16 deletions
Show diff stats
common/modules/product/models/Product.php
... | ... | @@ -71,7 +71,7 @@ class Product extends \yii\db\ActiveRecord |
71 | 71 | public function rules() |
72 | 72 | { |
73 | 73 | return [ |
74 | - [['categories'], 'required'], | |
74 | +// [['categories'], 'required'], | |
75 | 75 | [['brand_id'], 'integer'], |
76 | 76 | [['name'], 'string', 'max' => 150], |
77 | 77 | [['alias'], 'string', 'max' => 250], |
... | ... | @@ -136,7 +136,7 @@ class Product extends \yii\db\ActiveRecord |
136 | 136 | */ |
137 | 137 | public function getImages() |
138 | 138 | { |
139 | - return $this->hasMany(ProductImage::className(), ['product_id' => 'product_id'])->filterWhere(['is', 'product_variant_id', NULL]); | |
139 | + return $this->hasMany(ProductImage::className(), ['product_id' => 'product_id']); | |
140 | 140 | } |
141 | 141 | |
142 | 142 | /** | ... | ... |
common/modules/product/models/ProductImageQuery.php
common/modules/product/widgets/views/product_smart.php
... | ... | @@ -7,7 +7,8 @@ use yii\helpers\Url; |
7 | 7 | <div class="pixbox"> |
8 | 8 | <a href="<?= Url::to([ |
9 | 9 | 'catalog/product', |
10 | - 'product' => $product]) | |
10 | + 'product' => $product, | |
11 | + '#' => 'm' .$product->variant->product_variant_id]) | |
11 | 12 | ?>"> |
12 | 13 | <?= \common\components\artboximage\ArtboxImageHelper::getImage($product->imageUrl, 'list')?> |
13 | 14 | </a> |
... | ... | @@ -49,7 +50,8 @@ use yii\helpers\Url; |
49 | 50 | </div> |
50 | 51 | <a href="<?= Url::to([ |
51 | 52 | 'catalog/product', |
52 | - 'product' => $product]) | |
53 | + 'product' => $product, | |
54 | + '#' => 'm' .$product->variant->product_variant_id]) | |
53 | 55 | ?>" class="link_buy">Купить</a> |
54 | 56 | |
55 | 57 | <div class="mycarousel"> | ... | ... |
console/controllers/ImportController.php
... | ... | @@ -137,15 +137,13 @@ class ImportController extends Controller { |
137 | 137 | $is_new_product = empty($_product->product_id); |
138 | 138 | |
139 | 139 | // ==== Set category ==== |
140 | - if ( ($category = CategoryName::find()->filterWhere(['ilike', 'value', trim($catalog_name)])->one()) !== null ) { | |
141 | - $_product->categories = [$category->category_id]; | |
142 | - } else { | |
140 | + if ( ($category = CategoryName::find()->filterWhere(['ilike', 'value', trim($catalog_name)])->one()) === null ) { | |
143 | 141 | // Create category |
144 | 142 | $category = new Category(); |
145 | 143 | $category->name = trim($catalog_name); |
146 | 144 | $category->save(); |
147 | - $_product->categories = [$category->category_id]; | |
148 | 145 | } |
146 | + $_product->categories = [$category->category_id]; | |
149 | 147 | |
150 | 148 | // ===== Set brand ==== |
151 | 149 | if ( $brand_name ) { |
... | ... | @@ -167,8 +165,9 @@ class ImportController extends Controller { |
167 | 165 | $_product->akciya = $product_akciya; |
168 | 166 | $_product->is_new = $product_new; |
169 | 167 | |
170 | - | |
171 | - $_product->save(); | |
168 | + if (!$_product->save()) { | |
169 | + var_dump($category->category_id, $_product->categories);exit; | |
170 | + } | |
172 | 171 | |
173 | 172 | |
174 | 173 | // @todo Set image | ... | ... |
frontend/views/catalog/product.php
... | ... | @@ -2,7 +2,7 @@ |
2 | 2 | use yii\widgets\Breadcrumbs; |
3 | 3 | use yii\web\View; |
4 | 4 | use yii\helpers\Url; |
5 | - | |
5 | +$this->params['seo']['title'] = $product->fullname ; | |
6 | 6 | $this->title = $product->fullname; |
7 | 7 | //$this->title = (! empty($product->meta_title)) ? $product->meta_title : $product->fullname; |
8 | 8 | //$this->registerMetaTag (['name' => 'description', 'content' => ((! empty($product->meta_description)) ? $product->meta_description : $product->fullname)]); | ... | ... |
frontend/views/catalog/products.php
... | ... | @@ -15,11 +15,7 @@ foreach($category->getParents()->all() as $parent) { |
15 | 15 | } |
16 | 16 | $this->params['breadcrumbs'][] = $category->categoryName->value; |
17 | 17 | |
18 | -$this->params['seo']['seo_text'] = 'TEST SEO TEXT'; | |
19 | -$this->params['seo']['h1'] = 'TEST H1'; | |
20 | -$this->params['seo']['description'] = 'TEST DESCRIPTION'; | |
21 | -$this->params['seo']['fields']['name'] = 'TEST NAME FROM FIELD'; | |
22 | -$this->params['seo']['key']= 'product_list'; | |
18 | +$this->params['seo']['title'] = $category->name; | |
23 | 19 | |
24 | 20 | $this->registerCssFile (Yii::getAlias('@web/css/ion.rangeSlider.css')); |
25 | 21 | $this->registerCssFile (Yii::getAlias('@web/css/ion.rangeSlider.skinHTML5.css')); | ... | ... |