Viewing file: CanBeBought.php (1.25 KB) -rwxrwxrwx Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
namespace Gloudemans\Shoppingcart;
trait CanBeBought { /** * Get the identifier of the Buyable item. * * @return int|string */ public function getBuyableIdentifier($options = null) { return method_exists($this, 'getKey') ? $this->getKey() : $this->id; }
/** * Get the name, title or description of the Buyable item. * * @return string */ public function getBuyableDescription($options = null) { if (property_exists($this, 'name')) { return $this->name; }
if (property_exists($this, 'title')) { return $this->title; }
if (property_exists($this, 'description')) { return $this->description; } }
/** * Get the price of the Buyable item. * * @return float */ public function getBuyablePrice($options = null) { if (property_exists($this, 'price')) { return $this->price; } }
/** * Get the weight of the Buyable item. * * @return float */ public function getBuyableWeight($options = null) { if (property_exists($this, 'weight')) { return $this->weight; }
return 0; } }
|