Commit 14009e7fa60997d78497ea7b4e1ef222ab1c6e71

Authored by Yarik
1 parent d4859b79

Structure data fix

common/modules/comment/views/artbox_comment_item.php
... ... @@ -18,12 +18,12 @@
18 18 echo Html::img('/img/user-noimage.png');
19 19 ?>
20 20 </div>
21   - <div class="user_data" itemprop="commentTime">
  21 + <div class="user_data" itemprop="datePublished">
22 22 <?php
23 23 echo date('d.m.Y', $model->date_add);
24 24 ?>
25 25 </div>
26   - <div class="user_name" itemprop="creator">
  26 + <div class="user_name" itemprop="author">
27 27 <?php
28 28 if(!empty( $model->user )) {
29 29 echo $model->user->username;
... ... @@ -35,13 +35,16 @@
35 35 <?php
36 36 if(!empty( $model->rating )) {
37 37 ?>
38   - <div class="user_rating">
  38 + <div class="user_rating" itemporp="reviewRating" itemscope itemtype="http://schema.org/Rating">
  39 + <span itemprop="worstRating" style="display: none">1</span>
  40 + <span itemprop="ratingValue" style="display: none"><?php echo $model->rating->value; ?></span>
  41 + <span itemprop="bestRating" style="display: none">5</span>
39 42 <div class="rateit" data-rateit-value="<?php echo $model->rating->value; ?>" data-rateit-ispreset="true" data-rateit-readonly="true"></div>
40 43 </div>
41 44 <?php
42 45 }
43 46 ?>
44   - <div class="user_txt" itemprop="commentText">
  47 + <div class="user_txt" itemprop="description">
45 48 <?php
46 49 echo $model->text;
47 50 ?>
... ...
common/modules/comment/widgets/CommentWidget.php
... ... @@ -111,9 +111,9 @@
111 111 */
112 112 public $itemOptions = [
113 113 'class' => 'artbox_item_container',
114   - 'itemprop' => 'comment',
  114 + 'itemprop' => 'review',
115 115 'itemscope' => 'itemscope',
116   - 'itemtype' => 'http://schema.org/UserComments',
  116 + 'itemtype' => 'http://schema.org/Review',
117 117 ];
118 118  
119 119 /**
... ...
frontend/views/catalog/product.php
... ... @@ -178,7 +178,11 @@
178 178 <?php
179 179 if(!empty( $product->averageRating ) && $product->averageRating->value) {
180 180 ?>
181   - <div class="rateit" data-rateit-value="<?php echo $product->averageRating->value; ?>" data-rateit-readonly="true" data-rateit-ispreset="true"></div>
  181 + <div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
  182 + <span itemprop="ratingValue" style="display: none"><?php echo $product->averageRating->value; ?></span>
  183 + <span itemprop="ratingCount" style="display: none"><?php echo count($product->comments); ?></span>
  184 + <div class="rateit" data-rateit-value="<?php echo $product->averageRating->value; ?>" data-rateit-readonly="true" data-rateit-ispreset="true"></div>
  185 + </div>
182 186 <?php
183 187 }
184 188 ?>
... ... @@ -256,38 +260,38 @@
256 260 <?php endif ?>
257 261 </ul>
258 262 </div>
259   - </div>
260   - <div class="content">
261   - <div class="pic">
262   - <center>
263   - <a href="#" rel="shadowbox[gal]" id="picoriginal"><?= \common\components\artboximage\ArtboxImageHelper::getImage($product->enabledVariants[ 0 ]->imageUrl, 'product_view', [
264   - 'id' => 'pic',
265   - 'alt' => $category->categoryName->value . ' ' . $product->fullname,
266   - 'title' => $category->categoryName->value . ' ' . $product->fullname,
267   - ]) ?></a>
268   - </center>
269   - </div>
270   - <ul class="product_colors">
271   - <?php foreach($product->images as $image): ?>
272   - <li><a href="<?= $image->imageUrl ?>" rel="shadowbox[gal]">
273   - <?= \common\components\artboximage\ArtboxImageHelper::getImage($image->imageUrl, 'product_trumb2', [
  263 + <div class="content">
  264 + <div class="pic">
  265 + <center>
  266 + <a href="#" rel="shadowbox[gal]" id="picoriginal"><?= \common\components\artboximage\ArtboxImageHelper::getImage($product->enabledVariants[ 0 ]->imageUrl, 'product_view', [
  267 + 'id' => 'pic',
274 268 'alt' => $category->categoryName->value . ' ' . $product->fullname,
275 269 'title' => $category->categoryName->value . ' ' . $product->fullname,
276   - ]) ?>
277   - </a></li>
278   - <?php endforeach; ?>
279   - </ul>
280   - </div>
281   - <div class="both"></div>
282   - <div class="comment-wrapper" style="padding-bottom:25px">
283   - <?php
284   - echo CommentWidget::widget([
285   - 'model' => $product,
286   - ]);
287   - ?>
  270 + ]) ?></a>
  271 + </center>
  272 + </div>
  273 + <ul class="product_colors">
  274 + <?php foreach($product->images as $image): ?>
  275 + <li><a href="<?= $image->imageUrl ?>" rel="shadowbox[gal]">
  276 + <?= \common\components\artboximage\ArtboxImageHelper::getImage($image->imageUrl, 'product_trumb2', [
  277 + 'alt' => $category->categoryName->value . ' ' . $product->fullname,
  278 + 'title' => $category->categoryName->value . ' ' . $product->fullname,
  279 + ]) ?>
  280 + </a></li>
  281 + <?php endforeach; ?>
  282 + </ul>
  283 + </div>
  284 + <div class="both"></div>
  285 + <div class="comment-wrapper" style="padding-bottom:25px">
  286 + <?php
  287 + echo CommentWidget::widget([
  288 + 'model' => $product,
  289 + ]);
  290 + ?>
  291 + <div class="both"></div>
  292 + </div>
288 293 <div class="both"></div>
289 294 </div>
290   - <div class="both"></div>
291 295 <?= \common\modules\product\widgets\similarProducts::widget([ 'product' => $product ]) ?>
292 296 <?= \common\modules\product\widgets\specialProducts::widget([ 'type' => 'promo' ]) ?>
293 297 <?= \common\modules\product\widgets\specialProducts::widget([ 'type' => 'new' ]) ?>
... ...