Commit d16d91c3b5876a326fe8b628f3dcc6545bf7c5b3

Authored by Administrator
1 parent 9a1e54af

big commti

backend/controllers/ArticlesController.php
... ... @@ -79,9 +79,7 @@ class ArticlesController extends Controller
79 79 {
80 80 $model = new Articles();
81 81  
82   - if ($model->load(Yii::$app->request->post())) {
83   -
84   - $model->save();
  82 + if ($model->load(Yii::$app->request->post()) && $model->save()) {
85 83  
86 84 return $this->redirect(['view', 'id' => $model->id]);
87 85 } else {
... ... @@ -101,9 +99,7 @@ class ArticlesController extends Controller
101 99 {
102 100 $model = $this->findModel($id);
103 101  
104   - if ($model->load(Yii::$app->request->post())) {
105   - $model->save();
106   -
  102 + if ($model->load(Yii::$app->request->post()) && $model->save() ) {
107 103 return $this->redirect(['view', 'id' => $model->id]);
108 104 } else {
109 105 return $this->render('update', [
... ...
common/modules/product/models/Stock.php
... ... @@ -14,6 +14,7 @@ use Yii;
14 14 */
15 15 class Stock extends \yii\db\ActiveRecord
16 16 {
  17 +
17 18 /**
18 19 * @inheritdoc
19 20 */
... ... @@ -33,6 +34,30 @@ class Stock extends \yii\db\ActiveRecord
33 34 ];
34 35 }
35 36  
  37 +
  38 + public function getSiteName(){
  39 + switch(mb_strtolower($this->name)){
  40 + case "харьков свет":
  41 + return 'МАГАЗИН ХАРЬКОВ';
  42 + break;
  43 + case "осокорки":
  44 + return 'МАГАЗИН "ОСОКОРКИ"';
  45 + break;
  46 + case "олимп":
  47 + return 'ТЦ "ОЛИМПИЙСКИЙ"';
  48 + break;
  49 + case "магазин":
  50 + return "МАГАЗИН ГЛУБОЧЕЦКАЯ";
  51 + break;
  52 + default:
  53 + return "На складе";
  54 + break;
  55 + }
  56 + }
  57 +
  58 +
  59 +
  60 +
36 61 /**
37 62 * @inheritdoc
38 63 */
... ...
frontend/views/catalog/product.php
... ... @@ -308,13 +308,14 @@ FlipclockAsset::register($this);
308 308 <?php if($product->variant->stock > 0){?>
309 309 <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>
310 310 <?php } else {?>
311   - <a href="#" style="background-color:dimgrey" class="btn btn-large btn-default " data-id="<?php echo $product->variant->product_variant_id; ?>" >Нет в наличии</a>
  311 + <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>
312 312 <?php }?>
313 313  
314 314  
315 315  
316 316 <div class="clearfix"></div>
317 317 </div>
  318 +
318 319 <div>
319 320 <div class="payment_visa">
320 321 Оплатить
... ... @@ -324,14 +325,8 @@ FlipclockAsset::register($this);
324 325 </div>
325 326 <div class="clearfix"></div>
326 327 </div>
327   -
328 328 <div class="follow_price">
329   - <?php
330   - /* Where buy
331   - ?>
332   - <a href="#" data-toggle="modal" data-target="#where_buy">где купить?</a>
333   - */
334   - ?>
  329 + <a href="#" data-toggle="modal" data-target="#where_buy">где купить?</a>
335 330 </div>
336 331  
337 332 <div class="follow_price">
... ... @@ -626,4 +621,31 @@ FlipclockAsset::register($this);
626 621 </div>
627 622 </div>
628 623 <div class="clearfix"></div>
629   -<br/>
630 624 \ No newline at end of file
  625 +<div class="modal fade" id="where_buy" tabindex="-1" role="dialog" aria-labelledby="myModalLabel44">
  626 + <div class="modal-dialog text-dialog" role="document">
  627 + <div class="modal-content">
  628 +
  629 + <div class="modal-header">
  630 + <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  631 + <span aria-hidden="true">&times;</span></button>
  632 + <span class="modal-title" id="myModalLabel4">Где купить?</span>
  633 + </div>
  634 +
  635 + <div class="modal-body" style="text-transform:uppercase">
  636 + <p>Данный товар есть в наличии в наших розничных магазинах</p>
  637 + <br/>
  638 + <div class="shopsList">
  639 + <ul>
  640 + <?php foreach($product->variant->stocks as $stock){?>
  641 + <li><?= Html::a($stock->siteName, Url::to (['text/index', 'translit' => 'magaziny', '#'=>$stock->stock_id])) ?></li>
  642 + <?php } ?>
  643 + </ul>
  644 +
  645 + </div>
  646 +
  647 + <div class="clearfix"></div>
  648 + </div>
  649 +
  650 + </div>
  651 + </div>
  652 +</div>
631 653 \ No newline at end of file
... ...
frontend/views/layouts/main.php
... ... @@ -480,28 +480,7 @@ use common\models\Event;
480 480  
481 481  
482 482  
483   - <div class="modal fade" id="where_buy" tabindex="-1" role="dialog" aria-labelledby="myModalLabel44">
484   - <div class="modal-dialog text-dialog" role="document">
485   - <div class="modal-content">
486   -
487   - <div class="modal-header">
488   - <button type="button" class="close" data-dismiss="modal" aria-label="Close">
489   - <span aria-hidden="true">&times;</span></button>
490   - <span class="modal-title" id="myModalLabel4">Где купить?</span>
491   - </div>
492   -
493   - <div class="modal-body" style="text-transform:uppercase">
494   - <p>Данный товар есть в наличии в наших розничных магазинах</p>
495   - <br/>
496   - <div class="shopsList">
497   - </div>
498   -
499   - <div class="clearfix"></div>
500   - </div>
501   -
502   - </div>
503   - </div>
504   - </div>
  483 +
505 484  
506 485 <div class="modal fade" id="returnСonditions" tabindex="-1" role="dialog" aria-labelledby="myModalLabel4">
507 486 <div class="modal-dialog text-dialog" role="document">
... ...
frontend/web/css/css_header.css
... ... @@ -14565,3 +14565,19 @@ ul.product-special li.promo div{
14565 14565 max-width: 1140px;
14566 14566 overflow: hidden;
14567 14567 }
  14568 +.shopsList ul{
  14569 + list-style: none;
  14570 +}
  14571 +
  14572 +#link-B:before {
  14573 + display: block;
  14574 + content: "";
  14575 + height: 55px;
  14576 + margin: -55px 0 0;
  14577 +}
  14578 +.anchor:before {
  14579 + display: block;
  14580 + content: "";
  14581 + height: 55px;
  14582 + margin: -55px 0 0;
  14583 +}
... ...
frontend/widgets/Seo.php
... ... @@ -103,35 +103,18 @@ class Seo extends Widget
103 103  
104 104 $filter = \Yii::$app->request->get('filters', []);
105 105  
  106 + $default = $this->selectSeoData(self::H1);
106 107  
  108 + if ($default != $this->{self::H1}) {
  109 + return $default;
107 110  
108   - if (isset($filter['brands']) && count($filter['brands']) == 1) {
109   -
110   - $model = Brand::find()->where(['alias' => $filter['brands'][0]])->one();
111   - if(!$model instanceof Brand){
112   -
113   - \Yii::$app->response->redirect(['/site/error'],404);
114   - } else {
115   - if($this->selectSeoData(self::H1) == $this->category_name) {
116   -
117   - return $this->selectSeoData(self::H1) . ' ' . $model->name;
118   - }else {
119   -
120   - return $this->selectSeoData(self::H1);
121   -
122   - }
123   - }
124   -
125   -
126   -
127   - } else if ($this->checkFilter($filter)) {
128 111  
  112 + } else if($this->checkFilter($filter)){
129 113 $array = $this->arrayBuilder($filter);
130 114 return $this->getNameString($array);
131   -
132   -
133   - } else {
134   - return $this->selectSeoData(self::H1);
  115 + }
  116 + else {
  117 + return $default;
135 118 }
136 119 break;
137 120 case self::TITLE:
... ... @@ -343,7 +326,7 @@ class Seo extends Widget
343 326  
344 327  
345 328 }
346   - $row = substr($row, 0,-1 );
  329 + $row = substr($row, 0,-2 );
347 330 $row .= " - купить в Киеве, Украине - интернет магазин Лінія Світла";
348 331 return $row;
349 332 // $template = SeoDynamic::find()->select('title')->where(['param' =>'filters'])->one();
... ... @@ -374,7 +357,7 @@ class Seo extends Widget
374 357  
375 358  
376 359 }
377   - $row = substr($row, 0,-1 );
  360 + $row = substr($row, 0,-2 );
378 361 $row .= ". Лінія Світла";
379 362 return $row;
380 363  
... ... @@ -395,7 +378,7 @@ class Seo extends Widget
395 378  
396 379  
397 380 }
398   - $row = substr($row, 0,-1 );
  381 + $row = substr($row, 0,-2 );
399 382 return $row;
400 383  
401 384 }
... ... @@ -451,7 +434,7 @@ class Seo extends Widget
451 434 protected function checkFilter($filter){
452 435 foreach(self::$optionsList as $optionList){
453 436  
454   - if(isset($filter[$optionList]) && count($filter[$optionList]) > 1){
  437 + if(isset($filter[$optionList]) && count($filter[$optionList]) == 1){
455 438 return true;
456 439 }
457 440  
... ...