From 0f8aaa74a51d38906edab311b77a624d9fc7b172 Mon Sep 17 00:00:00 2001 From: yarik Date: Thu, 16 Mar 2017 10:11:54 +0200 Subject: [PATCH] Image alt + title --- frontend/views/catalog/product.php | 369 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------------------------------------------------------------------------------------------------- frontend/views/catalog/product_item.php | 11 ++++++----- 2 files changed, 235 insertions(+), 145 deletions(-) diff --git a/frontend/views/catalog/product.php b/frontend/views/catalog/product.php index 42d08ef..0941b8a 100755 --- a/frontend/views/catalog/product.php +++ b/frontend/views/catalog/product.php @@ -7,21 +7,25 @@ // use common\modules\comment\widgets\CommentWidget; use common\modules\comment\widgets\CommentWidget; use common\modules\product\models\Category; -use yii\helpers\Html; -use yii\web\View; + use yii\helpers\Html; + use yii\web\View; use yii\helpers\Url; use frontend\widgets\Seo; -use frontend\assets\FlipclockAsset; -FlipclockAsset::register($this); + use frontend\assets\FlipclockAsset; + + FlipclockAsset::register($this); + $fullname = $product->fullname; $this->params[ 'seo' ][ 'key' ] = $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' ][ 'fields' ][ 'name' ] = $fullname; + $this->params[ 'seo' ][ 'h1' ] = !empty( Seo::widget([ 'row' => 'h1' ]) ) ? Seo::widget( + [ 'row' => 'h1' ] + ) : $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"; - $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)]); + //$this->params['seo']['title'] = "Купить " . substr($product->category->categoryName->value, 0, -2) . " " . $fullname . " в Киеве, Харькове, Украине: цены, отзывы - Rukzachok.com.ua"; + //$this->params['seo']['description'] = "Заказать " . substr($product->category->categoryName->value, 0, -2) . " " . $fullname . " - самые модные и стильные рюкзаки в Украине по лучшим ценам. Интернет магазин рюкзаков Rukzachok.com.ua"; + $this->title = $fullname; + //$this->title = (! empty($product->meta_title)) ? $product->meta_title : $fullname; + //$this->registerMetaTag (['name' => 'description', 'content' => ((! empty($product->meta_description)) ? $product->meta_description : $fullname)]); //$this->registerMetaTag (['name' => 'keywords', 'content' => $product->meta_keywords]); //foreach($product->category->getParents()->all() as $parent) { @@ -39,18 +43,19 @@ FlipclockAsset::register($this); ], ]; $this->params[ 'breadcrumbs' ][] = [ - 'label' => $category->name.' '.$product->brand->name, + 'label' => $category->name . ' ' . $product->brand->name, 'url' => [ 'catalog/category', 'category' => $category, - 'filters' => [ - 'brands' => [$product->brand->alias] - ] + 'filters' => [ + 'brands' => [ $product->brand->alias ], + ], ], ]; - $this->params[ 'breadcrumbs' ][] = $product->fullname . ' #' . $product->variant->sku; + $this->params[ 'breadcrumbs' ][] = $fullname . ' #' . $product->variant->sku; - $this->registerJs(' + $this->registerJs( + ' var checkData = function($index) { @@ -94,9 +99,13 @@ FlipclockAsset::register($this); checkData(0); - ', View::POS_READY, 'fasovka'); + ', + View::POS_READY, + 'fasovka' + ); - $this->registerJs(" + $this->registerJs( + " $('#nav_product li > a').addClass('active'); $('#nav_product li').find('.info').toggle(); @@ -108,43 +117,60 @@ FlipclockAsset::register($this); return false; }); - ", View::POS_READY, 'nav_product'); + ", + 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_END, - 'depends' => [ 'yii\web\JqueryAsset' ], - ]); - $this->registerJs(" + $this->registerJsFile( + Yii::$app->request->baseUrl . '/js/shadowbox-3.0.3/shadowbox.js', + [ + 'position' => View::POS_END, + 'depends' => [ 'yii\web\JqueryAsset' ], + ] + ); + $this->registerJs( + " Shadowbox.init({ }); - ", View::POS_READY, 'Shadowbox'); + ", + View::POS_READY, + 'Shadowbox' + ); ?> -session->getFlash('success')): ?> +session->getFlash('success')): ?>

'h1' ]) ?>

- enabledVariantsGrouped as $variantGroup) : ?> + enabledVariantsGrouped as $variantGroup) : ?>
name2 ?>
- variant->price_old >0 ? $product->variant->price_old : 0?> грн. + variant->price_old > 0 ? $product->variant->price_old : 0 ?> грн. variant->price ?> грн.
- ">variant->price > 0 ? "Купить" : "Нет в наличии"?> + ">variant->price > 0 ? "Купить" : "Нет в наличии" ?>
@@ -174,33 +200,41 @@ FlipclockAsset::register($this);
averageRating ) && $product->averageRating->value) { + if (!empty( $product->averageRating ) && $product->averageRating->value) { ?>
averageRating->value; ?> - comments); ?> + comments + ); ?>
comments); - if($comment_count) { + if ($comment_count) { echo "Отзывов: " . $comment_count; } else { echo "Оставить отзыв"; @@ -248,82 +282,101 @@ FlipclockAsset::register($this);
- events as $event):?> - end_at) && $event->isActive()):?> + events as $event): ?> + end_at ) && $event->isActive()): ?>
- -
name,Url::to(['event/show','alias'=>$event->alias,'id'=>$event->primaryKey]))?>
+ +
name, + Url::to( + [ + 'event/show', + 'alias' => $event->alias, + 'id' => $event->primaryKey, + ] + ) + ) ?>
До конца осталось:
- +
- +
- video ) && strpos($product->video, '.jpg') === false && strpos($product->video, '.png') === false) : ?> + video ) && strpos($product->video, '.jpg') === false && strpos( + $product->video, + '.png' + ) === false + ) : ?>
  • Видео
    - video, 'video, ' + video, 'video, + ' video ?> - false, - 'url' => $product->video, - ]) ?> + false, + 'url' => $product->video, + ] + ) ?>
  • @@ -355,38 +418,60 @@ FlipclockAsset::register($this);
    - events as $event):?> - banner) && $event->isActive()):?> - bannerUrl, 'event_in_product'),Url::to(['event/show','alias'=>$event->alias,'id'=>$event->primaryKey]))?> + events as $event): ?> + banner ) && $event->isActive()): ?> + bannerUrl, + 'event_in_product' + ), + Url::to( + [ + 'event/show', + 'alias' => $event->alias, + 'id' => $event->primaryKey, + ] + ) + ) ?>
    - +
    $product, - ]); + echo CommentWidget::widget( + [ + 'model' => $product, + ] + ); ?>
    @@ -399,7 +484,8 @@ FlipclockAsset::register($this); registerJs(" + $this->registerJs( + " var productHash = window.location.hash; productHash = productHash.replace('#','') @@ -412,5 +498,8 @@ FlipclockAsset::register($this); $('#pic').attr('src',dataImg) $('#pic').parent().attr('href',dataLink) - ", View::POS_READY, 'new_script'); + ", + View::POS_READY, + 'new_script' + ); ?> \ No newline at end of file diff --git a/frontend/views/catalog/product_item.php b/frontend/views/catalog/product_item.php index 0fea24c..eb13b23 100755 --- a/frontend/views/catalog/product_item.php +++ b/frontend/views/catalog/product_item.php @@ -6,6 +6,7 @@ Yii::$app->getModule('artbox-comment'); CommentAsset::register($this); + $fullname = $product->fullname; ?>
  • @@ -16,8 +17,8 @@ '#' => 'm' . $product->enabledVariants[ 0 ]->product_variant_id, ]) ?>"> enabledVariants[ 0 ]->imageUrl, 'list', [ - 'alt' => $product->category->categoryName->value . ' ' . $product->fullname, - 'title' => $product->category->categoryName->value . ' ' . $product->fullname, + 'alt' => $fullname, + 'title' => $fullname, ]) ?>
    @@ -64,7 +65,7 @@ 'product' => $product, '#' => 'm' . $product->enabledVariants[ 0 ]->product_variant_id, ]) ?>" - class="name">fullname ?> + class="name"> 'm' . $variant->product_variant_id, ]) ?>"> imageUrl, 'product_variant', [ - 'alt' => $product->category->categoryName->value . ' ' . $product->fullname, - 'title' => $product->category->categoryName->value . ' ' . $product->fullname, + 'alt' => $fullname, + 'title' => $fullname, ]) ?>
  • -- libgit2 0.21.4