Commit bc07fb4778f97a7b671aeb24de546ff57662abf0
1 parent
63e867f2
big commti
Showing
6 changed files
with
170 additions
and
14 deletions
Show diff stats
.htaccess
| ... | ... | @@ -12,13 +12,13 @@ AddDefaultCharset utf-8 |
| 12 | 12 | |
| 13 | 13 | RewriteBase / |
| 14 | 14 | # deal with admin first |
| 15 | + #liniya svitla only | |
| 16 | + #redirect to remove the .html extension | |
| 17 | +# RewriteRule ^(.+)\.htm$ /product/old-item-$1 [L,NC,R=301] | |
| 18 | + | |
| 15 | 19 | |
| 16 | 20 | Redirect 301 /Kak_vibrat_ryuksak / |
| 17 | 21 | Redirect 301 /products/ryukzaki /catalog/ryukzaki |
| 18 | - Redirect 301 /products/koshel_ki /catalog/koshelki | |
| 19 | - Redirect 301 /products/nesessery /catalog/nesessery | |
| 20 | - Redirect 301 /products/sumki /catalog/sumki | |
| 21 | - Redirect 301 /products/germochehly /catalog/germocehly | |
| 22 | 22 | |
| 23 | 23 | RewriteRule ^storage/(.*)?$ /storage/$1 [L,PT] |
| 24 | 24 | RewriteRule ^generator/(.*)?$ /generator/$1 [L,PT] |
| ... | ... | @@ -89,6 +89,12 @@ AddDefaultCharset utf-8 |
| 89 | 89 | RewriteCond %{THE_REQUEST} \s/+(.+?)/+[?\s] |
| 90 | 90 | RewriteRule /$ /%1 [R,L] |
| 91 | 91 | |
| 92 | + | |
| 93 | + | |
| 94 | + RewriteCond %{THE_REQUEST} \s/+(.+?)/+[?\s] | |
| 95 | + RewriteRule /$ /%1 [R,L] | |
| 96 | + | |
| 97 | + | |
| 92 | 98 | RewriteCond %{HTTP_HOST} ^([^www].*)$ |
| 93 | 99 | RewriteRule ^(.*)$ http://www.%1/$1 [R=301] |
| 94 | 100 | ... | ... |
common/modules/product/CatalogUrlManager.php
| ... | ... | @@ -6,6 +6,7 @@ namespace common\modules\product; |
| 6 | 6 | use common\modules\product\models\CategorySearch; |
| 7 | 7 | use common\modules\product\models\ProductSearch; |
| 8 | 8 | |
| 9 | +use common\modules\product\models\ProductVariant; | |
| 9 | 10 | use Yii; |
| 10 | 11 | use yii\helpers\Url; |
| 11 | 12 | use yii\web\HttpException; |
| ... | ... | @@ -22,8 +23,35 @@ class CatalogUrlManager implements UrlRuleInterface { |
| 22 | 23 | */ |
| 23 | 24 | public function parseRequest($manager, $request) |
| 24 | 25 | { |
| 26 | + | |
| 27 | + | |
| 25 | 28 | $pathInfo = $request->getPathInfo(); |
| 26 | 29 | $paths = explode('/', $pathInfo); |
| 30 | + /** | |
| 31 | + * linija-svitla.ua only | |
| 32 | + */ | |
| 33 | + $pattern = '/^(.+)\.htm$/'; | |
| 34 | + if(isset($paths[0])){ | |
| 35 | + preg_match($pattern,$paths[0], $match ); | |
| 36 | + if(!empty($match)){ | |
| 37 | + $old_item_name = explode('-',$paths[0] ); | |
| 38 | + if(isset($old_item_name[2]) && isset($old_item_name[3]) && isset($old_item_name[4])){ | |
| 39 | + $sku = $old_item_name[2].'/'.$old_item_name[3].'/'.$old_item_name[4]; | |
| 40 | + $product_variant = ProductVariant::find()->where(['sku'=>$sku])->one(); | |
| 41 | + if($product_variant instanceof ProductVariant){ | |
| 42 | + | |
| 43 | + $link = 'product'.'/'. $product_variant->product->alias; | |
| 44 | + header("Status: 301"); | |
| 45 | + header("Location: http://www.test-22.artweb.com.ua/".$link); | |
| 46 | + die(); | |
| 47 | + } | |
| 48 | + } | |
| 49 | + } | |
| 50 | + } | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 27 | 55 | |
| 28 | 56 | if(isset($paths[1])) { |
| 29 | 57 | if(strripos($request->url,'catalog/'.$paths[1].'?') && (!strripos($request->url,'?page')) && (!strripos($request->url,'?sort'))){ |
| ... | ... | @@ -61,6 +89,7 @@ class CatalogUrlManager implements UrlRuleInterface { |
| 61 | 89 | } |
| 62 | 90 | } |
| 63 | 91 | } elseif ($paths[0] == 'product') { |
| 92 | + | |
| 64 | 93 | if (!empty($paths[2])) { |
| 65 | 94 | throw new HttpException(404 ,'Page not found'); |
| 66 | 95 | } | ... | ... |
frontend/config/main.php
| 1 | +<?php | |
| 2 | + /** | |
| 3 | + * @var $model common\modules\product\models\Product | |
| 4 | + */ | |
| 5 | +use yii\helpers\Html; | |
| 6 | +use yii\helpers\Url; | |
| 7 | +$category = $model->category; | |
| 8 | +?> | |
| 9 | +<div class="catalog_item"> | |
| 10 | + <div class="wrapper"> | |
| 11 | + <div class="item_container" > | |
| 12 | + <input class="prodInfo" type="hidden" value="[]"> | |
| 13 | + <div class="title"> | |
| 14 | + <?= Html::a( $model->name, Url::to(['catalog/product', 'product' => $model->alias]), ['class'=>'btn-product-details'] )?> | |
| 15 | + </div> | |
| 16 | + <div class="img"> | |
| 17 | + <a class="btn-product-details" href="<?= Url::to([ | |
| 18 | + 'catalog/product', | |
| 19 | + 'product' => $model->alias | |
| 20 | + ]) ?>"> | |
| 21 | + <?php | |
| 22 | + foreach($model->events as $event){ | |
| 23 | + if($event->banner){ | |
| 24 | + echo \common\components\artboximage\ArtboxImageHelper::getImage($event->getImageUrl('banner'), 'banner_list',[ | |
| 25 | + 'class' => 'banner-in-list' | |
| 26 | + ]); | |
| 27 | + } | |
| 28 | + } | |
| 29 | + | |
| 30 | + ?> | |
| 31 | + <?= \common\components\artboximage\ArtboxImageHelper::getImage($model->enabledVariants[ 0 ]->imageUrl, 'list', [ | |
| 32 | + 'alt' => $model->category->name . ' ' . $model->fullname, | |
| 33 | + 'title' => $model->category->name . ' ' . $model->fullname, | |
| 34 | + 'class' => 'selected' | |
| 35 | + ]) ?> | |
| 36 | + </a> | |
| 37 | + <div class="info_icons"> | |
| 38 | + <a href="#" class="btn buy_button" data-toggle="modal" data-target="#buyForm" data-id="<?=$model->variant->product_variant_id; ?>" lang="145">Купить</a> | |
| 39 | + <ul class="ul wishlike_block hidden"> | |
| 40 | + <li class="compare hidden"> | |
| 41 | + <a onclick="add2compare(); return false;" class="compare compare_text_link_3631483" href="#">К сравнению</a> | |
| 42 | + <span class="icon"></span> | |
| 43 | + </li> | |
| 44 | + <li class="like hidden"> | |
| 45 | + <a class="like like_text_link_3631483" href="#">В избранное</a><span class="icon"></span> | |
| 46 | + </li> | |
| 47 | + </ul> | |
| 48 | + </div> | |
| 49 | + </div> | |
| 50 | + <div class="price"> | |
| 51 | + | |
| 52 | + <?php if($model->variant->price_old){?> | |
| 53 | + <div class="dlexfduinxipi"> | |
| 54 | + <span class="main"> | |
| 55 | + <s><?= $model->variant->price_old ?><span class="currency">грн</span></s> | |
| 56 | + </span> | |
| 57 | + </div> | |
| 58 | + <?php }?> | |
| 59 | + <div class="dlexfduinxipi"> | |
| 60 | + Цена: | |
| 61 | + <span class="main"> | |
| 62 | + <?= $model->variant->price ?> | |
| 63 | + <span class="currency">грн</span> | |
| 64 | + </span> | |
| 65 | + </div> | |
| 66 | + </div> | |
| 67 | + <div class="additional_info params"> | |
| 68 | + <div class="block_title">Особенности</div> | |
| 69 | + <div class="descr"> | |
| 70 | + <div class="info"> | |
| 71 | + <ul class="sv"> | |
| 72 | + | |
| 73 | + <li><span>Бренд:</span> <?= $model->brand->name ?></li> | |
| 74 | + | |
| 75 | + <?php foreach($model->getActiveProperties($category->category_id) as $group): ?> | |
| 76 | + <li><span><?= $group->name ?> <?php foreach($group->_options as $option) : ?> </span><?= $option->ValueRenderHTML ?><?php endforeach ?></li> | |
| 77 | + <?php endforeach; ?> | |
| 78 | + | |
| 79 | + | |
| 80 | + </ul> | |
| 81 | + </div> | |
| 82 | + <div class="clearfix"></div> | |
| 83 | + </div> | |
| 84 | + <div class="price" style="display: none;"> | |
| 85 | + <div class="dlexfduinxipi"> | |
| 86 | + Цена: | |
| 87 | + <span class="main"> | |
| 88 | + <?php | |
| 89 | + | |
| 90 | + echo '<div class="cost-block" itemprop="offers" itemscope itemtype="http://schema.org/Offer">'; | |
| 91 | + | |
| 92 | + // есть скидка | |
| 93 | + echo '<p class="cost">'; | |
| 94 | + if($model->enabledVariants[ 0 ]->price_old != 0 && $model->enabledVariants[ 0 ]->price_old != $model->enabledVariants[ 0 ]->price) { | |
| 95 | + echo '<strike><span id=\'old_cost\' itemprop="price">' . $model->enabledVariants[0]->price_old . '</span> грн.</strike> '; | |
| 96 | + echo $model->enabledVariants[0]->price . ' <span>грн.</span></p>'; | |
| 97 | + } else { | |
| 98 | + echo '<span itemprop="price">'.$model->enabledVariants[0]->price . ' </span><span>грн.</span></p>'; | |
| 99 | + } | |
| 100 | + echo '<meta itemprop="priceCurrency" content = "UAH">'; | |
| 101 | + echo '</div>'; | |
| 102 | + | |
| 103 | + ?> | |
| 104 | + </span> | |
| 105 | + </div> | |
| 106 | + </div> | |
| 107 | + </div> | |
| 108 | + <div class="opacity_bg"></div> | |
| 109 | + </div> | |
| 110 | + </div> | |
| 111 | +</div> | |
| 0 | 112 | \ No newline at end of file | ... | ... |
frontend/views/event/show.php
| ... | ... | @@ -2,6 +2,8 @@ |
| 2 | 2 | use frontend\assets\FlipclockAsset; |
| 3 | 3 | use yii\helpers\Url; |
| 4 | 4 | use yii\widgets\Breadcrumbs; |
| 5 | +use yii\widgets\ListView; | |
| 6 | + | |
| 5 | 7 | FlipclockAsset::register($this); |
| 6 | 8 | ?> |
| 7 | 9 | <?php |
| ... | ... | @@ -67,15 +69,18 @@ $this->title = $model->name; |
| 67 | 69 | <div class="block-100" itemscope itemtype="http://schema.org/Product"> |
| 68 | 70 | |
| 69 | 71 | <div class="catalog_product_list view_table"> |
| 70 | - | |
| 71 | - <?php foreach($productProvider->models as $product) :?> | |
| 72 | - <?php if(!empty($product->enabledVariants) ):?> | |
| 73 | - <?= $this->render('../catalog/_product_item', [ | |
| 74 | - 'model' => $product, | |
| 75 | - 'category' => $product->category, | |
| 76 | - ])?> | |
| 77 | - <?php endif;?> | |
| 78 | - <?php endforeach?> | |
| 72 | + <?= ListView::widget([ | |
| 73 | + 'dataProvider' => $productProvider, | |
| 74 | + 'itemView' => function ($model, $key, $index, $widget) { | |
| 75 | + return $this->render('_product_item',[ | |
| 76 | + 'model' => $model, | |
| 77 | + | |
| 78 | + ]); | |
| 79 | + }, | |
| 80 | + 'layout' => "{items}<div class=\"clearfix\"></div>{pager}", | |
| 81 | + ]) | |
| 82 | + | |
| 83 | + ?> | |
| 79 | 84 | </div> |
| 80 | 85 | </div> |
| 81 | 86 | </div> | ... | ... |
frontend/views/site/error.php
| ... | ... | @@ -15,6 +15,9 @@ $this->title = 'Ошибка '.$code; |
| 15 | 15 | width: 100%; |
| 16 | 16 | height: 127px; |
| 17 | 17 | text-align: center; |
| 18 | + font-size: 165px; | |
| 19 | + color: #0f6fc7; | |
| 20 | + font-weight: bold; | |
| 18 | 21 | margin-top: 80px; |
| 19 | 22 | } |
| 20 | 23 | |
| ... | ... | @@ -84,7 +87,7 @@ $this->title = 'Ошибка '.$code; |
| 84 | 87 | </style> |
| 85 | 88 | |
| 86 | 89 | <div class="site-error"> |
| 87 | - <div class="img-404"><img src="/images/404.png" alt=""></div> | |
| 90 | + <div class="img-404">404!</div> | |
| 88 | 91 | <div class="text-404-wr"> |
| 89 | 92 | <p>Добро пожаловать на страницу 404!<br /> |
| 90 | 93 | Вы находитесь здесь, потому что ввели адрес страницы,<br /> | ... | ... |