Commit 1ac2e1aab8b1eac230123ba4c97c1c3f8488847f
1 parent
ae37da79
-Characteristics kind of ready
Showing
3 changed files
with
36 additions
and
7 deletions
Show diff stats
common/modules/product/models/BrandSearch.php
| @@ -101,13 +101,13 @@ class BrandSearch extends Brand | @@ -101,13 +101,13 @@ class BrandSearch extends Brand | ||
| 101 | 101 | ||
| 102 | $query->innerJoin('product_variant', 'product_variant.product_id = '. Product::tableName() .'.product_id'); | 102 | $query->innerJoin('product_variant', 'product_variant.product_id = '. Product::tableName() .'.product_id'); |
| 103 | $query->where(['!=', 'product_variant.status', 1]); | 103 | $query->where(['!=', 'product_variant.status', 1]); |
| 104 | - $query->groupBy(Product::tableName() .'.product_id'); | 104 | +// $query->groupBy(Product::tableName() .'.product_id'); |
| 105 | if (!empty($category)) { | 105 | if (!empty($category)) { |
| 106 | $query->andWhere([ | 106 | $query->andWhere([ |
| 107 | ProductCategory::tableName() .'.category_id' => $category->category_id | 107 | ProductCategory::tableName() .'.category_id' => $category->category_id |
| 108 | ]); | 108 | ]); |
| 109 | } | 109 | } |
| 110 | - $query->groupBy(Brand::tableName() .'.brand_id'); | 110 | +// $query->groupBy(Brand::tableName() .'.brand_id'); |
| 111 | 111 | ||
| 112 | return $query; | 112 | return $query; |
| 113 | } | 113 | } |
frontend/models/ProductFrontendSearch.php
| @@ -102,7 +102,7 @@ class ProductFrontendSearch extends Product { | @@ -102,7 +102,7 @@ class ProductFrontendSearch extends Product { | ||
| 102 | $query->select(['product.*']); | 102 | $query->select(['product.*']); |
| 103 | $query->joinWith(['enabledVariants','brand','options', 'category']); | 103 | $query->joinWith(['enabledVariants','brand','options', 'category']); |
| 104 | 104 | ||
| 105 | - $query->groupBy(['product.product_id', 'product_variant.price', 'product_variant.stock']); | 105 | +// $query->groupBy(['product.product_id', 'product_variant.price', 'product_variant.stock']); |
| 106 | $query->orderBy(['product_variant.stock' => SORT_DESC]); | 106 | $query->orderBy(['product_variant.stock' => SORT_DESC]); |
| 107 | ProductHelper::_setQueryParams($query, $params); | 107 | ProductHelper::_setQueryParams($query, $params); |
| 108 | if($in_stock){ | 108 | if($in_stock){ |
frontend/views/catalog/product.php
| @@ -12,6 +12,7 @@ | @@ -12,6 +12,7 @@ | ||
| 12 | use yii\bootstrap\ActiveForm; | 12 | use yii\bootstrap\ActiveForm; |
| 13 | use yii\bootstrap\Html; | 13 | use yii\bootstrap\Html; |
| 14 | use yii\helpers\Url; | 14 | use yii\helpers\Url; |
| 15 | + use yii\helpers\VarDumper; | ||
| 15 | use yii\web\View; | 16 | use yii\web\View; |
| 16 | use yii\widgets\MaskedInput; | 17 | use yii\widgets\MaskedInput; |
| 17 | use frontend\assets\FlipclockAsset; | 18 | use frontend\assets\FlipclockAsset; |
| @@ -492,14 +493,42 @@ | @@ -492,14 +493,42 @@ | ||
| 492 | </tr> | 493 | </tr> |
| 493 | <tr class="full short"> | 494 | <tr class="full short"> |
| 494 | <td class="name">Бренд</td> | 495 | <td class="name">Бренд</td> |
| 495 | - <td class="value"><?= !empty($product->brand) ? $product->brand->name : '' ?></td> | 496 | + <td class="value"><?= !empty($product->brand) ? Html::a($product->brand->name, [ |
| 497 | + 'catalog/category', | ||
| 498 | + 'category' => $category, | ||
| 499 | + 'filters' => [ | ||
| 500 | + 'brands' => [ | ||
| 501 | + $product->brand->alias | ||
| 502 | + ] | ||
| 503 | + ] | ||
| 504 | + ]) : '' ?></td> | ||
| 496 | </tr> | 505 | </tr> |
| 497 | - <?php foreach($product->getActiveProperties($category->category_id) as $group): ?> | 506 | + <?php foreach($product->getActiveProperties($category->category_id) as $group) { |
| 507 | + ?> | ||
| 498 | <tr class="full short gray"> | 508 | <tr class="full short gray"> |
| 499 | <td class="name"><?= $group->name ?></td> | 509 | <td class="name"><?= $group->name ?></td> |
| 500 | - <td class="value"><?php foreach($group->_options as $option) : ?> <?= $option->ValueRenderHTML ?><?php endforeach ?></td> | 510 | + <td class="value"> |
| 511 | + <?php | ||
| 512 | + foreach($group->_options as $option) { | ||
| 513 | + if ($group->is_filter) { | ||
| 514 | + echo Html::a(' ' . $option->ValueRenderHTML, | ||
| 515 | + [ | ||
| 516 | + 'catalog/category', | ||
| 517 | + 'category' => $category, | ||
| 518 | + 'filters' => [ | ||
| 519 | + $group->alias => [ | ||
| 520 | + $option->alias | ||
| 521 | + ] | ||
| 522 | + ] | ||
| 523 | + ]); | ||
| 524 | + } else { | ||
| 525 | + echo ' ', $option->ValueRenderHTML; | ||
| 526 | + } | ||
| 527 | + } | ||
| 528 | + ?> | ||
| 529 | + </td> | ||
| 501 | </tr> | 530 | </tr> |
| 502 | - <?php endforeach; ?> | 531 | + <?php } ; ?> |
| 503 | 532 | ||
| 504 | </tbody> | 533 | </tbody> |
| 505 | </table> | 534 | </table> |