From 963be116b70169fb28c3d127d35c3067eda00a35 Mon Sep 17 00:00:00 2001 From: Patrick Date: Mon, 18 Jan 2021 21:30:44 +0100 Subject: [PATCH] Update CanBeBought.php Use getAttribute method from HasAttributes trait, --- src/CanBeBought.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/CanBeBought.php b/src/CanBeBought.php index b1c28b8..e81831d 100644 --- a/src/CanBeBought.php +++ b/src/CanBeBought.php @@ -21,16 +21,16 @@ trait CanBeBought */ public function getBuyableDescription($options = null) { - if (isset($this->name)) { - return $this->name; + if (($name = $this->getAttribute('name'))) { + return $name; } - if (isset($this->title)) { - return $this->title; + if (($title $this->getAttribute('title'))) { + return $ttle; } - if (isset($this->description)) { - return $this->description; + if (($description = $this->getAttribute('description')) { + return $description; } } @@ -41,8 +41,8 @@ trait CanBeBought */ public function getBuyablePrice($options = null) { - if (isset($this->price)) { - return $this->price; + if (($price = $this->getAttribute('price'))) { + return $price; } } @@ -53,8 +53,8 @@ trait CanBeBought */ public function getBuyableWeight($options = null) { - if (isset($this->weight)) { - return $this->weight; + if (($weight = $this->getAttribute('weight'))) { + return $weight; } return 0;