Update CanBeBought.php

Use getAttribute method from HasAttributes trait,
This commit is contained in:
Patrick
2021-01-18 21:30:44 +01:00
committed by GitHub
parent bbf0703181
commit 963be116b7

View File

@@ -21,16 +21,16 @@ trait CanBeBought
*/ */
public function getBuyableDescription($options = null) public function getBuyableDescription($options = null)
{ {
if (isset($this->name)) { if (($name = $this->getAttribute('name'))) {
return $this->name; return $name;
} }
if (isset($this->title)) { if (($title $this->getAttribute('title'))) {
return $this->title; return $ttle;
} }
if (isset($this->description)) { if (($description = $this->getAttribute('description')) {
return $this->description; return $description;
} }
} }
@@ -41,8 +41,8 @@ trait CanBeBought
*/ */
public function getBuyablePrice($options = null) public function getBuyablePrice($options = null)
{ {
if (isset($this->price)) { if (($price = $this->getAttribute('price'))) {
return $this->price; return $price;
} }
} }
@@ -53,8 +53,8 @@ trait CanBeBought
*/ */
public function getBuyableWeight($options = null) public function getBuyableWeight($options = null)
{ {
if (isset($this->weight)) { if (($weight = $this->getAttribute('weight'))) {
return $this->weight; return $weight;
} }
return 0; return 0;