diff --git a/.htaccess b/.htaccess
index ca9eb72..0ca3c8a 100755
--- a/.htaccess
+++ b/.htaccess
@@ -131,6 +131,8 @@ AddDefaultCharset utf-8
RewriteRule sitemap.xml$ frontend/web/sitemap.xml [L]
+ RewriteRule price.xml$ frontend/web/price.xml [L]
+
RewriteRule feed.csv$ frontend/web/feed.csv [L]
RewriteCond %{REQUEST_URI} !^/(frontend|backend)/web/(assets|css|txt|js|images|fonts|img|files)/
diff --git a/console/controllers/PriceController.php b/console/controllers/PriceController.php
new file mode 100644
index 0000000..966558e
--- /dev/null
+++ b/console/controllers/PriceController.php
@@ -0,0 +1,176 @@
+request->get('count', false);
+
+ $categories = Category::find()->all();
+
+ $this->stdout('Start!' . "\n", Console::FG_RED);
+
+// set_time_limit(0);
+// header("Content-Type: text/xml");
+// $contentOfPriceXML .= '';
+ $contentOfPriceXML .= "";
+ $contentOfPriceXML .= "" . date("Y-m-d h:m") . "";
+ $contentOfPriceXML .= "www.linija-svitla.ua";
+ $contentOfPriceXML .= "";
+ $contentOfPriceXML .= "";
+ $contentOfPriceXML .= "";
+
+ foreach ($categories as $category) {
+ $contentOfPriceXML .= "";
+ $contentOfPriceXML .= "" . $category->category_id . "";
+ $contentOfPriceXML .= "" . $category->name . "";
+ $contentOfPriceXML .= "";
+ }
+ $contentOfPriceXML .= "";
+
+ $contentOfPriceXML .= "";
+
+ foreach ($categories as $category) {
+
+ $this->stdout("in Process category"."\n", Console::FG_BLUE);
+
+ $products = $category->getProducts()
+ ->with(
+ [
+// 'filters',
+ 'filters.group'
+ ]
+ )
+ ->joinWith('variant')
+ ->where([ 'product_variant.status' => 0 ])
+ ->andWhere('product_variant.stock<>0')
+ ->andWhere('product_variant.price<>0')
+ ->all();
+
+// if ($is_count) {
+ $contentOfPriceXML .= ( count($products) );
+// continue;
+// }
+
+ /** @var Product $product */
+
+ foreach ($products as $product) {
+ /**
+ * Fix for emty brands 14.03.2017
+ */
+
+ $this->stdout("in Process product"."\n", Console::FG_GREEN);
+
+ if (empty($product->brand)) {
+ continue;
+ }
+
+ $contentOfPriceXML .= "- ";
+ $contentOfPriceXML .= "" . htmlspecialchars($product->variant->product_variant_id) . "";
+ $contentOfPriceXML .= "" . htmlspecialchars($product->category->category_id) . "";
+ $contentOfPriceXML .= "" . $product->brand->name . "";
+ $contentOfPriceXML .= "
" . htmlspecialchars($product->variant->sku) . "
";
+ $contentOfPriceXML .= "" . htmlspecialchars($product->name) . " " . htmlspecialchars(
+ $product->variant->name
+ ) . " ";
+ $contentOfPriceXML .= "" . htmlspecialchars($product->description) . "";
+ $contentOfPriceXML .= "http://www.linija-svitla.ua{$product->url}";
+ $contentOfPriceXML .= "http://www.linija-svitla.ua{$product->variant->imageUrl}";
+ $contentOfPriceXML .= "" . $product->variant->price . "";
+ $contentOfPriceXML .= "" . $product->variant->price_old . "";
+
+ $type = false;
+ foreach ($product->filters as $filter) {
+
+ if ($filter->group->name == "Тип точечного освещение:") {
+ $type = true;
+ $contentOfPriceXML .= "{$filter->name}";
+ }
+ if ($filter->group->name == "Тип настенного освещения:") {
+ $type = true;
+ $contentOfPriceXML .= "{$filter->name}";
+ }
+
+ if ($filter->group->name == "Тип потолочного освещения:") {
+ $type = true;
+ $contentOfPriceXML .= "{$filter->name}";
+ }
+
+ if ($filter->group->name == "Тип уличного освещения:") {
+ $type = true;
+ $contentOfPriceXML .= "{$filter->name}";
+ }
+
+ if ($filter->group->name == "Тип лампочки:") {
+ $type = true;
+ $contentOfPriceXML .= "{$filter->name}";
+ }
+
+ if ($filter->group->name == "Назначение:") {
+ $contentOfPriceXML .= "{$filter->name}";
+ }
+ if ($filter->group->name == "Стиль:") {
+ $contentOfPriceXML .= "{$filter->name}";
+ }
+ if ($filter->group->name == "Количество лампочек:") {
+ $contentOfPriceXML .= "{$filter->name}";
+ }
+ if ($filter->group->name == "Тип источника света:") {
+ $contentOfPriceXML .= "{$filter->name}";
+ }
+ if ($filter->group->name == "Цоколь:") {
+ $contentOfPriceXML .= "{$filter->name}";
+ }
+ //$contentOfPriceXML .= "Припотолочная";
+
+ }
+
+ if (!$type) {
+ $contentOfPriceXML .= "{$product->category->name}";
+ }
+
+ $contentOfPriceXML .= "";
+ $contentOfPriceXML .= "В наличии";
+ $contentOfPriceXML .= "";
+ $contentOfPriceXML .= " ";
+
+ }
+
+ }
+
+ //var_dump($products);die();
+
+
+
+
+ $contentOfPriceXML .= "";
+
+ $contentOfPriceXML .= "";
+
+ $this->stdout('End!' . "\n", Console::FG_RED);
+
+ $file = fopen(Yii::getAlias('@frontend/web/price.xml'), 'w+');
+ fwrite($file, $contentOfPriceXML);
+ fclose($file);
+
+ }
+ }
\ No newline at end of file
diff --git a/frontend/config/main.php b/frontend/config/main.php
index 841672f..ca7bee9 100755
--- a/frontend/config/main.php
+++ b/frontend/config/main.php
@@ -76,7 +76,7 @@ return [
'cabinet/main' => '/cabinet/main',
'priceparam.xml' => 'site/priceparam',
- 'price.xml' => 'site/price',
+// 'price.xml' => 'site/price',
'smstest' => 'site/sms',
'search/main' => 'search/main',
'news/' => 'news/show',
diff --git a/frontend/controllers/SiteController.php b/frontend/controllers/SiteController.php
index 217c56b..86f80de 100755
--- a/frontend/controllers/SiteController.php
+++ b/frontend/controllers/SiteController.php
@@ -15,6 +15,7 @@ use yii\helpers\ArrayHelper;
use yii\web\BadRequestHttpException;
use yii\web\Controller;
+use yii\web\HttpException;
use yii\web\Response;
use yii\widgets\ActiveForm;
@@ -218,148 +219,5 @@ class SiteController extends Controller
print "";
}
-
- public function actionPrice()
- {
-
-
-
- $is_count = Yii::$app->request->get('count', false);
-
- $categories = Category::find()->all();
-
- set_time_limit (0);
- header ("Content-Type: text/xml");
- print '';
- print "";
- print "" . date ("Y-m-d h:m") . "";
- print "www.linija-svitla.ua";
- print "";
- print "";
- print "";
-
- foreach($categories as $category){
- print "";
- print "" .$category->category_id . "";
- print "" . $category->name. "";
- print "";
- }
- print "";
-
-
-
-
- print "";
-
- foreach($categories as $category){
- $products = $category->getProducts()->with(['filters','filters.group'])->joinWith('variant')->where(['product_variant.status'=>0])->all();
-
- if ($is_count) {
- print (count($products));
- continue;
- }
-
- /** @var Product $product */
-
- foreach ($products as $product)
- {
- /**
- * Fix for emty brands 14.03.2017
- */
- if (empty($product->brand)) continue;
-
- print "- ";
- print "" . htmlspecialchars($product->variant->product_variant_id) . "";
- print "" . htmlspecialchars($product->category->category_id) . "";
- print "" . $product->brand->name . "";
- print "
" . htmlspecialchars($product->variant->sku) . "
";
- print "" . htmlspecialchars($product->name)." " .htmlspecialchars($product->variant->name). " ";
- print "" . htmlspecialchars($product->description) . "";
- print "http://www.linija-svitla.ua{$product->url}";
- print "http://www.linija-svitla.ua{$product->variant->imageUrl}";
- print "" . $product->variant->price . "";
- print "" . $product->variant->price_old . "";
-
- $type = false;
- foreach( $product->filters as $filter){
-
-
-
- if($filter->group->name == "Тип точечного освещение:"){
- $type = true;
- print "{$filter->name}";
- }
- if($filter->group->name == "Тип настенного освещения:"){
- $type = true;
- print "{$filter->name}";
- }
-
- if($filter->group->name == "Тип потолочного освещения:"){
- $type = true;
- print "{$filter->name}";
- }
-
-
- if($filter->group->name == "Тип уличного освещения:"){
- $type = true;
- print "{$filter->name}";
- }
-
- if($filter->group->name == "Тип лампочки:"){
- $type = true;
- print "{$filter->name}";
- }
-
-
-
-
- if($filter->group->name == "Назначение:"){
- print "{$filter->name}";
- }
- if($filter->group->name == "Стиль:"){
- print "{$filter->name}";
- }
- if($filter->group->name == "Количество лампочек:"){
- print "{$filter->name}";
- }
- if($filter->group->name == "Тип источника света:"){
- print "{$filter->name}";
- }
- if($filter->group->name == "Цоколь:"){
- print "{$filter->name}";
- }
- //print "Припотолочная";
-
- }
-
- if(!$type){
- print "{$product->category->name}";
- }
-
-
- print "";
- print "В наличии";
- print "";
- print " ";
-
-
- }
-
- }
-
-
-
-
-
-//var_dump($products);die();
-
-
-
-
- print "";
-
- print "";
-
-
- }
+
}
--
libgit2 0.21.4