Source of file OrderAttribute.php
Size: 1,663 Bytes - Last Modified: 2021-12-23T10:24:58+00:00
/var/www/docs.ssmods.com/process/src/src/Model/OrderAttribute.php
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 | <?php namespace SilverShop\Model; use SilverStripe\ORM\DataObject; use SilverStripe\ORM\FieldType\DBCurrency; /** * A single line in an order. This could be an item, or a subtotal line. * * @see OrderItem * @see OrderModifier * * @property DBCurrency $CalculatedTotal * @property int $OrderID * @method Order Order() */ class OrderAttribute extends DataObject { private static $singular_name = 'Attribute'; private static $plural_name = 'Attributes'; private static $db = [ 'CalculatedTotal' => 'Currency', ]; private static $has_one = [ 'Order' => Order::class, ]; private static $casting = [ 'TableTitle' => 'Text', 'CartTitle' => 'Text', ]; private static $table_name = 'SilverShop_OrderAttribute'; public function canCreate($member = null, $context = array()) { return false; } public function canDelete($member = null) { return false; } public function isLive() { return (!$this->isInDB() || $this->Order()->IsCart()); } /** * Produces a title for use in templates. * * @return string */ public function getTableTitle() { $title = $this->i18n_singular_name(); $this->extend('updateTableTitle', $title); return $title; } public function getCartTitle() { $title = $this->getTableTitle(); $this->extend('updateCartTitle', $title); return $title; } public function ShowInTable() { $showInTable = true; $this->extend('updateShowInTable', $showInTable); return $showInTable; } } |