Blame view

frontend/views/catalog/product.php 11.3 KB
055ecc3b   Karnovsky A   Karnovsky 11052016
1
  <?php
ccc7a9d3   Karnovsky A   Karnovsky 12052016
2
3
4
  use yii\widgets\Breadcrumbs;
  use yii\web\View;
  use yii\helpers\Url;
1f3add0a   Dmytry Fedorchuk   All seo
5
  use frontend\widgets\Seo;
f8ed6ca0   Dmytry Fedorchuk   title product seo
6
  
1f3add0a   Dmytry Fedorchuk   All seo
7
8
9
10
11
12
  $this->params['seo']['key'] = $product->category->categoryName->value;
  $this->params['seo']['fields']['name'] = $product->fullname;
  $this->params['seo']['h1'] = !empty(Seo::widget([ 'row'=>'h1'])) ? Seo::widget([ 'row'=>'h1']) : $product->fullname;
  
  //$this->params['seo']['title'] =  "Купить " . substr($product->category->categoryName->value, 0, -2) . " " . $product->fullname . " в Киеве, Харькове, Украине: цены, отзывы - Rukzachok.com.ua";
  //$this->params['seo']['description'] = "Заказать " . substr($product->category->categoryName->value, 0, -2) . " " . $product->fullname . " - самые модные и стильные рюкзаки в Украине по лучшим ценам. Интернет магазин рюкзаков Rukzachok.com.ua";
060b4806   Karnovsky A   -
13
14
15
  $this->title = $product->fullname;
  //$this->title = (! empty($product->meta_title)) ? $product->meta_title : $product->fullname;
  //$this->registerMetaTag (['name' => 'description', 'content' => ((! empty($product->meta_description)) ? $product->meta_description : $product->fullname)]);
ccc7a9d3   Karnovsky A   Karnovsky 12052016
16
17
  //$this->registerMetaTag (['name' => 'keywords', 'content' => $product->meta_keywords]);
  
8724ec1f   Karnovsky A   -
18
19
20
21
  //foreach($product->category->getParents()->all() as $parent) {
  //    $this->params['breadcrumbs'][] = ['label' => $parent->categoryName->value, 'url' => ['catalog/category', 'category' => $parent]];
  //}
  $this->params['breadcrumbs'][] = ['label' => 'Каталог', 'url' => ['catalog/category']];
055ecc3b   Karnovsky A   Karnovsky 11052016
22
  $this->params['breadcrumbs'][] = ['label' => $product->category->categoryName->value, 'url' => ['catalog/category', 'category' => $product->category]];
c7852657   Karnovsky A   -
23
  $this->params['breadcrumbs'][] = $product->fullname .' #'. $product->enabledVariants[0]->sku;
055ecc3b   Karnovsky A   Karnovsky 11052016
24
  
ccc7a9d3   Karnovsky A   Karnovsky 12052016
25
  $this->registerJs ('
055ecc3b   Karnovsky A   Karnovsky 11052016
26
  
ccc7a9d3   Karnovsky A   Karnovsky 12052016
27
28
          var checkData = function($index)
          {
f307b0a8   Karnovsky A   -
29
30
31
32
              var sourceNew = $(".productLeftBar .product_mod > li").eq($index);
              $(".productLeftBar .product_mod > li").removeClass("active")
              sourceNew.addClass("active");
              var $source = sourceNew.find("a");
ccc7a9d3   Karnovsky A   Karnovsky 12052016
33
              var $target = $(".productLeftBar .cost_box");
055ecc3b   Karnovsky A   Karnovsky 11052016
34
  
ccc7a9d3   Karnovsky A   Karnovsky 12052016
35
36
              $("#cost").text($source.data("cost"));
              $("#old_cost").text($source.data("old_cost"));
055ecc3b   Karnovsky A   Karnovsky 11052016
37
  
ccc7a9d3   Karnovsky A   Karnovsky 12052016
38
39
40
41
42
43
44
45
              if (parseInt ($source.data("old_cost")) == 0)
              {
                  $target.find("strike").hide();
              }
              else
              {
                  $target.find("strike").show();
              }
055ecc3b   Karnovsky A   Karnovsky 11052016
46
  
ccc7a9d3   Karnovsky A   Karnovsky 12052016
47
48
49
50
51
52
              $("#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
53
  
ccc7a9d3   Karnovsky A   Karnovsky 12052016
54
55
56
          $(".product_mod > li").click(function()
          {
              checkData($(this).index());
055ecc3b   Karnovsky A   Karnovsky 11052016
57
  
ccc7a9d3   Karnovsky A   Karnovsky 12052016
58
              Shadowbox.setup($("#picoriginal"));
055ecc3b   Karnovsky A   Karnovsky 11052016
59
  
ccc7a9d3   Karnovsky A   Karnovsky 12052016
60
61
              return false;
          });
055ecc3b   Karnovsky A   Karnovsky 11052016
62
  
ccc7a9d3   Karnovsky A   Karnovsky 12052016
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
          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');
3a8a9bd9   Administrator   image size
82
  $this->registerJsFile (Yii::$app->request->baseUrl . '/js/shadowbox-3.0.3/shadowbox.js', ['position' => View::POS_END, 'depends' => ['yii\web\JqueryAsset']]);
ccc7a9d3   Karnovsky A   Karnovsky 12052016
83
84
85
86
87
88
89
90
91
92
  $this->registerJs ("
          Shadowbox.init({
  
      });
      ", View::POS_READY, 'Shadowbox');
  ?>
  
  
  <nav class="bread-crumbs">
      <?= Breadcrumbs::widget ([
8724ec1f   Karnovsky A   -
93
94
95
          'links' => $this->params['breadcrumbs'],
      ])
      ?>
ccc7a9d3   Karnovsky A   Karnovsky 12052016
96
97
98
99
100
101
      <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
102
      <div class="productLeftBar">
1f3add0a   Dmytry Fedorchuk   All seo
103
          <h1><?= Seo::widget([ 'row'=>'h1'])?></h1>
c7852657   Karnovsky A   -
104
105
          <?php foreach($product->enabledVariantsGrouped as $variantGroup) :?>
          <div class="begin"><?= $variantGroup->name2?></div>
ccc7a9d3   Karnovsky A   Karnovsky 12052016
106
          <ul class="product_mod">
c7852657   Karnovsky A   -
107
              <?php foreach ($variantGroup->_variants as $variant): ?>
ccc7a9d3   Karnovsky A   Karnovsky 12052016
108
                  <li>
83be3cfb   Karnovsky A   -
109
                      <a id='m<?= $variant->product_variant_id ?>' href="#<?=$variant->product_variant_id ?>"
ccc7a9d3   Karnovsky A   Karnovsky 12052016
110
111
112
                         data-cost="<?= $variant->price ?>"
                         data-old_cost="<?= $variant->price_old ?>" data-id="<?= $variant->product_variant_id ?>" data-art="<?= $variant->sku ?>"
                         data-color="<?= $variant->name ?>"
f307b0a8   Karnovsky A   -
113
                         data-image="<?= \common\components\artboximage\ArtboxImageHelper::getImageSrc($variant->imageUrl, 'product_view') ?>"
dc2cd017   Karnovsky A   -
114
                         data-imageoriginal="<?= $variant->imageUrl ?>"
060b4806   Karnovsky A   -
115
                         title="<?= $product->fullname ?>">
d0108705   Dmytry Fedorchuk   All seo
116
117
118
                          <?= \common\components\artboximage\ArtboxImageHelper::getImage($variant->imageUrl, 'product_variant', ['alt' => $product->category->categoryName->value . ' ' .
                              $product->fullname, 'title' => $product->category->categoryName->value . ' ' .
                              $product->fullname])?>
ccc7a9d3   Karnovsky A   Karnovsky 12052016
119
120
121
                      </a>
                  </li>
              <?php endforeach; ?>
055ecc3b   Karnovsky A   Karnovsky 11052016
122
          </ul>
ccc7a9d3   Karnovsky A   Karnovsky 12052016
123
          <div class="both"></div>
c7852657   Karnovsky A   -
124
          <?php endforeach; ?>
055ecc3b   Karnovsky A   Karnovsky 11052016
125
  
73bc07bd   Виталий   Веталь
126
          <div class="cost_box product_read_">
ccc7a9d3   Karnovsky A   Karnovsky 12052016
127
              <div class='params'>код: <span id='art'></span><br/> цвет: <span id='color'></span></div>
f307b0a8   Karnovsky A   -
128
129
130
131
132
133
              <div class="product_read_price">
                  <div class="w">
                      <strike><span id='old_cost'>0</span> грн.</strike>
                      <span class="cost"><span id='cost'>0</span> <span class="valute">грн.</span></span>
                  </div>
                  <input type='hidden' id='product_id'/>
d0108705   Dmytry Fedorchuk   All seo
134
                  <a href="#" rel='product' class="link_buy fl">Купить</a>
f307b0a8   Karnovsky A   -
135
                  <div class="both"></div>
ccc7a9d3   Karnovsky A   Karnovsky 12052016
136
              </div>
1c8ebc91   Karnovsky A   Share functional
137
138
139
140
141
142
143
144
145
146
147
148
149
150
  
              <div class="product_service">
                  <ul>
                  <?php if (Yii::$app->user->id) :?>
                      <li class="item1"><a href="<?= Url::to (['iam/share', 'id' => $product->product_id]) ?>">Добавить в закладки</a></li>
                  <?php endif?>
                  <?php if (FALSE && Yii::$app->user->id) :?>
                      <li class="item2"><a href="<?= Url::to (['iam/price', 'id' => $product->product_id]) ?>">Узнать о снижение цены</a></li>
                  <?php endif?>
                  <?php if (FALSE) :?>
                      <li class="item3"><a href="<?= Url::to (['products/compare', 'id' => $product->product_id]) ?>">Добавить в сравнение</a></li>
                  <?php endif?>
                  </ul>
              </div>
d0108705   Dmytry Fedorchuk   All seo
151
152
              <br>
              <div class="ya-share2" data-services="vkontakte,facebook,odnoklassniki,gplus,twitter" data-size="s"></div>
055ecc3b   Karnovsky A   Karnovsky 11052016
153
          </div>
7d9935e2   Administrator   проапдейтил роли
154
          <?php /*
ccc7a9d3   Karnovsky A   Karnovsky 12052016
155
156
157
158
159
160
161
162
163
          <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>
7d9935e2   Administrator   проапдейтил роли
164
          </div>*/?>
ccc7a9d3   Karnovsky A   Karnovsky 12052016
165
      </div>
055ecc3b   Karnovsky A   Karnovsky 11052016
166
  
ccc7a9d3   Karnovsky A   Karnovsky 12052016
167
168
169
170
171
      <div class="productRightBar">
          <ul id="nav_product">
              <li><a href="#">Характеристики</a>
                  <div class="info">
                      <p>Бренд: <?= $product->brand->name ?></p>
c7852657   Karnovsky A   -
172
                      <?php foreach ($product->properties as $group): ?>
ccc7a9d3   Karnovsky A   Karnovsky 12052016
173
174
                          <p><?= $group->name ?> <?php foreach($group->_options as $option) :?>&nbsp;<?= $option->ValueRenderHTML?><?php endforeach?></p>
                      <?php endforeach; ?>
055ecc3b   Karnovsky A   Karnovsky 11052016
175
                  </div>
ccc7a9d3   Karnovsky A   Karnovsky 12052016
176
177
178
179
              </li>
              <li><a href="#">Описание</a>
                  <div class="info">
                      <?= $product->description ?>
055ecc3b   Karnovsky A   Karnovsky 11052016
180
                  </div>
ccc7a9d3   Karnovsky A   Karnovsky 12052016
181
              </li>
2e9ea16e   Karnovsky A   -
182
              <?php if(!empty($product->video) && strpos($product->video, '.jpg') === FALSE && strpos($product->video, '.png') === FALSE) :?>
f307b0a8   Karnovsky A   -
183
184
                  <li><a href="#">Видео</a>
                      <div class="info product-thumb-video">
2e9ea16e   Karnovsky A   -
185
186
187
188
189
                          <?php if (strpos($product->video, '<iframe') !== FALSE || strpos($product->video, '<object') !== FALSE) :?>
                              <?= $product->video?>
                          <?php else :?>
                              <?= \cics\widgets\VideoEmbed::widget(['responsive' => false, 'url' => $product->video]) ?>
                          <?php endif?>
f307b0a8   Karnovsky A   -
190
191
192
                      </div>
                  </li>
              <?php endif?>
ccc7a9d3   Karnovsky A   Karnovsky 12052016
193
194
          </ul>
      </div>
055ecc3b   Karnovsky A   Karnovsky 11052016
195
  
ccc7a9d3   Karnovsky A   Karnovsky 12052016
196
      <div class="content">
ccc7a9d3   Karnovsky A   Karnovsky 12052016
197
198
          <div class="pic">
              <center>
d0108705   Dmytry Fedorchuk   All seo
199
200
201
                  <a href="#" rel="shadowbox[gal]" id="picoriginal"><?= \common\components\artboximage\ArtboxImageHelper::getImage($product->enabledVariants[0]->imageUrl, 'product_view',['id'=>'pic', 'alt' => $product->category->categoryName->value . ' ' .
                          $product->fullname, 'title' => $product->category->categoryName->value . ' ' .
                          $product->fullname])?></a>
ccc7a9d3   Karnovsky A   Karnovsky 12052016
202
              </center>
055ecc3b   Karnovsky A   Karnovsky 11052016
203
          </div>
ccc7a9d3   Karnovsky A   Karnovsky 12052016
204
205
          <ul class="product_colors">
              <?php foreach ($product->images as $image): ?>
2f93d129   Karnovsky A   -
206
                  <li><a href="<?= $image->imageUrl ?>" rel="shadowbox[gal]">
d0108705   Dmytry Fedorchuk   All seo
207
208
209
                          <?= \common\components\artboximage\ArtboxImageHelper::getImage($image->imageUrl, 'product_trumb2',['alt' => $product->category->categoryName->value . ' ' .
                              $product->fullname, 'title' => $product->category->categoryName->value . ' ' .
                              $product->fullname])?>
ccc7a9d3   Karnovsky A   Karnovsky 12052016
210
211
212
                      </a></li>
              <?php endforeach; ?>
          </ul>
ccc7a9d3   Karnovsky A   Karnovsky 12052016
213
214
      </div>
      <div class="both"></div>
4902c747   Karnovsky A   -
215
  
e9f291a5   Karnovsky A   Similar products ...
216
      <?= \common\modules\product\widgets\similarProducts::widget(['product' => $product])?>
4902c747   Karnovsky A   -
217
218
219
220
      <?= \common\modules\product\widgets\specialProducts::widget(['type' => 'promo'])?>
      <?= \common\modules\product\widgets\specialProducts::widget(['type' => 'new'])?>
      <?= \common\modules\product\widgets\specialProducts::widget(['type' => 'top'])?>
      <?= \common\modules\product\widgets\lastProducts::widget()?>
463e6d52   Виталий   Веталь
221
  </div>
85235ea6   Виталий   Веталь
222
  <?php
2fcc30a0   Виталий   Веталь
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
  $this->registerJs ("
        var productHash = window.location.hash;
              productHash = productHash.replace('#','')
  
              var productUl = $('ul.product_mod li')
              var productA = productUl.find('a#'+productHash)
              productUl.removeClass('active')
              productA.parent().addClass('active')
              var dataLink = productA.attr('data-imageoriginal')
              var dataImg = productA.attr('data-image')
  
              $('#pic').attr('src',dataImg)
              $('#pic').parent().attr('href',dataLink)
      ", View::POS_READY, 'new_script');
  ?>