diff --git a/models/Product.php b/models/Product.php index 4383020..40da816 100755 --- a/models/Product.php +++ b/models/Product.php @@ -405,7 +405,7 @@ ) ->where( [ - 'tax_group_to_category.category_id' => $this->category->id, + 'tax_group_to_category.category_id' => $this->category?$this->category->id:null, 'tax_group.use_in_name' => 1, 'tax_option.id' => ArrayHelper::getColumn( $this->options, @@ -424,11 +424,12 @@ } else { $groupName = ''; } - - if (!empty($this->category->lang->category_synonym)) { - $name = $name . ( $groupName ? $groupName : $this->category->lang->category_synonym ) . ' '; - } else { - $name = $name . ( $groupName ? $groupName : $this->category->lang->title ) . ' '; + if(!empty($this->category)) { + if (!empty($this->category->lang->category_synonym)) { + $name = $name . ( $groupName ? $groupName : $this->category->lang->category_synonym ) . ' '; + } else { + $name = $name . ( $groupName ? $groupName : $this->category->lang->title ) . ' '; + } } if (!empty($this->brand)) { -- libgit2 0.21.4