Commit e60b727a5323d59e41ffaff6070eddcde02d1013
1 parent
d09f430f
big commti
Showing
4 changed files
with
40 additions
and
11 deletions
Show diff stats
common/modules/product/models/Brand.php
| @@ -39,6 +39,20 @@ class Brand extends \yii\db\ActiveRecord | @@ -39,6 +39,20 @@ class Brand extends \yii\db\ActiveRecord | ||
| 39 | return 'brand'; | 39 | return 'brand'; |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | + | ||
| 43 | + public function behaviors() | ||
| 44 | + { | ||
| 45 | + return | ||
| 46 | + [ | ||
| 47 | + 'class' => Slug::className(), | ||
| 48 | + 'in_attribute' => 'name', | ||
| 49 | + 'out_attribute' => 'alias', | ||
| 50 | + 'translit' => true | ||
| 51 | + | ||
| 52 | + ]; | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + | ||
| 42 | /** | 56 | /** |
| 43 | * @inheritdoc | 57 | * @inheritdoc |
| 44 | */ | 58 | */ |
common/modules/product/models/Category.php
| @@ -10,7 +10,7 @@ use common\modules\rubrication\models\TaxGroup; | @@ -10,7 +10,7 @@ use common\modules\rubrication\models\TaxGroup; | ||
| 10 | use Yii; | 10 | use Yii; |
| 11 | 11 | ||
| 12 | use yii\db\Query; | 12 | use yii\db\Query; |
| 13 | - | 13 | +use common\behaviors\Slug; |
| 14 | /** | 14 | /** |
| 15 | * This is the model class for table "category". | 15 | * This is the model class for table "category". |
| 16 | * | 16 | * |
| @@ -47,6 +47,12 @@ class Category extends \yii\db\ActiveRecord | @@ -47,6 +47,12 @@ class Category extends \yii\db\ActiveRecord | ||
| 47 | 'class' => ArtboxTreeBehavior::className(), | 47 | 'class' => ArtboxTreeBehavior::className(), |
| 48 | 'keyNameGroup' => null, | 48 | 'keyNameGroup' => null, |
| 49 | 'keyNamePath' => 'path', | 49 | 'keyNamePath' => 'path', |
| 50 | + ], | ||
| 51 | + [ | ||
| 52 | + 'class' => Slug::className(), | ||
| 53 | + 'in_attribute' => 'name', | ||
| 54 | + 'out_attribute' => 'alias', | ||
| 55 | + 'translit' => true | ||
| 50 | ] | 56 | ] |
| 51 | 57 | ||
| 52 | ]; | 58 | ]; |
| @@ -73,7 +79,6 @@ class Category extends \yii\db\ActiveRecord | @@ -73,7 +79,6 @@ class Category extends \yii\db\ActiveRecord | ||
| 73 | [['meta_robots'], 'string', 'max' => 50], | 79 | [['meta_robots'], 'string', 'max' => 50], |
| 74 | [['alias', 'name'], 'string', 'max' => 250], | 80 | [['alias', 'name'], 'string', 'max' => 250], |
| 75 | [['populary'], 'boolean'], | 81 | [['populary'], 'boolean'], |
| 76 | - [['group_to_category', 'remote_category'], 'safe'], | ||
| 77 | [['imageUpload'], 'safe'], | 82 | [['imageUpload'], 'safe'], |
| 78 | [['imageUpload'], 'file', 'extensions' => 'jpg, gif, png'], | 83 | [['imageUpload'], 'file', 'extensions' => 'jpg, gif, png'], |
| 79 | ]; | 84 | ]; |
frontend/views/catalog/_product_item.php
| @@ -66,8 +66,22 @@ use yii\helpers\Url; | @@ -66,8 +66,22 @@ use yii\helpers\Url; | ||
| 66 | <div class="dlexfduinxipi"> | 66 | <div class="dlexfduinxipi"> |
| 67 | Цена: | 67 | Цена: |
| 68 | <span class="main"> | 68 | <span class="main"> |
| 69 | - <?= $model->variant->price ?> | ||
| 70 | - <span class="currency">грн</span> | 69 | + <?php |
| 70 | + | ||
| 71 | + echo '<div class="cost-block" itemprop="offers" itemscope itemtype="http://schema.org/Offer">'; | ||
| 72 | + | ||
| 73 | + // есть скидка | ||
| 74 | + echo '<p class="cost">'; | ||
| 75 | + if($model->enabledVariants[ 0 ]->price_old != 0 && $model->enabledVariants[ 0 ]->price_old != $model->enabledVariants[ 0 ]->price) { | ||
| 76 | + echo '<strike><span id=\'old_cost\' itemprop="price">' . $model->enabledVariants[0]->price_old . '</span> грн.</strike> '; | ||
| 77 | + echo $model->enabledVariants[0]->price . ' <span>грн.</span></p>'; | ||
| 78 | + } else { | ||
| 79 | + echo '<span itemprop="price">'.$model->enabledVariants[0]->price . ' </span><span>грн.</span></p>'; | ||
| 80 | + } | ||
| 81 | + echo '<meta itemprop="priceCurrency" content = "UAH">'; | ||
| 82 | + echo '</div>'; | ||
| 83 | + | ||
| 84 | + ?> | ||
| 71 | </span> | 85 | </span> |
| 72 | </div> | 86 | </div> |
| 73 | </div> | 87 | </div> |
frontend/views/catalog/product.php
| @@ -110,13 +110,9 @@ $this->params[ 'breadcrumbs' ][] = $product->fullname . ' #' . $product->enabled | @@ -110,13 +110,9 @@ $this->params[ 'breadcrumbs' ][] = $product->fullname . ' #' . $product->enabled | ||
| 110 | <td> | 110 | <td> |
| 111 | 111 | ||
| 112 | 112 | ||
| 113 | - <span itemprop="offers" itemscope itemtype="http://schema.org/Offer" class="price"> | ||
| 114 | - <span itemprop="price" class="price"> | ||
| 115 | - <?php echo $product->variant->price;?> | ||
| 116 | - </span> | ||
| 117 | - <span style="display:none;" itemprop="priceCurrency">UAH</span> | ||
| 118 | - <span class="currency"> грн.</span> | ||
| 119 | - </span> | 113 | + <strike><span><span id='old_cost'><?= $product->variant->price_old ?></span></span> грн.</strike> |
| 114 | + <span class="cost"><span itemprop="price"><span id='cost'><?= $product->variant->price ?></span></span> <span class="valute">грн.</span></span> | ||
| 115 | + <meta itemprop="priceCurrency" content="UAH"> | ||
| 120 | 116 | ||
| 121 | </td> | 117 | </td> |
| 122 | <td> | 118 | <td> |