Commit 43414a5da99477627dee878232594d4348eae546
1 parent
c0480183
big commti
Showing
1 changed file
with
8 additions
and
7 deletions
Show diff stats
frontend/controllers/SiteController.php
| @@ -231,7 +231,7 @@ class SiteController extends Controller | @@ -231,7 +231,7 @@ class SiteController extends Controller | ||
| 231 | throw new HttpException(404, 'Данной страницы не существует!'); | 231 | throw new HttpException(404, 'Данной страницы не существует!'); |
| 232 | } | 232 | } |
| 233 | 233 | ||
| 234 | - $products = $category->getProducts()->with(['filters','filters.group'])->all(); | 234 | + $products = $category->getProducts()->with(['filters','filters.group'])->joinWith('variant')->where(['product_variant.status'=>0])->all(); |
| 235 | 235 | ||
| 236 | if ($is_count) { | 236 | if ($is_count) { |
| 237 | print (count($products)); | 237 | print (count($products)); |
| @@ -270,15 +270,16 @@ class SiteController extends Controller | @@ -270,15 +270,16 @@ class SiteController extends Controller | ||
| 270 | print "<code>" . htmlspecialchars($product->variant->sku) . "</code>"; | 270 | print "<code>" . htmlspecialchars($product->variant->sku) . "</code>"; |
| 271 | print "<name>" . htmlspecialchars($product->name)." " .htmlspecialchars($product->variant->name). " </name>"; | 271 | print "<name>" . htmlspecialchars($product->name)." " .htmlspecialchars($product->variant->name). " </name>"; |
| 272 | print "<description>" . htmlspecialchars($product->description) . "</description>"; | 272 | print "<description>" . htmlspecialchars($product->description) . "</description>"; |
| 273 | - print "<url>http://www.linija-svitla.ua{$product->url}#{$product->variant->product_variant_id}</url>"; | 273 | + print "<url>http://www.linija-svitla.ua{$product->url}</url>"; |
| 274 | print "<image>http://www.linija-svitla.ua{$product->variant->imageUrl}</image>"; | 274 | print "<image>http://www.linija-svitla.ua{$product->variant->imageUrl}</image>"; |
| 275 | print "<priceRUAH>" . $product->variant->price . "</priceRUAH>"; | 275 | print "<priceRUAH>" . $product->variant->price . "</priceRUAH>"; |
| 276 | print "<oldprice>" . $product->variant->price_old . "</oldprice>"; | 276 | print "<oldprice>" . $product->variant->price_old . "</oldprice>"; |
| 277 | print "<param name='Тип'>{$product->category->name}</param>"; | 277 | print "<param name='Тип'>{$product->category->name}</param>"; |
| 278 | + $type = false; | ||
| 278 | foreach( $product->filters as $filter){ | 279 | foreach( $product->filters as $filter){ |
| 279 | 280 | ||
| 280 | 281 | ||
| 281 | - $type = false; | 282 | + |
| 282 | if($filter->group->name == "Тип точечного освещение:"){ | 283 | if($filter->group->name == "Тип точечного освещение:"){ |
| 283 | $type = true; | 284 | $type = true; |
| 284 | print "<param name='Тип'>{$filter->name}</param>"; | 285 | print "<param name='Тип'>{$filter->name}</param>"; |
| @@ -304,9 +305,7 @@ class SiteController extends Controller | @@ -304,9 +305,7 @@ class SiteController extends Controller | ||
| 304 | print "<param name='Тип'>{$filter->name}</param>"; | 305 | print "<param name='Тип'>{$filter->name}</param>"; |
| 305 | } | 306 | } |
| 306 | 307 | ||
| 307 | - if(!$type){ | ||
| 308 | - print "<param name='Тип'>{$product->category->name}</param>"; | ||
| 309 | - } | 308 | + |
| 310 | 309 | ||
| 311 | 310 | ||
| 312 | if($filter->group->name == "Назначение:"){ | 311 | if($filter->group->name == "Назначение:"){ |
| @@ -327,7 +326,9 @@ class SiteController extends Controller | @@ -327,7 +326,9 @@ class SiteController extends Controller | ||
| 327 | //print "<param name='Монтаж'>Припотолочная</param>"; | 326 | //print "<param name='Монтаж'>Припотолочная</param>"; |
| 328 | 327 | ||
| 329 | } | 328 | } |
| 330 | - | 329 | + if(!$type){ |
| 330 | + print "<param name='Тип'>{$product->category->name}</param>"; | ||
| 331 | + } | ||
| 331 | print "<priceRUSD></priceRUSD>"; | 332 | print "<priceRUSD></priceRUSD>"; |
| 332 | print "<stock>В наличии</stock>"; | 333 | print "<stock>В наличии</stock>"; |
| 333 | print "<guarantee></guarantee>"; | 334 | print "<guarantee></guarantee>"; |