Commit 4f5a0e77f299babcf3eb1dc3499c4c90b17e6254

Authored by Yarik
1 parent edf70e4b

No category fix

Showing 1 changed file with 7 additions and 6 deletions   Show diff stats
models/Product.php
@@ -405,7 +405,7 @@ @@ -405,7 +405,7 @@
405 ) 405 )
406 ->where( 406 ->where(
407 [ 407 [
408 - 'tax_group_to_category.category_id' => $this->category->id, 408 + 'tax_group_to_category.category_id' => $this->category?$this->category->id:null,
409 'tax_group.use_in_name' => 1, 409 'tax_group.use_in_name' => 1,
410 'tax_option.id' => ArrayHelper::getColumn( 410 'tax_option.id' => ArrayHelper::getColumn(
411 $this->options, 411 $this->options,
@@ -424,11 +424,12 @@ @@ -424,11 +424,12 @@
424 } else { 424 } else {
425 $groupName = ''; 425 $groupName = '';
426 } 426 }
427 -  
428 - if (!empty($this->category->lang->category_synonym)) {  
429 - $name = $name . ( $groupName ? $groupName : $this->category->lang->category_synonym ) . ' ';  
430 - } else {  
431 - $name = $name . ( $groupName ? $groupName : $this->category->lang->title ) . ' '; 427 + if(!empty($this->category)) {
  428 + if (!empty($this->category->lang->category_synonym)) {
  429 + $name = $name . ( $groupName ? $groupName : $this->category->lang->category_synonym ) . ' ';
  430 + } else {
  431 + $name = $name . ( $groupName ? $groupName : $this->category->lang->title ) . ' ';
  432 + }
432 } 433 }
433 434
434 if (!empty($this->brand)) { 435 if (!empty($this->brand)) {