Blame view

frontend/views/catalog/product.php 6.86 KB
055ecc3b   Karnovsky A   Karnovsky 11052016
1
  <?php
ccc7a9d3   Karnovsky A   Karnovsky 12052016
2
3
4
5
  use yii\widgets\Breadcrumbs;
  use yii\web\View;
  use yii\helpers\Url;
  
055ecc3b   Karnovsky A   Karnovsky 11052016
6
  $this->title = $product->name;
ccc7a9d3   Karnovsky A   Karnovsky 12052016
7
8
9
10
  //$this->title = (! empty($product->meta_title)) ? $product->meta_title : $product->name;
  //$this->registerMetaTag (['name' => 'description', 'content' => ((! empty($product->meta_description)) ? $product->meta_description : $product->name)]);
  //$this->registerMetaTag (['name' => 'keywords', 'content' => $product->meta_keywords]);
  
055ecc3b   Karnovsky A   Karnovsky 11052016
11
12
13
14
15
  foreach($product->category->getParents()->all() as $parent) {
      $this->params['breadcrumbs'][] = ['label' => $parent->categoryName->value, 'url' => ['catalog/category', 'category' => $parent]];
  }
  $this->params['breadcrumbs'][] = ['label' => $product->category->categoryName->value, 'url' => ['catalog/category', 'category' => $product->category]];
  $this->params['breadcrumbs'][] = $product->name .' #'. $product->variant->sku;
055ecc3b   Karnovsky A   Karnovsky 11052016
16
  
ccc7a9d3   Karnovsky A   Karnovsky 12052016
17
  $this->registerJs ('
055ecc3b   Karnovsky A   Karnovsky 11052016
18
  
ccc7a9d3   Karnovsky A   Karnovsky 12052016
19
20
21
22
          var checkData = function($index)
          {
              var $source = $(".productLeftBar .product_mod > li").eq($index).find("a");
              var $target = $(".productLeftBar .cost_box");
055ecc3b   Karnovsky A   Karnovsky 11052016
23
  
ccc7a9d3   Karnovsky A   Karnovsky 12052016
24
25
              $("#cost").text($source.data("cost"));
              $("#old_cost").text($source.data("old_cost"));
055ecc3b   Karnovsky A   Karnovsky 11052016
26
  
ccc7a9d3   Karnovsky A   Karnovsky 12052016
27
28
29
30
31
32
33
34
              if (parseInt ($source.data("old_cost")) == 0)
              {
                  $target.find("strike").hide();
              }
              else
              {
                  $target.find("strike").show();
              }
055ecc3b   Karnovsky A   Karnovsky 11052016
35
  
ccc7a9d3   Karnovsky A   Karnovsky 12052016
36
37
38
39
40
41
              $("#product_id").val($source.data("id"));
              $("#art").text($source.data("art"));
              $("#color").text($source.data("color"));
              $("#pic").attr("src",$source.data("image"));
              $("#picoriginal").attr("href",$source.data("imageoriginal"));
          }
055ecc3b   Karnovsky A   Karnovsky 11052016
42
  
ccc7a9d3   Karnovsky A   Karnovsky 12052016
43
44
45
          $(".product_mod > li").click(function()
          {
              checkData($(this).index());
055ecc3b   Karnovsky A   Karnovsky 11052016
46
  
ccc7a9d3   Karnovsky A   Karnovsky 12052016
47
              Shadowbox.setup($("#picoriginal"));
055ecc3b   Karnovsky A   Karnovsky 11052016
48
  
ccc7a9d3   Karnovsky A   Karnovsky 12052016
49
50
              return false;
          });
055ecc3b   Karnovsky A   Karnovsky 11052016
51
  
ccc7a9d3   Karnovsky A   Karnovsky 12052016
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
          checkData(0);
  
      ', View::POS_READY, 'fasovka');
  
  $this->registerJs ("
          $('#nav_product li a').addClass('active');
          $('#nav_product li').find('.info').toggle();
  
          $('#nav_product li a').bind('click',function()
          {
              if($(this).parent().find('.info').css('display')=='none')$(this).addClass('active');
              else $(this).removeClass('active');
              $(this).parent().find('.info').toggle();
  
              return false;
          });
      ", View::POS_READY, 'nav_product');
  
  $this->registerCssFile (Yii::$app->request->BaseUrl . '/js/shadowbox-3.0.3/shadowbox.css');
  $this->registerJsFile (Yii::$app->request->baseUrl . '/js/shadowbox-3.0.3/shadowbox.js', ['position' => View::POS_HEAD, 'depends' => ['yii\web\JqueryAsset']]);
  $this->registerJs ("
          Shadowbox.init({
  
      });
      ", View::POS_READY, 'Shadowbox');
  ?>
  
  
  <nav class="bread-crumbs">
      <?= Breadcrumbs::widget ([
          'links' => [
              ['label' => 'Каталог', 'url' => ['catalog/all']],
              // ['label'=>$catalog->parent->name,'url'=>['catalog/index','translit'=>$catalog->parent->translit]],
              ['label' => $category->name, 'url' => ['catalog/category', 'category' => $category]],
              $product->name,
          ],
      ]) ?>
      <div class="both"></div>
  </nav>
  <?php if ($flash = Yii::$app->session->getFlash ('success')): ?>
      <div class="alert-success"><?= $flash ?></div>
  <?php endif; ?>
  <div class="loyout">
ccc7a9d3   Karnovsky A   Karnovsky 12052016
95
96
97
98
99
100
101
102
103
104
      <div class="productLeftBar">
          <h1><?= $product->name ?></h1>
          <div class="begin">Цветовые решения</div>
          <ul class="product_mod">
              <?php foreach ($product->variants as $variant): ?>
                  <li>
                      <a id='m<?= $variant->product_variant_id ?>' href="#"
                         data-cost="<?= $variant->price ?>"
                         data-old_cost="<?= $variant->price_old ?>" data-id="<?= $variant->product_variant_id ?>" data-art="<?= $variant->sku ?>"
                         data-color="<?= $variant->name ?>"
dc2cd017   Karnovsky A   -
105
106
                         data-image="<?= $variant->imageUrl ?>"
                         data-imageoriginal="<?= $variant->imageUrl ?>"
ccc7a9d3   Karnovsky A   Karnovsky 12052016
107
                         title="<?= $product->name ?>">
dc2cd017   Karnovsky A   -
108
109
                          <?= \common\components\artboximage\ArtboxImageHelper::getImage($variant->imageUrl, 'product_variant')?>
  
ccc7a9d3   Karnovsky A   Karnovsky 12052016
110
111
112
                      </a>
                  </li>
              <?php endforeach; ?>
055ecc3b   Karnovsky A   Karnovsky 11052016
113
          </ul>
ccc7a9d3   Karnovsky A   Karnovsky 12052016
114
          <div class="both"></div>
055ecc3b   Karnovsky A   Karnovsky 11052016
115
  
ccc7a9d3   Karnovsky A   Karnovsky 12052016
116
117
118
119
120
121
122
123
124
          <div class="cost_box">
              <div class='params'>код: <span id='art'></span><br/> цвет: <span id='color'></span></div>
              <div class="w">
                  <strike><span id='old_cost'>0</span> грн.</strike><br/>
                  <span class="cost"><span id='cost'>0</span> <span class="valute">грн.</span></span>
              </div>
              <input type='hidden' id='product_id'/>
              <a href="#" rel='product' class="link_buy fl">В Корзину</a>
              <div class="both"></div>
055ecc3b   Karnovsky A   Karnovsky 11052016
125
126
          </div>
  
ccc7a9d3   Karnovsky A   Karnovsky 12052016
127
128
129
130
131
132
133
134
135
          <div class="product_service">
              <ul>
                  <li class="item1"><a href="<?= Url::to (['iam/share', 'id' => $product->product_id]) ?>">Добавить в закладки</a>
                  </li>
                  <li class="item2"><a href="<?= Url::to (['iam/price', 'id' => $product->product_id]) ?>">Узнать о снижение
                          цены</a></li>
                  <li class="item3"><a href="<?= Url::to (['products/compare', 'id' => $product->product_id]) ?>">Добавить в
                          сравнение</a></li>
              </ul>
055ecc3b   Karnovsky A   Karnovsky 11052016
136
          </div>
ccc7a9d3   Karnovsky A   Karnovsky 12052016
137
      </div>
055ecc3b   Karnovsky A   Karnovsky 11052016
138
  
ccc7a9d3   Karnovsky A   Karnovsky 12052016
139
140
141
142
143
144
145
146
      <div class="productRightBar">
          <ul id="nav_product">
              <li><a href="#">Характеристики</a>
                  <div class="info">
                      <p>Бренд: <?= $product->brand->name ?></p>
                      <?php foreach ($properties as $group): ?>
                          <p><?= $group->name ?> <?php foreach($group->_options as $option) :?>&nbsp;<?= $option->ValueRenderHTML?><?php endforeach?></p>
                      <?php endforeach; ?>
055ecc3b   Karnovsky A   Karnovsky 11052016
147
                  </div>
ccc7a9d3   Karnovsky A   Karnovsky 12052016
148
149
150
151
              </li>
              <li><a href="#">Описание</a>
                  <div class="info">
                      <?= $product->description ?>
055ecc3b   Karnovsky A   Karnovsky 11052016
152
                  </div>
ccc7a9d3   Karnovsky A   Karnovsky 12052016
153
              </li>
055ecc3b   Karnovsky A   Karnovsky 11052016
154
  
ccc7a9d3   Karnovsky A   Karnovsky 12052016
155
156
          </ul>
      </div>
055ecc3b   Karnovsky A   Karnovsky 11052016
157
  
ccc7a9d3   Karnovsky A   Karnovsky 12052016
158
      <div class="content">
ccc7a9d3   Karnovsky A   Karnovsky 12052016
159
160
          <div class="pic">
              <center>
dc2cd017   Karnovsky A   -
161
                  <a href="#" rel="shadowbox[gal]" id="picoriginal"><?= \common\components\artboximage\ArtboxImageHelper::getImage($product->imageUrl, 'product')?></a>
ccc7a9d3   Karnovsky A   Karnovsky 12052016
162
              </center>
055ecc3b   Karnovsky A   Karnovsky 11052016
163
          </div>
ccc7a9d3   Karnovsky A   Karnovsky 12052016
164
165
          <ul class="product_colors">
              <?php foreach ($product->images as $image): ?>
2f93d129   Karnovsky A   -
166
                  <li><a href="<?= $image->imageUrl ?>" rel="shadowbox[gal]">
dc2cd017   Karnovsky A   -
167
                          <?= \common\components\artboximage\ArtboxImageHelper::getImage($image->imageUrl, 'product_trumb2')?>
ccc7a9d3   Karnovsky A   Karnovsky 12052016
168
169
170
                      </a></li>
              <?php endforeach; ?>
          </ul>
ccc7a9d3   Karnovsky A   Karnovsky 12052016
171
172
173
      </div>
      <div class="both"></div>
  </div>