Commit cfc5b583b78ba6c0079dd0a1da330b1030ad73a5
1 parent
ebf6e240
14.09.16
Showing
3 changed files
with
16 additions
and
2 deletions
Show diff stats
common/modules/product/models/Product.php
@@ -238,10 +238,24 @@ class Product extends \yii\db\ActiveRecord | @@ -238,10 +238,24 @@ class Product extends \yii\db\ActiveRecord | ||
238 | 'Кошельки' => 'Кошелек', | 238 | 'Кошельки' => 'Кошелек', |
239 | 'Гермочехлы' => 'Гермочехол', | 239 | 'Гермочехлы' => 'Гермочехол', |
240 | ]; | 240 | ]; |
241 | + return empty($this->brand) ? $this->name : $this->brand->name .' '. $this->name; | ||
242 | + } | ||
243 | + | ||
244 | + public function getFullNameWithCategory() | ||
245 | + { | ||
246 | + $words = [ | ||
247 | + 'Рюкзаки' => 'Рюкзак', | ||
248 | + 'Несессеры' => 'Несессер', | ||
249 | + 'Сумки' => 'Сумка', | ||
250 | + 'Чехлы' => 'Чехол', | ||
251 | + 'Кошельки' => 'Кошелек', | ||
252 | + 'Гермочехлы' => 'Гермочехол', | ||
253 | + ]; | ||
241 | $name = empty($this->brand) ? $this->name : $this->brand->name .' '. $this->name; | 254 | $name = empty($this->brand) ? $this->name : $this->brand->name .' '. $this->name; |
242 | return empty($this->category->categoryName->value) ? $name : (isset($words[$this->category->categoryName->value])? $words[$this->category->categoryName->value]: '') .' '. $name; | 255 | return empty($this->category->categoryName->value) ? $name : (isset($words[$this->category->categoryName->value])? $words[$this->category->categoryName->value]: '') .' '. $name; |
243 | } | 256 | } |
244 | 257 | ||
258 | + | ||
245 | public function getCategories() { | 259 | public function getCategories() { |
246 | return $this->hasMany(Category::className(), ['category_id' => 'category_id'])->viaTable('product_category', ['product_id' => 'product_id']); | 260 | return $this->hasMany(Category::className(), ['category_id' => 'category_id'])->viaTable('product_category', ['product_id' => 'product_id']); |
247 | // return $this->getRelations('product_categories'); | 261 | // return $this->getRelations('product_categories'); |
frontend/views/catalog/product.php
@@ -15,7 +15,7 @@ use frontend\assets\FlipclockAsset; | @@ -15,7 +15,7 @@ use frontend\assets\FlipclockAsset; | ||
15 | FlipclockAsset::register($this); | 15 | FlipclockAsset::register($this); |
16 | $this->params[ 'seo' ][ 'key' ] = $category->categoryName->value; | 16 | $this->params[ 'seo' ][ 'key' ] = $category->categoryName->value; |
17 | $this->params[ 'seo' ][ 'fields' ][ 'name' ] = $product->fullname; | 17 | $this->params[ 'seo' ][ 'fields' ][ 'name' ] = $product->fullname; |
18 | - $this->params[ 'seo' ][ 'h1' ] = !empty( Seo::widget([ 'row' => 'h1' ]) ) ? Seo::widget([ 'row' => 'h1' ]) : $product->fullname; | 18 | + $this->params[ 'seo' ][ 'h1' ] = !empty( Seo::widget([ 'row' => 'h1' ]) ) ? Seo::widget([ 'row' => 'h1' ]) : $product->fullnamewithcategory; |
19 | 19 | ||
20 | //$this->params['seo']['title'] = "Купить " . substr($product->category->categoryName->value, 0, -2) . " " . $product->fullname . " в Киеве, Харькове, Украине: цены, отзывы - Rukzachok.com.ua"; | 20 | //$this->params['seo']['title'] = "Купить " . substr($product->category->categoryName->value, 0, -2) . " " . $product->fullname . " в Киеве, Харькове, Украине: цены, отзывы - Rukzachok.com.ua"; |
21 | //$this->params['seo']['description'] = "Заказать " . substr($product->category->categoryName->value, 0, -2) . " " . $product->fullname . " - самые модные и стильные рюкзаки в Украине по лучшим ценам. Интернет магазин рюкзаков Rukzachok.com.ua"; | 21 | //$this->params['seo']['description'] = "Заказать " . substr($product->category->categoryName->value, 0, -2) . " " . $product->fullname . " - самые модные и стильные рюкзаки в Украине по лучшим ценам. Интернет магазин рюкзаков Rukzachok.com.ua"; |
frontend/views/catalog/product_item.php
@@ -64,7 +64,7 @@ | @@ -64,7 +64,7 @@ | ||
64 | 'product' => $product, | 64 | 'product' => $product, |
65 | '#' => 'm' . $product->enabledVariants[ 0 ]->product_variant_id, | 65 | '#' => 'm' . $product->enabledVariants[ 0 ]->product_variant_id, |
66 | ]) ?>" | 66 | ]) ?>" |
67 | - class="name"><?= $product->fullname ?> | 67 | + class="name"><?= $product->fullnamewithcategory ?> |
68 | </a></div> | 68 | </a></div> |
69 | 69 | ||
70 | <?php | 70 | <?php |