Commit cc0ddab0cffc7102f89a8d651d5a4241d870b098

Authored by Administrator
1 parent aac54f27

big commti

common/modules/product/helpers/ProductHelper.php
... ... @@ -94,8 +94,8 @@
94 94 ->where([ Product::tableName() . '.product_id' => $last_products ])
95 95 ->andWhere([
96 96 '!=',
97   - ProductVariant::tableName() . '.stock',
98   - 0,
  97 + ProductVariant::tableName() . '.status',
  98 + 1,
99 99 ])
100 100 ->all();
101 101 }
... ... @@ -120,8 +120,8 @@
120 120 ->where($data)
121 121 ->andWhere([
122 122 '!=',
123   - ProductVariant::tableName() . '.stock',
124   - 0,
  123 + ProductVariant::tableName() . '.status',
  124 + 1,
125 125 ])
126 126 ->limit($count)/*->orderBy($sort)*/
127 127 ->all();
... ... @@ -149,8 +149,8 @@
149 149 ->joinWith('category')
150 150 ->where([
151 151 '!=',
152   - 'product_variant.stock',
153   - 0,
  152 + 'product_variant.status',
  153 + 1,
154 154 ])
155 155 ->andWhere([ 'product_category.category_id' => $product_categories ]);
156 156 // $query->andWhere(['>=', 'product_variant.price', $product->enabledVariant->price * 0.7]);
... ...
common/modules/product/models/BrandSearch.php
... ... @@ -140,7 +140,7 @@ class BrandSearch extends Brand
140 140  
141 141  
142 142 $query->innerJoin('product_variant', 'product_variant.product_id = '. Product::tableName() .'.product_id');
143   - $query->where(['!=', 'product_variant.stock', 0]);
  143 + $query->where(['!=', 'product_variant.status', 1]);
144 144 $query->groupBy(Product::tableName() .'.product_id');
145 145 if (!empty($category)) {
146 146 $query->andWhere([
... ...
common/modules/product/models/Category.php
... ... @@ -210,7 +210,6 @@ class Category extends \yii\db\ActiveRecord
210 210 ->innerJoin('product_category', 'product_category.product_id = product.product_id')
211 211 ->innerJoin('tax_group_to_category', 'tax_group.tax_group_id = tax_group_to_category.tax_group_id')
212 212 ->where(['product_category.category_id' => $this->category_id, 'tax_group.is_filter' => TRUE,'tax_group_to_category.category_id'=>$this->category_id])
213   - ->andWhere(['!=', 'product_variant.stock', 0])
214 213 ->andWhere(['!=', 'product_variant.status', 1]);
215 214  
216 215 $query2 = (new Query())
... ... @@ -226,7 +225,6 @@ class Category extends \yii\db\ActiveRecord
226 225 ->innerJoin('product_variant', 'product_variant.product_id = product.product_id')
227 226 ->innerJoin('tax_group_to_category', 'tax_group.tax_group_id = tax_group_to_category.tax_group_id')
228 227 ->where(['product_category.category_id' => $this->category_id, 'tax_group.is_filter' => TRUE,'tax_group_to_category.category_id'=>$this->category_id])
229   - ->andWhere(['!=', 'product_variant.stock', 0])
230 228 ->andWhere(['!=', 'product_variant.status', 1]);
231 229 $query3 = (new Query())
232 230 ->select([
... ...
common/modules/product/models/Product.php
... ... @@ -180,7 +180,6 @@ class Product extends \yii\db\ActiveRecord
180 180 public function getEnabledVariant()
181 181 {
182 182 return $this->hasOne(ProductVariant::className(), ['product_id' => 'product_id'])
183   - ->andOnCondition(['!=', ProductVariant::tableName() .'.stock', 0])
184 183 ->andOnCondition(['!=', ProductVariant::tableName() .'.status', 1]);
185 184 }
186 185  
... ... @@ -202,7 +201,7 @@ class Product extends \yii\db\ActiveRecord
202 201  
203 202 public function getEnabledVariants()
204 203 {
205   - return $this->hasMany(ProductVariant::className(), ['product_id' => 'product_id'])->andOnCondition(['!=', ProductVariant::tableName() .'.stock', 0])->joinWith('image');
  204 + return $this->hasMany(ProductVariant::className(), ['product_id' => 'product_id'])->andOnCondition(['!=', ProductVariant::tableName() .'.status', 1])->joinWith('image');
206 205 }
207 206  
208 207 /*
... ...
frontend/controllers/SearchController.php
... ... @@ -50,7 +50,7 @@ class SearchController extends \yii\web\Controller
50 50 foreach ($params['keywords'] as $keyword) {
51 51 $categoriesQuery->andWhere(['ilike', 'product.name', $keyword]);
52 52 }
53   - $categoriesQuery->andWhere(['!=', ProductVariant::tableName() .'.stock', 0]);
  53 + $categoriesQuery->andWhere(['!=', ProductVariant::tableName() .'.status', 1]);
54 54 $categories = $categoriesQuery->all();
55 55 }
56 56  
... ...
frontend/models/ProductFrontendSearch.php
... ... @@ -97,7 +97,6 @@ class ProductFrontendSearch extends Product {
97 97  
98 98 ProductHelper::_setQueryParams($query, $params);
99 99  
100   - $query->andWhere(['!=', ProductVariant::tableName() .'.stock', 0]);
101 100 $query->andWhere(['!=', ProductVariant::tableName() .'.status', 1]);
102 101  
103 102 return $query;
... ... @@ -113,7 +112,7 @@ class ProductFrontendSearch extends Product {
113 112 ->where([TaxGroup::tableName() .'.is_filter' => true]);
114 113  
115 114 $query->innerJoin('product_variant', 'product_variant.product_id = '. ProductOption::tableName() .'.product_id');
116   - $query->andWhere(['!=', 'product_variant.stock', 0]);
  115 + $query->andWhere(['!=', 'product_variant.status', 1]);
117 116 $query->groupBy(TaxOption::tableName() .'.tax_option_id');
118 117 // $query->having(['>', 'COUNT(product_variant.product_variant_id)', 0]);
119 118  
... ...
frontend/views/catalog/product.php
... ... @@ -109,11 +109,12 @@ FlipclockAsset::register($this);
109 109 </td>
110 110 <td>
111 111 <!-- Купить -->
112   - <?php if($product->variant->status != 1){?>
  112 + <?php if($product->variant->status != 1)
  113 + {?>
113 114 <a lang="5892" class="btn btnBuy buy_button btn-large1" data-id="<?php echo $product->variant->product_variant_id; ?>" data-toggle="modal" data-target="#buyForm">Купить</a>
114   - <?php }else if($product->variant->status == 1){?>
  115 + <?php } else {?>
115 116 <a href="#" style="background-color:dimgrey; background-image:linear-gradient(to bottom, #9d9fa0, #abafb2)" class="btn btn-large btn-default " data-id="<?php echo $product->variant->product_variant_id; ?>" >снят с производства</a>
116   - <?php} ?>
  117 + <?php } ?>
117 118  
118 119 </td>
119 120 <td>
... ... @@ -318,7 +319,7 @@ FlipclockAsset::register($this);
318 319 <div class="buy_button">
319 320 <?php if($product->variant->status != 1){?>
320 321 <a href="#" class="btn btn-large buy_button" data-toggle="modal" data-id="<?php echo $product->variant->product_variant_id; ?>" data-target="#buyForm" lang="5892">Купить</a>
321   - <?php}else if($product->variant->status == 1){?>
  322 + <?php }else { ?>
322 323 <a href="#" style="background-color:dimgrey; background-image:linear-gradient(to bottom, #9d9fa0, #abafb2)" class="btn btn-large btn-default " data-id="<?php echo $product->variant->product_variant_id; ?>" >снят с производства</a>
323 324 <?php } ?>
324 325 <div class="clearfix"></div>
... ...