diff --git a/app/common/model/store/product/ProductAttrValue.php b/app/common/model/store/product/ProductAttrValue.php index 013c2f81..db0ab438 100644 --- a/app/common/model/store/product/ProductAttrValue.php +++ b/app/common/model/store/product/ProductAttrValue.php @@ -53,16 +53,17 @@ class ProductAttrValue extends BaseModel public function getSvipPriceAttr() { - try { - if ($this->product->product_type == 0 && $this->product->show_svip_price && $this->product->svip_price_type == 1) { - $rate = merchantConfig($this->product->mer_id,'svip_store_rate'); - $svip_store_rate = $rate > 0 ? bcdiv($rate,100,2) : 0; - return bcmul($this->price, $svip_store_rate,2); + if ($this->product){ + try { + if ($this->product->product_type == 0 && $this->product->show_svip_price && $this->product->svip_price_type == 1) { + $rate = merchantConfig($this->product->mer_id,'svip_store_rate'); + $svip_store_rate = $rate > 0 ? bcdiv($rate,100,2) : 0; + return bcmul($this->price, $svip_store_rate,2); + } + }catch (\Exception $e){ + Log::error([$e->getMessage(),$e->getLine(),$e->getFile()]); } - }catch (\Exception $e){ - Log::error([$e->getMessage(),$e->getLine(),$e->getFile()]); } - return $this->getData('svip_price'); }