Commit d0c66642bfb475d1a14f46c7505a01740708832c

Authored by Yarik
1 parent 01799a55

Namespaces

behaviors/ArtBoxAccessBehavior.php
1 1 <?php
2 2  
3   - namespace common\behaviors;
  3 + namespace artweb\artbox\behaviors;
4 4  
5 5 use Yii;
6 6 use yii\base\Action;
... ...
behaviors/ImageBehavior.php
1 1 <?php
2 2  
3   - namespace common\behaviors;
  3 + namespace artweb\artbox\behaviors;
4 4  
5 5 use yii\base\Behavior;
6 6 use yii\base\Event;
... ... @@ -8,7 +8,7 @@
8 8  
9 9 /**
10 10 * Class ImageBehavior
11   - * @package common\behaviors
  11 + * @package artweb\artbox\behaviors
12 12 */
13 13 class ImageBehavior extends Behavior
14 14 {
... ...
behaviors/MultipleImgBehavior.php
1 1 <?php
2 2  
3   - namespace common\behaviors;
  3 + namespace artweb\artbox\behaviors;
4 4  
5   - use common\components\artboximage\ArtboxImageHelper;
  5 + use artweb\artbox\components\artboximage\ArtboxImageHelper;
6 6 use yii\base\Behavior;
7 7 use yii\db\ActiveRecord;
8 8 use yii\helpers\Url;
... ... @@ -13,7 +13,7 @@
13 13 * @property ActiveRecord $owner
14 14 * @property ActiveRecord $image
15 15 * @property ActiveRecord[] $images
16   - * @package common\behaviors
  16 + * @package artweb\artbox\behaviors
17 17 */
18 18 class MultipleImgBehavior extends Behavior
19 19 {
... ...
behaviors/SaveImgBehavior.php
1 1 <?php
2 2  
3   - namespace common\behaviors;
  3 + namespace artweb\artbox\behaviors;
4 4  
5 5 use yii\base\Behavior;
6 6 use yii\base\ModelEvent;
... ... @@ -10,7 +10,7 @@
10 10 /**
11 11 * Class Save Image Behavior
12 12 * @property ActiveRecord $owner
13   - * @package common\behaviors
  13 + * @package artweb\artbox\behaviors
14 14 */
15 15 class SaveImgBehavior extends Behavior
16 16 {
... ...
behaviors/SaveMultipleFileBehavior.php
1 1 <?php
2 2  
3   - namespace common\behaviors;
  3 + namespace artweb\artbox\behaviors;
4 4  
5 5 use yii\base\Behavior;
6 6 use yii\base\Event;
... ... @@ -12,7 +12,7 @@
12 12 *
13 13 * @todo Write validators
14 14 *
15   - * @package common\behaviors
  15 + * @package artweb\artbox\behaviors
16 16 */
17 17 class SaveMultipleFileBehavior extends Behavior
18 18 {
... ...
behaviors/Slug.php
1 1 <?php
2 2  
3   - namespace common\behaviors;
  3 + namespace artweb\artbox\behaviors;
4 4  
5 5 use yii;
6 6 use yii\base\Behavior;
7 7 use yii\db\ActiveRecord;
8   - use dosamigos\transliterator\TransliteratorHelper;
9 8  
10 9 class Slug extends Behavior
11 10 {
... ...
components/SmsSender.php
1 1 <?php
2   -namespace common\components;
  2 +namespace artweb\artbox\components;
3 3  
4 4 use yii\base\Component;
5 5  
... ...
components/artboximage/ArtboxImage.php
1 1 <?php
2 2  
3   - namespace common\components\artboximage;
  3 + namespace artweb\artbox\components\artboximage;
4 4  
5 5 use yii\base\Component;
6 6 use yii\base\ErrorException;
... ...
components/artboximage/ArtboxImageHelper.php
1 1 <?php
2 2  
3   - namespace common\components\artboximage;
  3 + namespace artweb\artbox\components\artboximage;
4 4  
5 5 use Yii;
6 6 use yii\base\Object;
... ... @@ -22,7 +22,7 @@
22 22 /**
23 23 * Get image manipulation driver
24 24 *
25   - * @return \common\components\artboximage\ArtboxImage
  25 + * @return \artweb\artbox\components\artboximage\ArtboxImage
26 26 */
27 27 public static function getDriver()
28 28 {
... ...
components/artboxtree/ArtboxTreeBehavior.php
1 1 <?php
2 2  
3   -namespace common\components\artboxtree;
  3 +namespace artweb\artbox\components\artboxtree;
4 4  
5 5 use yii\base\Behavior;
6 6 use yii\base\Exception;
... ...
components/artboxtree/ArtboxTreeHelper.php
1 1 <?php
2 2  
3   -namespace common\components\artboxtree;
  3 +namespace artweb\artbox\components\artboxtree;
4 4  
5 5 use yii\base\Object;
6 6 use yii\helpers\ArrayHelper;
... ...
components/artboxtree/ArtboxTreeQueryTrait.php
1 1 <?php
2 2  
3   - namespace common\components\artboxtree;
  3 + namespace artweb\artbox\components\artboxtree;
4 4  
5 5 trait ArtboxTreeQueryTrait
6 6 {
... ...
components/artboxtree/ArtboxTreeWidget.php
1 1 <?php
2 2  
3   -namespace common\components\artboxtree;
  3 +namespace artweb\artbox\components\artboxtree;
4 4  
5 5 use Yii;
6 6 use yii\base\Widget;
... ...
components/artboxtree/treegrid/TreeGridColumn.php
1 1 <?php
2 2  
3   -namespace common\components\artboxtree\treegrid;
  3 +namespace artweb\artbox\components\artboxtree\treegrid;
4 4  
5 5 use Closure;
6   -use Yii;
7 6 use yii\base\Model;
8 7 use yii\base\Object;
9 8 use yii\data\ActiveDataProvider;
... ...
components/artboxtree/treegrid/TreeGridWidget.php
1 1 <?php
2 2  
3   -namespace common\components\artboxtree\treegrid;
  3 +namespace artweb\artbox\components\artboxtree\treegrid;
4 4  
5   -use common\modules\rubrication\models\TaxOption;
  5 +use artweb\artbox\ecommerce\models\TaxOption;
6 6 use Yii;
7 7 use yii\helpers\Html;
8 8 use yii\helpers\ArrayHelper;
9 9  
10   -class TreeGridWidget extends \common\components\artboxtree\ArtboxTreeWidget {
  10 +class TreeGridWidget extends \artweb\artbox\components\artboxtree\ArtboxTreeWidget {
11 11  
12 12 /**
13 13 * @var array grid column configuration. Each array element represents the configuration
... ...
components/artboxtree/treelist/TreeListWidget.php
1 1 <?php
2 2  
3   -namespace common\components\artboxtree\treelist;
  3 +namespace artweb\artbox\components\artboxtree\treelist;
4 4  
5   -use Yii;
6 5 use yii\helpers\Html;
7 6 use yii\helpers\ArrayHelper;
8 7  
9   -class TreeListWidget extends \common\components\artboxtree\ArtboxTreeWidget {
  8 +class TreeListWidget extends \artweb\artbox\components\artboxtree\ArtboxTreeWidget {
10 9  
11 10 public $displayField = 'title';
12 11  
... ...
components/artboxtree/treemenu/TreeMenuWidget.php
1 1 <?php
2 2  
3   -namespace common\components\artboxtree\treemenu;
  3 +namespace artweb\artbox\components\artboxtree\treemenu;
4 4  
5   -use Yii;
6 5 use yii\helpers\Html;
7 6 use yii\helpers\ArrayHelper;
8 7  
9   -class TreeMenuWidget extends \common\components\artboxtree\ArtboxTreeWidget {
  8 +class TreeMenuWidget extends \artweb\artbox\components\artboxtree\ArtboxTreeWidget {
10 9  
11 10 public $displayField = 'title';
12 11  
... ...
composer.json
... ... @@ -5,7 +5,18 @@
5 5 "require": {
6 6 "php": ">=7.0",
7 7 "yiisoft/yii2": "*",
8   - "developeruz/yii2-db-rbac": "*"
  8 + "developeruz/yii2-db-rbac": "*",
  9 + "yurkinx/yii2-image": "dev-master",
  10 + "artweb/artbox-ecommerce": "dev-master",
  11 + "artweb/artbox-language": "dev-master",
  12 + "kartik-v/yii2-widget-select2": "@dev",
  13 + "kartik-v/yii2-grid": "@dev",
  14 + "kartik-v/yii2-mpdf": "@dev",
  15 + "kartik-v/yii2-widget-fileinput": "@dev",
  16 + "mihaildev/yii2-ckeditor": "*",
  17 + "mihaildev/yii2-elfinder": "^1.1",
  18 + "kartik-v/yii2-widget-colorinput": "*",
  19 + "kartik-v/yii2-widget-datepicker": "*"
9 20 },
10 21 "autoload": {
11 22 "psr-4": {
... ...
console/GenerateController.php deleted
1   -<?php
2   -
3   - namespace console\controllers;
4   -
5   - use common\modules\product\models\Brand;
6   - use common\modules\product\models\Category;
7   - use common\modules\product\models\Product;
8   - use common\modules\product\models\ProductVariant;
9   - use common\modules\rubrication\models\TaxGroup;
10   - use common\modules\rubrication\models\TaxOption;
11   - use Faker\Factory;
12   - use Faker\Generator;
13   - use yii\console\Controller;
14   - use yii\helpers\Console;
15   -
16   - /**
17   - * Class GenerateController to generate ArtBox fake data
18   - *
19   - * @package console\controllers
20   - */
21   - class GenerateController extends Controller
22   - {
23   - /**
24   - * Faker Generator locales
25   - *
26   - * @var array
27   - */
28   - private $locales = [
29   - 2 => 'ru_RU',
30   - 3 => 'uk_UA',
31   - ];
32   -
33   - /**
34   - * Faker Generators instances
35   - *
36   - * @var Generator[] $fakers
37   - */
38   - private $fakers = [];
39   -
40   - /**
41   - * Create faker Generators for all $locales
42   - *
43   - * @param \yii\base\Action $action
44   - *
45   - * @return bool
46   - */
47   - public function beforeAction($action)
48   - {
49   - $parent = parent::beforeAction($action);
50   - $fakers = [];
51   - foreach ($this->locales as $locale_id => $locale) {
52   - $fakers[ $locale_id ] = Factory::create($locale);
53   - }
54   - $this->fakers = $fakers;
55   - return $parent;
56   - }
57   -
58   - /**
59   - * Generate fake Brands
60   - *
61   - * @param int $count Brands count
62   - *
63   - * @return int
64   - */
65   - public function actionBrand(int $count = 10): int
66   - {
67   - /**
68   - * @var Brand[] $models
69   - */
70   - $models = [];
71   - $fakers = $this->fakers;
72   - for ($i = 0; $i < $count; $i++) {
73   - $models[ $i ] = \Yii::createObject(Brand::className());
74   - $models[ $i ]->generateLangs();
75   - foreach ($models[ $i ]->modelLangs as $language_id => $modelLang) {
76   - $modelLang->title = $fakers[ $language_id ]->company;
77   - }
78   - if ($models[ $i ]->save() && $models[ $i ]->transactionStatus) {
79   - $title = $this->ansiFormat($models[ $i ]->modelLangs[ 2 ]->title, Console::FG_YELLOW);
80   - $id = $this->ansiFormat($models[ $i ]->id, Console::FG_YELLOW);
81   - echo "Brand '$title' inserted under $id ID.\n";
82   - };
83   - }
84   - return 0;
85   - }
86   -
87   - /**
88   - * Generate fake categories
89   - *
90   - * @param int $count Category count
91   - *
92   - * @return int
93   - */
94   - public function actionCategory(int $count = 10):int
95   - {
96   - /**
97   - * @var Category[] $models
98   - */
99   - $models = [];
100   - $fakers = $this->fakers;
101   - for ($i = 0; $i < $count; $i++) {
102   - $models[ $i ] = \Yii::createObject(
103   - [
104   - 'class' => Category::className(),
105   - 'depth' => 0,
106   - 'parent_id' => 0,
107   - ]
108   - );
109   - $models[ $i ]->generateLangs();
110   - foreach ($models[ $i ]->modelLangs as $language_id => $modelLang) {
111   - $modelLang->title = ucfirst($fakers[ $language_id ]->word);
112   - }
113   - if ($models[ $i ]->save() && $models[ $i ]->transactionStatus) {
114   - $title = $this->ansiFormat($models[ $i ]->modelLangs[ 2 ]->title, Console::FG_YELLOW);
115   - $id = $this->ansiFormat($models[ $i ]->id, Console::FG_YELLOW);
116   - echo "Category '$title' inserted under $id ID.\n";
117   - };
118   - }
119   - return 0;
120   - }
121   -
122   - /**
123   - * Generate fake products with variants, categories and tax options
124   - *
125   - * @param int $count Product count
126   - *
127   - * @return int
128   - */
129   - public function actionProduct(int $count = 10):int
130   - {
131   - /**
132   - * @var Product[] $models
133   - */
134   - $models = [];
135   - $fakers = $this->fakers;
136   - $brands = Brand::find()
137   - ->limit(20)
138   - ->asArray()
139   - ->column();
140   - $categories = Category::find()
141   - ->limit(100)
142   - ->asArray()
143   - ->column();
144   - $product_options = TaxOption::find()
145   - ->joinWith('taxGroup')
146   - ->where([ 'tax_group.level' => TaxGroup::GROUP_PRODUCT ])
147   - ->limit(50)
148   - ->asArray()
149   - ->column();
150   - $variant_options = TaxOption::find()
151   - ->joinWith('taxGroup')
152   - ->where([ 'tax_group.level' => TaxGroup::GROUP_VARIANT ])
153   - ->limit(50)
154   - ->asArray()
155   - ->column();
156   - for ($i = 0; $i < $count; $i++) {
157   - $models[ $i ] = \Yii::createObject(
158   - [
159   - 'class' => Product::className(),
160   - 'brand_id' => $fakers[ 2 ]->randomElement($brands),
161   - ]
162   - );
163   - $models[ $i ]->setCategories(
164   - $fakers[ 2 ]->randomElements($categories, $fakers[ 2 ]->randomDigitNotNull)
165   - );
166   - $models[ $i ]->setOptions(
167   - $fakers[ 2 ]->randomElements($product_options, $fakers[ 2 ]->randomDigitNotNull)
168   - );
169   - $models[ $i ]->generateLangs();
170   - foreach ($models[ $i ]->modelLangs as $language_id => $modelLang) {
171   - $modelLang->title = ucfirst($fakers[ $language_id ]->word);
172   - }
173   - if ($models[ $i ]->save() && $models[ $i ]->transactionStatus) {
174   - $title = $this->ansiFormat($models[ $i ]->modelLangs[ 2 ]->title, Console::FG_YELLOW);
175   - $id = $this->ansiFormat($models[ $i ]->id, Console::FG_YELLOW);
176   - echo "Product '$title' inserted under $id ID.\n";
177   - $variant_count = $fakers[ 2 ]->numberBetween(4, 10);
178   - for ($j = 0; $j < $variant_count; $j++) {
179   - /**
180   - * @var ProductVariant $variant
181   - */
182   - $variant = \Yii::createObject(
183   - [
184   - 'class' => ProductVariant::className(),
185   - 'product_id' => $models[ $i ]->id,
186   - 'sku' => $fakers[ 2 ]->uuid,
187   - 'price' => $fakers[ 2 ]->randomFloat(2, 100, 10000),
188   - 'stock' => 10,
189   - 'product_unit_id' => 1,
190   - ]
191   - );
192   - $variant->setOptions(
193   - $fakers[ 2 ]->randomElements($variant_options, $fakers[ 2 ]->randomDigitNotNull)
194   - );
195   - $variant->generateLangs();
196   - foreach ($variant->modelLangs as $variant_language_id => $variantLang) {
197   - $variantLang->title = ucfirst($fakers[ $variant_language_id ]->word);
198   - }
199   - if ($variant->save() && $variant->transactionStatus) {
200   - $variant_title = $this->ansiFormat($variant->modelLangs[ 2 ]->title, Console::FG_YELLOW);
201   - $variant_id = $this->ansiFormat($variant->id, Console::FG_YELLOW);
202   - echo "Variant '$variant_title' inserted under $variant_id ID for product $title.\n";
203   - }
204   - }
205   - };
206   - }
207   - return 0;
208   - }
209   -
210   - /**
211   - * Generate fake tax groups with tax options.
212   - *
213   - * @param int $count_product Tax Groups for Product
214   - * @param int $count_variant Tax Groups for ProductVariant
215   - *
216   - * @return int
217   - */
218   - public function actionTax(int $count_product = 10, int $count_variant = 10):int
219   - {
220   - $categories = Category::find()
221   - ->asArray()
222   - ->column();
223   - $this->generateTax(TaxGroup::GROUP_PRODUCT, $count_product, $categories);
224   - $this->generateTax(TaxGroup::GROUP_VARIANT, $count_variant, $categories);
225   - return 0;
226   - }
227   -
228   - /**
229   - * Generates tax groups amd tax options for actionTax
230   - *
231   - * @param int $level Tax Group for Product or ProductVariant
232   - * @param int $count Tax Group count
233   - * @param array $categories Categories for Tax Groups
234   - *
235   - * @see GenerateController::actionTax()
236   - */
237   - private function generateTax(int $level, int $count, array $categories = [])
238   - {
239   - $count_option = 10;
240   - $fakers = $this->fakers;
241   - /**
242   - * @var TaxGroup[] $models
243   - */
244   - $models = [];
245   - for ($i = 0; $i < $count; $i++) {
246   - $models[ $i ] = \Yii::createObject(
247   - [
248   - 'class' => TaxGroup::className(),
249   - 'is_filter' => true,
250   - 'display' => true,
251   - ]
252   - );
253   - $models[ $i ]->level = $level;
254   - $models[ $i ]->setCategories($categories);
255   - $models[ $i ]->generateLangs();
256   - foreach ($models[ $i ]->modelLangs as $language_id => $modelLang) {
257   - $modelLang->title = ucfirst($fakers[ $language_id ]->word);
258   - }
259   - if ($models[ $i ]->save() && $models[ $i ]->transactionStatus) {
260   - for ($j = 0; $j < $count_option; $j++) {
261   - /**
262   - * @var TaxOption $option
263   - */
264   - $option = \Yii::createObject(
265   - TaxOption::className()
266   - );
267   - $option->tax_group_id = $models[ $i ]->id;
268   - $option->generateLangs();
269   - foreach ($option->modelLangs as $option_language_id => $taxOptionLang) {
270   - $taxOptionLang->value = ucfirst($fakers[ $option_language_id ]->word);
271   - }
272   - $option->save();
273   - }
274   - $title = $this->ansiFormat($models[ $i ]->modelLangs[ 2 ]->title, Console::FG_YELLOW);
275   - $id = $this->ansiFormat($models[ $i ]->id, Console::FG_YELLOW);
276   - $element = $this->ansiFormat(
277   - ( $level === TaxGroup::GROUP_PRODUCT ) ? 'Product' : 'Variant',
278   - Console::FG_RED
279   - );
280   - echo "Category '$title' inserted for $element under $id ID.\n";
281   - };
282   - }
283   - }
284   - }
285   -
286 0 \ No newline at end of file
console/ImportController.php deleted
1   -<?php
2   -
3   -namespace console\controllers;
4   -
5   -use common\modules\product\models\Import;
6   -use Yii;
7   -use yii\console\Controller;
8   -
9   -class ImportController extends Controller {
10   - public $errors = [];
11   -
12   -
13   - private function getProductsFile($file_type = 'uploadFileProducts') {
14   - $filename = Yii::getAlias('@uploadDir') .'/'. Yii::getAlias('@'. $file_type);
15   - if (!is_file($filename)) {
16   - $this->stderr('Task already executed');
17   - return Controller::EXIT_CODE_ERROR;
18   - }
19   - return fopen ($filename, 'r');
20   - }
21   -
22   - public function actionProducts() {
23   -// if (file_exists(Yii::getAlias('@uploadDir/goProducts.lock'))) {
24   -// $this->errors[] = 'Task already executed';
25   -// return Controller::EXIT_CODE_ERROR;
26   -// }
27   -// $ff = fopen(Yii::getAlias('@uploadDir/goProducts.lock'), 'w+');
28   -// fclose($ff);
29   - $model = new Import();
30   - $model->goProducts(0, null);
31   -// unlink(Yii::getAlias('@uploadDir/goProducts.lock'));
32   - return Controller::EXIT_CODE_NORMAL;
33   - }
34   -
35   - public function actionPrices() {
36   - if (file_exists(Yii::getAlias('@uploadDir/goPrices.lock'))) {
37   - $this->stderr('Task already executed');
38   - return Controller::EXIT_CODE_ERROR;
39   - }
40   - $ff = fopen(Yii::getAlias('@uploadDir/goPrices.lock'), 'w+');
41   - fclose($ff);
42   - $model = new Import();
43   - $data = $model->goPrices(0, null);
44   - unlink(Yii::getAlias('@uploadDir/goPrices.lock'));
45   - return Controller::EXIT_CODE_NORMAL;
46   - }
47   -
48   - private function saveNotFoundRecord (array $line, $filename)
49   - {
50   - $str = implode (';', $line)."\n";
51   - $str = iconv ("UTF-8//TRANSLIT//IGNORE", "windows-1251", $str);
52   -
53   - $fg = fopen (Yii::getAlias('@uploadDir') .'/'. $filename, 'a+');
54   - fputs ($fg, $str);
55   - fclose ($fg);
56   - }
57   -}
58 0 \ No newline at end of file
console/SiteMapController.php deleted
1   -<?php
2   -
3   -namespace console\controllers;
4   -
5   -use common\models\Article;
6   -use common\models\Seo;
7   -use common\modules\product\models\Category;
8   -use common\modules\product\models\Product;
9   -use frontend\models\ProductFrontendSearch;
10   -use Yii;
11   -use common\models\Page;
12   -use yii\helpers\ArrayHelper;
13   -use yii\helpers\Url;
14   -use yii\console\Controller;
15   -/**
16   - * PageController implements the CRUD actions for Page model.
17   - */
18   -class SiteMapController extends Controller
19   -{
20   -
21   - private $urlList = ['http://www.rukzachok.com.ua/'];
22   - private $count = 1;
23   -
24   -
25   -
26   - public function checkFilter($category, $filter){
27   - $productModel = new ProductFrontendSearch();
28   - $productProvider = $productModel->search($category, $filter);
29   - if(!empty($productProvider->models)){
30   - return true;
31   - } else {
32   - return false;
33   - }
34   - }
35   -
36   -
37   -
38   - public function getAddStatic(){
39   - return [
40   - 'http://www.rukzachok.com.ua',
41   - 'http://www.rukzachok.com.ua/catalog'
42   - ];
43   - }
44   -
45   -
46   - public function getProducts() {
47   - return Product::find()->all();
48   -
49   - }
50   -
51   -
52   - public function getSeoLinks() {
53   - return Seo::find()->where(['meta' => ''])->all();
54   -
55   - }
56   -
57   - public function getStaticPages(){
58   - return Page::find()->all();
59   - }
60   -
61   -
62   - public function getCategories(){
63   - return Category::find()->all();
64   - }
65   -
66   -
67   - public function getArticles(){
68   - return Article::find()->all();
69   - }
70   -
71   - public function getBrands($category){
72   -
73   - return $category->brands;
74   - }
75   -
76   - /**
77   - * @param $category Category;
78   - * @return mixed
79   - */
80   -
81   - public function getFilters($category){
82   -
83   - return $category->getActiveFilters()->all();
84   -
85   - }
86   -
87   -
88   - public function checkUrl($url){
89   - if(!in_array($url, $this->urlList)){
90   - $this->urlList[] = $url;
91   - return true;
92   - } else {
93   - return false;
94   - }
95   - }
96   -
97   -
98   - public function createRow( $url, $priority, &$content ){
99   - if($this->checkUrl($url)){
100   - print $this->count++ . "\n";
101   - $content .= '<url>' .
102   - '<loc>' . $url . '</loc>' .
103   - '<lastmod>' . date('Y-m-d') . '</lastmod>' .
104   - '<changefreq>Daily</changefreq>' .
105   - '<priority>' . $priority .'</priority>' .
106   - '</url>';
107   - }
108   - }
109   -
110   -
111   - public function actionProcess() {
112   -
113   - $config = ArrayHelper::merge(
114   - require(__DIR__ . '/../../frontend/config/main.php'),
115   - require(__DIR__ . '/../../common/config/main.php')
116   -
117   - );
118   -
119   - Yii::$app->urlManager->addRules($config['components']['urlManager']['rules']);
120   -
121   -
122   -
123   - $dirName = Yii::getAlias('@frontend').'/web';
124   -
125   - $filename = 'sitemap.xml';
126   -
127   - setlocale(LC_ALL, 'ru_RU.CP1251');
128   - $handle = fopen($dirName .'/'. $filename, "w");
129   -
130   - $content = '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
131   -
132   - foreach ($this->getAddStatic() as $page) {
133   - $this->createRow($page , 1,$content);
134   - }
135   -
136   - foreach ($this->getStaticPages() as $page) {
137   - $url = Url::to(['text/index','translit' => $page->translit]);
138   - $this->createRow($url , 1,$content);
139   - }
140   -
141   - foreach ($this->getCategories() as $category) {
142   - $url = Url::to(['catalog/category', 'category' => $category]);
143   - $this->createRow($url , 1,$content);
144   - }
145   -
146   -
147   - foreach ($this->getProducts() as $product) {
148   -
149   - $url = Url::to(['catalog/product', 'product' => $product]);
150   - $this->createRow($url , 0.9, $content);
151   - }
152   -
153   -
154   - foreach ($this->getArticles() as $article) {
155   -
156   - $url = Url::to(['articles/show', 'translit' => $article->translit, 'id' => $article->id,]);
157   - $this->createRow($url , 0.8,$content);
158   -
159   - }
160   -
161   -
162   - foreach($this->getCategories() as $category){
163   - foreach ($this->getBrands($category) as $brand) {
164   - if($this->checkFilter($category, ['brands' => [$brand->id]])){
165   - $url = Url::to(['catalog/category', 'category' => $category, 'filters' => ['brands' => [$brand->alias]]]) ;
166   - $this->createRow($url , 0.8, $content);
167   - }
168   - }
169   - }
170   -
171   -
172   - foreach($this->getCategories() as $category){
173   - foreach ($this->getFilters($category) as $filter) {
174   - if($this->checkFilter($category, [$filter['group_alias'] => [$filter['option_alias']]])){
175   - $url = Url::to(['catalog/category', 'category' => $category, 'filters' => [$filter['group_alias'] => [$filter['option_alias']]] ]);
176   - $this->createRow($url , 0.8, $content);
177   - }
178   -
179   - }
180   - }
181   -
182   - foreach($this->getSeoLinks() as $link){
183   - $url = Yii::$app->urlManager->baseUrl.$link->url;
184   - $this->createRow($url , 0.7, $content);
185   -
186   - }
187   -
188   -
189   -
190   -// foreach($this->getCategories() as $category){
191   -// foreach ($this->getFilters($category) as $filter1) {
192   -// foreach ($this->getFilters($category) as $filter2) {
193   -// if($this->checkFilter($category, [$filter1['group_alias'] => [$filter1['option_alias']],$filter2['group_alias'] => [$filter2['option_alias']]] )){
194   -// $url = Url::to(['catalog/category', 'category' => $category, 'filters' => [$filter1['group_alias'] => [$filter1['option_alias']],$filter2['group_alias'] => [$filter2['option_alias']]] ]);
195   -// $this->createRow($url , 0.7, $content);
196   -// }
197   -//
198   -// }
199   -//
200   -// foreach ($this->getBrands($category) as $brand) {
201   -// if($this->checkFilter($category, ['brands' => [$brand->id], $filter1['group_alias'] => [$filter1['option_alias']]] )){
202   -// $url = Url::to(['catalog/category', 'category' => $category, 'filters' => ['brands' => [$brand->alias],$filter1['group_alias'] => [$filter1['option_alias']]]]);
203   -// $this->createRow($url , 0.7,$content);
204   -// }
205   -//
206   -// }
207   -// }
208   -// }
209   -
210   -
211   -
212   - $content .= '</urlset>';
213   -
214   - fwrite($handle, $content);
215   - fclose($handle);
216   -
217   - print $dirName .'/'. $filename;
218   - }
219   -
220   -}
models/Customer.php
1 1 <?php
2 2  
3   - namespace common\models;
  3 + namespace artweb\artbox\models;
4 4  
  5 + use common\models\User;
5 6 use Yii;
6 7 use yii\web\IdentityInterface;
7 8  
... ...
models/CustomerSearch.php
1 1 <?php
2 2  
3   - namespace common\models;
  3 + namespace artweb\artbox\models;
4 4  
5 5 use yii\base\Model;
6 6 use yii\data\ActiveDataProvider;
7 7  
8 8 /**
9   - * CustomerSearch represents the model behind the search form about `common\models\Customer`.
  9 + * CustomerSearch represents the model behind the search form about `artweb\artbox\models\Customer`.
10 10 */
11 11 class CustomerSearch extends Customer
12 12 {
... ...
models/Feedback.php
1 1 <?php
2 2  
3   - namespace common\models;
  3 + namespace artweb\artbox\models;
4 4  
5 5 use Yii;
6 6 use yii\behaviors\AttributeBehavior;
... ...
models/FeedbackSearch.php
1 1 <?php
2 2  
3   - namespace common\models;
  3 + namespace artweb\artbox\models;
4 4  
5 5 use yii\data\ActiveDataProvider;
6 6  
... ...
models/Page.php
1 1 <?php
2 2  
3   - namespace common\models;
  3 + namespace artweb\artbox\models;
4 4  
5   - use common\modules\language\behaviors\LanguageBehavior;
  5 + use artweb\artbox\language\behaviors\LanguageBehavior;
6 6 use yii\db\ActiveQuery;
7 7 use yii\db\ActiveRecord;
8 8 use yii\web\Request;
... ...
models/PageLang.php
1 1 <?php
2 2  
3   - namespace common\models;
  3 + namespace artweb\artbox\models;
4 4  
5   - use common\modules\language\models\Language;
  5 + use artweb\artbox\language\models\Language;
6 6 use Yii;
7 7 use yii\db\ActiveRecord;
8 8  
... ... @@ -45,7 +45,7 @@
45 45 {
46 46 return [
47 47 'slug' => [
48   - 'class' => 'common\behaviors\Slug',
  48 + 'class' => 'artweb\artbox\behaviors\Slug',
49 49 ],
50 50 ];
51 51 }
... ...
models/PageSearch.php
1 1 <?php
2 2  
3   - namespace common\models;
  3 + namespace artweb\artbox\models;
4 4  
5 5 use yii\base\Model;
6 6 use yii\data\ActiveDataProvider;
7 7  
8 8 /**
9   - * PageSearch represents the model behind the search form about `common\models\Page`.
  9 + * PageSearch represents the model behind the search form about `artweb\artbox\models\Page`.
10 10 */
11 11 class PageSearch extends Page
12 12 {
... ...