diff --git a/backend/views/category/_form.php b/backend/views/category/_form.php
index ae21c57..e41c52e 100755
--- a/backend/views/category/_form.php
+++ b/backend/views/category/_form.php
@@ -30,7 +30,7 @@ use kartik\select2\Select2;
]
])->label(Yii::t('product', 'Parent category')) ?>
- = $form->field($model, 'group_to_category')->widget(Select2::className(), [
+ = $form->field($model, 'categories')->widget(Select2::className(), [
'data' => \yii\helpers\ArrayHelper::map(\common\modules\rubrication\models\TaxGroup::find()->all(), 'tax_group_id', 'name'),
'language' => 'ru',
'options' => [
diff --git a/common/config/main.php b/common/config/main.php
index 4b8d4b5..3ae7548 100755
--- a/common/config/main.php
+++ b/common/config/main.php
@@ -68,7 +68,7 @@ return [
'master' => null
],
],
- 'product_trumb2' => [
+ 'product_trumb' => [
'resize' => [
'width' => 88,
'height' => 88,
diff --git a/common/models/Basket.php b/common/models/Basket.php
index 20848c1..3330951 100644
--- a/common/models/Basket.php
+++ b/common/models/Basket.php
@@ -113,17 +113,5 @@
->all();
}
- public function getModal(): string
- {
- $output = '';
- $data = $this->getData();
- $models = $this->findModels(array_keys($this->getData()));
- if(!empty( $models )) {
- $output = \Yii::$app->view->renderFile('@frontend/views/basket/modal_items.php', [
- 'models' => $models,
- 'basket' => $this,
- ]);
- }
- return $output;
- }
+
}
\ No newline at end of file
diff --git a/common/models/Orders.php b/common/models/Orders.php
index 61cec67..ed89148 100755
--- a/common/models/Orders.php
+++ b/common/models/Orders.php
@@ -16,8 +16,8 @@ class Orders extends \yii\db\ActiveRecord
public function rules()
{
return [
- [['name', 'phone'], 'required','whenClient' => true],
- [['total','body','email','phone2','delivery','payment','adress','city'], 'safe'],
+ [['name', 'phone'], 'required'],
+ [['comment'], 'safe'],
[['email'],'email'],
];
}
@@ -26,17 +26,9 @@ class Orders extends \yii\db\ActiveRecord
{
return [
'name' => 'Ф.И.О',
- 'phone'=>'Телефон',
- 'phone2'=>'Доп. Тел.',
- 'body'=>'Сообщение',
- 'adress'=>'Адрес',
- 'city'=>'Город',
- 'email'=>'E-mail',
- 'date_time'=>'Дата',
- 'total'=>'Сума',
- 'status'=>'Статус',
- 'delivery'=>'Вариант доставки',
- 'payment'=>'Способы оплаты',
+ 'phone'=>'Контактный телефон',
+ 'email'=>'email',
+ 'comment'=>'Комментарии',
];
}
diff --git a/common/modules/product/models/Category.php b/common/modules/product/models/Category.php
index 0b94a82..f5ac96c 100755
--- a/common/modules/product/models/Category.php
+++ b/common/modules/product/models/Category.php
@@ -135,8 +135,8 @@ class Category extends \yii\db\ActiveRecord
public function getTaxGroupsByLevel($level)
{
- return $this->hasMany(TaxGroup::className(), ['tax_group_id' => 'entity1_id'])
- ->viaTable('relation', ['entity2_id' => 'category_id'])
+ return $this->hasMany(TaxGroup::className(), ['tax_group_id' => 'tax_group_id'])
+ ->viaTable('tax_group_to_category', ['category_id' => 'category_id'])
->andWhere(['level' => $level]);
}
@@ -261,4 +261,10 @@ class Category extends \yii\db\ActiveRecord
}
+
+ public function getTaxGroup()
+ {
+ return $this->hasMany(TaxGroup::className(), ['tax_group_id' => 'tax_group_id'])
+ ->viaTable('tax_group_to_category', ['category_id' => 'category_id']);
+ }
}
diff --git a/common/modules/product/models/Import.php b/common/modules/product/models/Import.php
index fb188c4..a167acd 100755
--- a/common/modules/product/models/Import.php
+++ b/common/modules/product/models/Import.php
@@ -312,7 +312,7 @@ class Import extends Model {
foreach($catalog_names as $catalog_name){
// ==== Set category ====
- if ( ($category = CategoryName::find()->filterWhere(['ilike', 'value', trim($catalog_name)])->one()) === null ) {
+ if ( ($category = Category::find()->filterWhere(['ilike', 'name', trim($catalog_name)])->one()) === null ) {
// Create category
$category = new Category();
$category->name = trim($catalog_name);
@@ -327,7 +327,7 @@ class Import extends Model {
// ===== Set brand ====
if ( $brand_name ) {
- if ( ($brand = BrandName::find()->filterWhere(['ilike', 'value', trim($brand_name)])->one()) !== null ) {
+ if ( ($brand = Brand::find()->filterWhere(['ilike', 'name', trim($brand_name)])->one()) !== null ) {
$_product->brand_id = $brand->brand_id;
} else {
// Create brand
@@ -527,7 +527,7 @@ class Import extends Model {
$taxGroup->name = $filter_name;
$taxGroup->module = 'string';
$taxGroup->hierarchical = FALSE;
- $taxGroup->group_to_category = $catalog_names;
+ $taxGroup->categories = $catalog_names;
$taxGroup->is_filter = FALSE;
$taxGroup->save();
}
diff --git a/common/modules/product/models/Product.php b/common/modules/product/models/Product.php
index aac4be2..e310aeb 100755
--- a/common/modules/product/models/Product.php
+++ b/common/modules/product/models/Product.php
@@ -264,7 +264,10 @@ class Product extends \yii\db\ActiveRecord
foreach ($this->options as $option) {
$options[$option->tax_group_id][] = $option;
}
- foreach (TaxGroup::find()->joinWith('categories')->where(['tax_group.tax_group_id' => array_keys($options), 'tax_group.display' => TRUE, 'category.category_id' => $category_id])->all() as $group) {
+
+ $taxGroups = TaxGroup::find()->joinWith('categories')->where(['tax_group.tax_group_id' => array_keys($options), 'tax_group.display' => TRUE, 'category.category_id' => $category_id])->all();
+
+ foreach ($taxGroups as $group) {
if (!empty($options[$group->tax_group_id])) {
$group->_options = $options[$group->tax_group_id];
$groups[] = $group;
@@ -296,19 +299,20 @@ class Product extends \yii\db\ActiveRecord
{
parent::afterSave($insert, $changedAttributes);
-// $images = UploadedFile::getInstance($this, 'imagesUpload');
-// var_dump($images);exit;
-// if (!empty($this->imagesUpload)) {
-// if (!is_array($this->imagesUpload)) {
-// $this->imagesUpload = [$this->imagesUpload];
-// }
-// foreach($this->imagesUpload as $image) {
-// $image->saveAs((Yii::getAlias('@frontend/web/storage/products/original/' . $image->baseName .'_'. uniqid() . '.' . $image->extension)));
-// }
-//
-//
-// }
+ $this->unlinkAll('categories', true);
+ $this->unlinkAll('options',true);
+
+
+ $categories = Category::findAll($this->categories);
+ $options = TaxOption::findAll($this->options);
+
+ foreach($options as $option){
+ $this->link('options', $option);
+ }
+ foreach($categories as $category){
+ $this->link('categories', $category);
+ }
if (!empty($this->_variants)) {
$todel = [];
@@ -341,7 +345,6 @@ class Product extends \yii\db\ActiveRecord
ProductCategory::deleteAll(['product_id' => $this->product_id]);
ProductVariant::deleteAll(['product_id' => $this->product_id]);
ProductOption::deleteAll(['product_id' => $this->product_id]);
- //ProductVariantOption::deleteAll(['product_id' => $this->product_id]);
ProductStock::deleteAll(['product_id' => $this->product_id]);
Share::deleteAll(['product_id' => $this->product_id]);
return true;
@@ -435,4 +438,15 @@ class Product extends \yii\db\ActiveRecord
$categories = ArrayHelper::getColumn($this->categories, 'category_id');
return TaxGroup::find()->distinct()->innerJoin('tax_group_to_category', 'tax_group_to_category.tax_group_id = tax_group.tax_group_id')->andWhere(['tax_group_to_category.category_id' => $categories])->andWhere(['level' => $level]);
}
+
+ public function setCategories($values)
+ {
+ $this->categories = $values;
+ }
+
+ public function setOptions($values)
+ {
+ $this->options = $values;
+ }
+
}
diff --git a/common/modules/product/models/ProductSearch.php b/common/modules/product/models/ProductSearch.php
index 9781ea7..80ec3fa 100755
--- a/common/modules/product/models/ProductSearch.php
+++ b/common/modules/product/models/ProductSearch.php
@@ -26,7 +26,7 @@ class ProductSearch extends Product
{
return [
[['name', 'brand_name', 'brand_id', 'category_id', 'category_name', 'variant_sku'], 'safe'],
- [['tax_brand_id', 'product_id'], 'integer'],
+ [['brand_id', 'product_id'], 'integer'],
[['is_top', 'is_new', 'akciya'], 'boolean'],
];
}
@@ -49,12 +49,12 @@ class ProductSearch extends Product
*/
public function search($params)
{
+
$query = Product::find();
$query->joinWith(['brand', 'categories', 'variant']);
$query->groupBy(['product.product_id']);
- $query->orderBy('product.product_id', 'DESC');
$dataProvider = new ActiveDataProvider([
'query' => $query,
@@ -68,8 +68,8 @@ class ProductSearch extends Product
'attributes' => [
'name',
'brand_name' => [
- 'asc' => ['brand_name.value' => SORT_ASC],
- 'desc' => ['brand_name.value' => SORT_DESC],
+ 'asc' => ['brand.name' => SORT_ASC],
+ 'desc' => ['brand.name' => SORT_DESC],
'default' => SORT_DESC,
'label' => 'Brand name',
],
@@ -100,8 +100,8 @@ class ProductSearch extends Product
]);
$query->andFilterWhere(['ilike', 'product.name', $this->name]);
- $query->andFilterWhere(['ilike', 'brand_name.value', $this->brand_name]);
- $query->andFilterWhere(['ilike', 'category_name.value', $this->category_name]);
+ $query->andFilterWhere(['ilike', 'brand.name', $this->brand_name]);
+ $query->andFilterWhere(['ilike', 'category.name', $this->category_name]);
$query->andFilterWhere(['ilike', 'product_variant.sku', $this->variant_sku]);
return $dataProvider;
diff --git a/common/modules/product/models/TaxGroupToCategory.php b/common/modules/product/models/TaxGroupToCategory.php
deleted file mode 100644
index b822aa8..0000000
--- a/common/modules/product/models/TaxGroupToCategory.php
+++ /dev/null
@@ -1,68 +0,0 @@
- true, 'targetClass' => Category::className(), 'targetAttribute' => ['category_id' => 'category_id']],
- [['tax_group_id'], 'exist', 'skipOnError' => true, 'targetClass' => TaxGroup::className(), 'targetAttribute' => ['tax_group_id' => 'tax_group_id']],
- ];
- }
-
- /**
- * @inheritdoc
- */
- public function attributeLabels()
- {
- return [
- 'tax_group_to_category_id' => 'Tax Group To Category ID',
- 'tax_group_id' => 'Tax Group ID',
- 'category_id' => 'Category ID',
- ];
- }
-
- /**
- * @return \yii\db\ActiveQuery
- */
- public function getCategory()
- {
- return $this->hasOne(Category::className(), ['category_id' => 'category_id']);
- }
-
- /**
- * @return \yii\db\ActiveQuery
- */
- public function getTaxGroup()
- {
- return $this->hasOne(TaxGroup::className(), ['tax_group_id' => 'tax_group_id']);
- }
-}
diff --git a/common/modules/rubrication/models/TaxGroup.php b/common/modules/rubrication/models/TaxGroup.php
index af5e397..8d93d2f 100755
--- a/common/modules/rubrication/models/TaxGroup.php
+++ b/common/modules/rubrication/models/TaxGroup.php
@@ -22,11 +22,11 @@ use Yii;
* @property TaxGroupToGroup[] $taxGroupToGroups
* @property TaxGroupToGroup[] $taxGroupToGroups0
* @property TaxOption[] $taxOptions
- * @property TaxOptionToGroup[] $taxOptionToGroups
*/
class TaxGroup extends \yii\db\ActiveRecord
{
public $_options = [];
+
/**
* @inheritdoc
*/
@@ -62,7 +62,7 @@ class TaxGroup extends \yii\db\ActiveRecord
[['level', 'sort'], 'integer'],
[['alias', 'module'], 'string', 'max' => 50],
[['name'], 'string', 'max' => 255],
- [['group_to_category'], 'safe']
+ [['categories'], 'safe']
];
}
@@ -95,16 +95,25 @@ class TaxGroup extends \yii\db\ActiveRecord
public function getCategories()
{
- return $this->hasMany(Category::className(), ['category_id' => 'entity2_id'])
- ->viaTable('relation', ['entity1_id' => 'tax_group_id']);
+ return $this->hasMany(Category::className(), ['category_id' => 'category_id'])
+ ->viaTable('tax_group_to_category', ['tax_group_id' => 'tax_group_id']);
}
-
- /**
- * @return \yii\db\ActiveQuery
- */
- public function getTaxGroupToGroups0()
+
+ public function setCategories($values)
{
- return $this->hasMany(TaxGroupToGroup::className(), ['tax_group2_id' => 'tax_group_id'])->inverseOf('taxGroup2');
+ $this->categories = $values;
+ }
+
+ public function afterSave($insert, $changedAttributes)
+ {
+
+ $this->unlinkAll('categories',true);
+ $categories = Category::findAll($this->categories);
+ foreach($categories as $category){
+ $this->link('categories', $category);
+ }
+
+
}
/**
diff --git a/common/modules/rubrication/models/TaxGroupToCategory.php b/common/modules/rubrication/models/TaxGroupToCategory.php
new file mode 100644
index 0000000..481b582
--- /dev/null
+++ b/common/modules/rubrication/models/TaxGroupToCategory.php
@@ -0,0 +1,68 @@
+ true, 'targetClass' => Category::className(), 'targetAttribute' => ['category_id' => 'category_id']],
+ [['tax_group_id'], 'exist', 'skipOnError' => true, 'targetClass' => TaxGroup::className(), 'targetAttribute' => ['tax_group_id' => 'tax_group_id']],
+ ];
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function attributeLabels()
+ {
+ return [
+ 'tax_group_to_category_id' => 'Tax Group To Category ID',
+ 'tax_group_id' => 'Tax Group ID',
+ 'category_id' => 'Category ID',
+ ];
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getCategory()
+ {
+ return $this->hasOne(Category::className(), ['category_id' => 'category_id']);
+ }
+
+ /**
+ * @return \yii\db\ActiveQuery
+ */
+ public function getTaxGroup()
+ {
+ return $this->hasOne(TaxGroup::className(), ['tax_group_id' => 'tax_group_id']);
+ }
+}
diff --git a/common/modules/rubrication/views/tax-group/_form.php b/common/modules/rubrication/views/tax-group/_form.php
index d457164..d270c34 100755
--- a/common/modules/rubrication/views/tax-group/_form.php
+++ b/common/modules/rubrication/views/tax-group/_form.php
@@ -25,7 +25,7 @@ use common\components\artboxtree\ArtboxTreeHelper;
'prompt' => Yii::t('rubrication', 'Select module'),
]) ?>
- = $form->field($model, 'group_to_category')->dropDownList(
+ = $form->field($model, 'categories')->dropDownList(
ArtboxTreeHelper::treeMap(ProductHelper::getCategories(), 'category_id', 'name'),
[
'multiple' => true
diff --git a/common/widgets/Mailer.php b/common/widgets/Mailer.php
index 497b8e7..1b8a8af 100755
--- a/common/widgets/Mailer.php
+++ b/common/widgets/Mailer.php
@@ -44,6 +44,7 @@ class Mailer extends Widget{
$address = "Rukzachok.com.ua@gmail.com";
$mail->AddAddress($address);
$mail->AddAddress($this->email);
+ $mail->AddAddress('dockdep@gmail.com');
if(!$mail->send()) {
\Yii::$app->getSession()->setFlash('error', 'Mailer Error: ' . $mail->ErrorInfo);
diff --git a/frontend/assets/FotoramaAsset.php b/frontend/assets/FotoramaAsset.php
new file mode 100644
index 0000000..d9a6515
--- /dev/null
+++ b/frontend/assets/FotoramaAsset.php
@@ -0,0 +1,28 @@
+
+ * @since 2.0
+ */
+class FotoramaAsset extends AssetBundle
+{
+ public $sourcePath = '@bower';
+ public $css = [
+ 'fotorama/fotorama.css'
+ ];
+ public $js = [
+ 'fotorama/fotorama.js'
+ ];
+ public $jsOptions = array(
+ 'position' => \yii\web\View::POS_END
+ );
+}
diff --git a/frontend/controllers/BasketController.php b/frontend/controllers/BasketController.php
index 3250c08..006a1bc 100755
--- a/frontend/controllers/BasketController.php
+++ b/frontend/controllers/BasketController.php
@@ -17,7 +17,7 @@ class BasketController extends \yii\web\Controller
$basket = \Yii::$app->basket;
$result = [
'basket' => $basket->getData(),
- 'modal' => $basket->getModal(),
+ 'modal' => $this->getModal($basket),
];
return $result;
}
@@ -31,7 +31,7 @@ class BasketController extends \yii\web\Controller
$basket->add($product_variant_id, $count);
$result = [
'basket' => $basket->getData(),
- 'modal' => $basket->getModal(),
+ 'modal' => $this->getModal($basket),
];
return $result;
}
@@ -45,7 +45,7 @@ class BasketController extends \yii\web\Controller
$basket->set($product_variant_id, $count);
$result = [
'basket' => $basket->getData(),
- 'modal' => $basket->getModal(),
+ 'modal' => $this->getModal($basket),
];
return $result;
}
@@ -54,7 +54,25 @@ class BasketController extends \yii\web\Controller
* @var Basket $basket
*/
$basket = \Yii::$app->basket;
- $modal = $basket->getModal();
+ $modal = $this->getModal($basket);
return $modal;
}
+
+ /**
+ * @var $basket \common\models\Basket
+ * @return string modal_items
+ */
+ public function getModal($basket): string
+ {
+ $output = '';
+ $data = $basket->getData();
+ $models = $basket->findModels(array_keys($data));
+ if(!empty( $models )) {
+ $output = $this->renderAjax('modal_items', [
+ 'models' => $models,
+ 'basket' => $basket,
+ ]);
+ }
+ return $output;
+ }
}
diff --git a/frontend/controllers/OrderController.php b/frontend/controllers/OrderController.php
new file mode 100644
index 0000000..130e3ac
--- /dev/null
+++ b/frontend/controllers/OrderController.php
@@ -0,0 +1,148 @@
+basket;
+ $data = $basket->getData();
+ $models = $basket->findModels(array_keys($data));
+ return $this->render('index', [
+ 'models' => $models,
+ 'basket' => $basket,
+ ]);
+ }
+
+
+ /**
+ *
+ * @return string
+ */
+ public function actionSave()
+ {
+ $modelOrder = new Orders;
+ /**
+ * @var $basket Basket
+ */
+ $basket = \Yii::$app->basket;
+ $productV = $basket->getData();
+
+ if(!empty($productV) && $modelOrder->load(Yii::$app->request->post())&& $modelOrder->save()){
+
+ foreach ($productV as $index=>$row) {
+ $modelOrdersProducts = new OrdersProducts();
+ $mod_id = $index;
+
+
+ $product = ProductVariant::findOne($mod_id);
+ /**
+ * Проверяем товар на наличие
+ */
+
+ if(!$product->stock > 0 || !$product->price > 0 ){
+
+ /**
+ * Добавляем сообщение об ошибке
+ */
+ \Yii::$app->getSession()->setFlash('error', 'К сожалению товара '.$product->name . ' нет в наличии');
+ /**
+ * Удаляем заказ
+ */
+ $modelOrder->delete();
+
+ }else {
+
+ /**
+ * Удаляем товар с массива и сохраняем в заказ
+ */
+
+
+
+ $modelOrdersProducts->order_id = $modelOrder->id;
+ $modelOrdersProducts->product_name = $product->product->name;
+ $modelOrdersProducts->name = $product->name;
+ $modelOrdersProducts->price = $productV[$index]['price'];
+ $modelOrdersProducts->count= $productV[$index]['count'];
+ $modelOrdersProducts->sum_cost = $productV[$index]['price'] *$productV[$index]['count'] ;
+ $modelOrdersProducts->mod_id = $mod_id;
+ $modelOrdersProducts->sku = $product->sku;
+ $modelOrdersProducts->validate();
+ $modelOrdersProducts->save();
+ $productV[$index] = ArrayHelper::toArray($modelOrdersProducts);
+ $productV[$index]['img'] = \common\components\artboximage\ArtboxImageHelper::getImageSrc($product->image->imageUrl, 'list');
+ }
+
+ }
+
+ /**
+ * Сохраняем заказ
+ */
+
+
+ if(!Yii::$app->user->id && !empty($modelOrder->email)){
+ $modelUser = new Customer();
+ $modelUser->role = 'person';
+ $modelUser->username = $modelOrder->email;
+ $modelUser->name = $modelOrder->name;
+ $modelUser->phone = $modelOrder->phone;
+ $modelUser->password = Yii::$app->getSecurity()->generateRandomString(10);
+ $modelUser->group_id = 2;
+ $modelUser->save();
+ }
+ $order = clone $modelOrder;
+ /**
+ * Чистим сессию корзины
+ */
+
+ $modelOrder->clearBasket();
+
+ Mailer::widget(
+ ['type' => 'order',
+ 'subject'=> 'Спасибо за покупку',
+ 'email' => $modelOrder->email,
+ 'params' => [
+ 'order' => $order,
+ 'variants' => $productV,
+ ]
+ ]);
+
+ //$text = "# zakaz: ". $order->id .". V blijayshee vremya menedjer svyajetsya s Vami. (044) 303 90 15";
+ //Yii::$app->sms->send($order->phone, $text);
+
+ Yii::$app->session['order_data']= ['order' => $order,'variants'=>$productV];
+
+ return $this->redirect(['order/success',
+ ]);
+ }
+
+ $data = $basket->getData();
+ $models = $basket->findModels(array_keys($data));
+ return $this->render('index', [
+ 'models' => $models,
+ 'basket' => $basket
+ ]);
+ }
+
+ public function actionSuccess(){
+ return $this->render('success', [
+
+ ]);
+ }
+
+}
diff --git a/frontend/models/ProductFrontendSearch.php b/frontend/models/ProductFrontendSearch.php
index 5bc4cd1..ece7ca5 100755
--- a/frontend/models/ProductFrontendSearch.php
+++ b/frontend/models/ProductFrontendSearch.php
@@ -53,7 +53,7 @@ class ProductFrontendSearch extends Product {
$dataProvider = new ActiveDataProvider([
'query' => $this->getSearchQuery($category, $params),
'pagination' => [
- 'pageSize' => 16,
+ 'pageSize' => 15,
],
'sort' => [
'attributes' => [
@@ -91,7 +91,7 @@ class ProductFrontendSearch extends Product {
$query = Product::find();
}
$query->select(['product.*']);
- $query->joinWith(['enabledVariants','brand', 'category']);
+ $query->joinWith(['enabledVariants','brand','options', 'category']);
$query->groupBy(['product.product_id', 'product_variant.price']);
diff --git a/frontend/views/basket/modal_items.php b/frontend/views/basket/modal_items.php
index 860e709..34ee48b 100644
--- a/frontend/views/basket/modal_items.php
+++ b/frontend/views/basket/modal_items.php
@@ -2,7 +2,8 @@
use common\models\Basket;
use common\modules\product\models\ProductVariant;
use yii\helpers\Html;
- use yii\web\View;
+use yii\helpers\Url;
+use yii\web\View;
/**
* @var View $this
@@ -63,7 +64,8 @@
?>
- Оформить заказ
+ = Html::a('Оформить заказ',Url::to('/order'),['class'=>'btn'])?>
+
|
diff --git a/frontend/views/catalog/_product_item.php b/frontend/views/catalog/_product_item.php
index 55cb209..ea6ba27 100755
--- a/frontend/views/catalog/_product_item.php
+++ b/frontend/views/catalog/_product_item.php
@@ -24,7 +24,7 @@ use yii\helpers\Url;
]) ?>
-
-
- есть на складе
-
Особенности
- - Тип: подвесной светильник
- - Бренд: Massive
- - Модель: 41782/53/10
- - кол-во ламп: 1
- - цоколь: E27
- - мощность: max. 60W
- - высота: 1250
- - ширина: 275
- - выступающая часть: 275
+
+ - Бренд: = $model->brand->name ?>
+
+ getActiveProperties($category->category_id) as $group): ?>
+ - = $group->name ?> _options as $option) : ?> = $option->ValueRenderHTML ?>
+
+
+
@@ -71,7 +66,7 @@ use yii\helpers\Url;
Цена:
- 932.40
+ = $model->variant->price ?>
грн
diff --git a/frontend/views/catalog/product.php b/frontend/views/catalog/product.php
index 0b20a7f..d80ca0f 100755
--- a/frontend/views/catalog/product.php
+++ b/frontend/views/catalog/product.php
@@ -1,4 +1,23 @@
-
+params[ 'seo' ][ 'key' ] = $category->name;
+$this->params[ 'seo' ][ 'fields' ][ 'name' ] = $product->fullname;
+$this->params[ 'seo' ][ 'h1' ] = !empty( Seo::widget([ 'row' => 'h1' ]) ) ? Seo::widget([ 'row' => 'h1' ]) : $product->fullname;
+$this->title = $product->fullname;
+
+$this->params[ 'breadcrumbs' ][] = [
+ 'label' => $category->name,
+ 'url' => [
+ 'catalog/category',
+ 'category' => $category,
+ ],
+];
+$this->params[ 'breadcrumbs' ][] = $product->fullname . ' #' . $product->enabledVariants[ 0 ]->sku;
+?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
- люстра
- Elstead
-
- Код: FE/LEILA6
+ = Seo::widget([ 'row' => 'h1' ]) ?>
+ Код:= $product->variant->sku?>
@@ -191,52 +49,27 @@
-
- -
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
-
+ images)) :?>
+
+
+
+
-
-
@@ -278,26 +111,19 @@
-
- 35845.2
- UAH
- грн.
-
+
+ variant->price;?>
+
+ UAH
+ грн.
+
|
-
-
-
-
-
- Купить светильник
-
-
-
+ Купить
@@ -401,11 +227,10 @@
-
-
- 35845.2
+
+ = $product->variant->price ?>
грн.
-
+
@@ -413,7 +238,7 @@
|
+
+
+
+
+
+
+
+ Цена:
+ 25794.00 грн
+
+
+
+
+
+
+
+
+
-
-
-
- |
-
- 6
- x
- |
+
+
+
+
+
+
+
+ Цена:
+ 14330.40 грн
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+ Цена:
+ 8598.00 грн
+
+
+
+
+
-
-
-
-
- |
-
- E14
- |
-
-
-
-
-
-
-
-
-
-
-
-
-
- |
-
- 60W
- |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- |
-
- 220 В
- |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- |
-
- 686 мм
- |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- |
-
- 705 мм
- |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- |
-
- Burnished Silver
- |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- |
-
- Feiss
- |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -->
-
-
-
-
- ID |
- 5892 |
-
-
- Бренд |
-
- Elstead
- |
-
-
- Артикул |
- FE/LEILA6 |
-
-
- кол-во ламп | 6 |
-
-
-
- цоколь | E14 |
-
-
-
- мощность | 60W |
-
-
-
- напряжение | 220 В |
-
-
-
- высота | 686 мм |
-
-
-
- ширина | 705 мм |
-
-
-
- цвет | Burnished Silver |
-
-
-
- коллекция | Feiss |
-
-
-
-
-
-
-
- Особенности
-
-
-
-
-
-
-  |
-
-
-
-
-
-
-
- Расположение
-
-
-
-
-
- Серия
-
-
-
-
-
-
-
-
- [ Описание отсутствует ]
-
-
-
-
-
-
-
-
-
- Коллекция светильников
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Цена:
- 25794.00 грн
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Цена:
- 14330.40 грн
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Цена:
- 8598.00 грн
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
@@ -1539,45 +604,6 @@
-
-
-
diff --git a/frontend/views/catalog/products.php b/frontend/views/catalog/products.php
index e2defb3..035bb88 100755
--- a/frontend/views/catalog/products.php
+++ b/frontend/views/catalog/products.php
@@ -3,9 +3,21 @@
* @var $productProvider \yii\data\ActiveDataProvider
* @var View $this
*/
-use frontend\widgets\FilterWidget;
+ use frontend\widgets\FilterWidget;
+use frontend\widgets\Seo;
+use yii\helpers\Url;
use yii\web\View;
use yii\widgets\ListView;
+ $this->params['seo']['title'] = !empty($category->meta_title) ? $category->meta_title : '';
+
+ $this->params['seo']['fields']['meta-title'] = $category->meta_title;
+ $this->params['seo']['h1'] = !empty($category->h1) ? $category->h1 : $category->name;
+ $this->params['seo']['seo_text'] = $category->seo_text;
+ $this->params['seo']['description'] = $category->meta_desc;
+ $this->params['seo']['meta'] = $category->meta_robots;
+ $this->params['seo']['category_name'] = $category->name;
+
+ $this->params['breadcrumbs'][] = $category->name;
?>
@@ -292,30 +304,8 @@ use frontend\widgets\FilterWidget;
-
-
-
@@ -465,7 +455,7 @@ use frontend\widgets\FilterWidget;
-
Красивые люстры
+
= Seo::widget([ 'row'=>'h1'])?>
@@ -487,6 +477,7 @@ use frontend\widgets\FilterWidget;
- Сортировка:
+
-
от дорогих
@@ -557,7 +548,12 @@ use frontend\widgets\FilterWidget;
= ListView::widget([
'dataProvider' => $productProvider,
- 'itemView' => '_product_item',
+ 'itemView' => function ($model, $key, $index, $widget) use($category) {
+ return $this->render('_product_item',[
+ 'model' => $model,
+ 'category' => $category
+ ]);
+ },
'layout' => "{items}{pager}",
])
@@ -613,25 +609,3 @@ use frontend\widgets\FilterWidget;
-
-
-
-
diff --git a/frontend/views/layouts/main.php b/frontend/views/layouts/main.php
index fb3278c..1faa43b 100755
--- a/frontend/views/layouts/main.php
+++ b/frontend/views/layouts/main.php
@@ -1,8 +1,11 @@
render('main-menu')?>
+
+
+
+
+ = Breadcrumbs::widget ([
+ 'homeLink' => ['label' => 'Интернет-магазин светильников', 'url' => Url::to(['/']),'itemprop' => 'url', ],
+ 'itemTemplate' => "
{link}\n", // template for all links
+ 'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
+ ])
+ ?>
+
+
+
+
+
= $content ?>
+
+
@@ -880,89 +901,14 @@ AppAsset::register($this);
-
-
-
-
-
endBody () ?>