From 4f5a0e77f299babcf3eb1dc3499c4c90b17e6254 Mon Sep 17 00:00:00 2001 From: Yarik Date: Fri, 16 Jun 2017 12:28:02 +0300 Subject: [PATCH] No category fix --- models/Product.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) 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