Commit 43414a5da99477627dee878232594d4348eae546

Authored by Administrator
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 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 236 if ($is_count) {
237 237 print (count($products));
... ... @@ -270,15 +270,16 @@ class SiteController extends Controller
270 270 print "<code>" . htmlspecialchars($product->variant->sku) . "</code>";
271 271 print "<name>" . htmlspecialchars($product->name)." " .htmlspecialchars($product->variant->name). " </name>";
272 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 274 print "<image>http://www.linija-svitla.ua{$product->variant->imageUrl}</image>";
275 275 print "<priceRUAH>" . $product->variant->price . "</priceRUAH>";
276 276 print "<oldprice>" . $product->variant->price_old . "</oldprice>";
277 277 print "<param name='Тип'>{$product->category->name}</param>";
  278 + $type = false;
278 279 foreach( $product->filters as $filter){
279 280  
280 281  
281   - $type = false;
  282 +
282 283 if($filter->group->name == "Тип точечного освещение:"){
283 284 $type = true;
284 285 print "<param name='Тип'>{$filter->name}</param>";
... ... @@ -304,9 +305,7 @@ class SiteController extends Controller
304 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 311 if($filter->group->name == "Назначение:"){
... ... @@ -327,7 +326,9 @@ class SiteController extends Controller
327 326 //print "<param name='Монтаж'>Припотолочная</param>";
328 327  
329 328 }
330   -
  329 + if(!$type){
  330 + print "<param name='Тип'>{$product->category->name}</param>";
  331 + }
331 332 print "<priceRUSD></priceRUSD>";
332 333 print "<stock>В наличии</stock>";
333 334 print "<guarantee></guarantee>";
... ...