diff --git a/common/modules/product/models/Brand.php b/common/modules/product/models/Brand.php index 07c61e2..43d6d9d 100755 --- a/common/modules/product/models/Brand.php +++ b/common/modules/product/models/Brand.php @@ -39,6 +39,20 @@ class Brand extends \yii\db\ActiveRecord return 'brand'; } + + public function behaviors() + { + return + [ + 'class' => Slug::className(), + 'in_attribute' => 'name', + 'out_attribute' => 'alias', + 'translit' => true + + ]; + } + + /** * @inheritdoc */ diff --git a/common/modules/product/models/Category.php b/common/modules/product/models/Category.php index f5ac96c..d8bc742 100755 --- a/common/modules/product/models/Category.php +++ b/common/modules/product/models/Category.php @@ -10,7 +10,7 @@ use common\modules\rubrication\models\TaxGroup; use Yii; use yii\db\Query; - +use common\behaviors\Slug; /** * This is the model class for table "category". * @@ -47,6 +47,12 @@ class Category extends \yii\db\ActiveRecord 'class' => ArtboxTreeBehavior::className(), 'keyNameGroup' => null, 'keyNamePath' => 'path', + ], + [ + 'class' => Slug::className(), + 'in_attribute' => 'name', + 'out_attribute' => 'alias', + 'translit' => true ] ]; @@ -73,7 +79,6 @@ class Category extends \yii\db\ActiveRecord [['meta_robots'], 'string', 'max' => 50], [['alias', 'name'], 'string', 'max' => 250], [['populary'], 'boolean'], - [['group_to_category', 'remote_category'], 'safe'], [['imageUpload'], 'safe'], [['imageUpload'], 'file', 'extensions' => 'jpg, gif, png'], ]; diff --git a/frontend/views/catalog/_product_item.php b/frontend/views/catalog/_product_item.php index ea6ba27..509469f 100755 --- a/frontend/views/catalog/_product_item.php +++ b/frontend/views/catalog/_product_item.php @@ -66,8 +66,22 @@ use yii\helpers\Url;
Цена: - variant->price ?> - грн + '; + + // есть скидка + echo '

'; + if($model->enabledVariants[ 0 ]->price_old != 0 && $model->enabledVariants[ 0 ]->price_old != $model->enabledVariants[ 0 ]->price) { + echo '' . $model->enabledVariants[0]->price_old . ' грн. '; + echo $model->enabledVariants[0]->price . ' грн.

'; + } else { + echo ''.$model->enabledVariants[0]->price . ' грн.

'; + } + echo ''; + echo '
'; + + ?> diff --git a/frontend/views/catalog/product.php b/frontend/views/catalog/product.php index d80ca0f..fc82479 100755 --- a/frontend/views/catalog/product.php +++ b/frontend/views/catalog/product.php @@ -110,13 +110,9 @@ $this->params[ 'breadcrumbs' ][] = $product->fullname . ' #' . $product->enabled - - - variant->price;?> - - UAH -  грн. - + variant->price_old ?> грн. + variant->price ?> грн. + -- libgit2 0.21.4