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)
{
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;