Source of file SimpleProductOptionValue.php
Size: 1,580 Bytes - Last Modified: 2021-12-23T10:06:34+00:00
/var/www/docs.ssmods.com/process/src/code/model/SimpleProductOptionValue.php
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 | <?php /** * Created by PhpStorm. * User: sanderhagenaars * Date: 07/11/2017 * Time: 10.27 */ class SimpleProductOptionValue extends DataObject { /** * Human-readable singular name. * @var string * @config */ private static $singular_name = "Option Value"; /** * Human-readable plural name * @var string * @config */ private static $plural_name = "Option Values"; /** * List of database fields. {@link DataObject::$db} * * @var array */ private static $db = array( 'Title' => 'Varchar', 'Sort' => 'Int', 'Price' => 'Currency(19,4)' ); /** * List of one-to-one relationships. {@link DataObject::$has_one} * * @var array */ private static $has_one = array( 'ProductOption' => 'SimpleProductOption' ); /** * Returns a FieldList with which to create the main editing form. {@link DataObject::getCMSFields()} * * @return FieldList The fields to be displayed in the CMS. */ public function getCMSFields() { $fields = parent::getCMSFields(); $fields->removeByName(['Sort']); $this->extend('updateCMSFields', $fields); return $fields; } /** * @return string */ public function LongTitle() { $title = (string)$this->Title; if($this->Price !== '0.0000'){ $title .= ' (+' . $this->dbObject("Price")->Nice() . ')'; } $this->extend('updateLongTitle', $title); return $title; } } |