/** * requireDefaultRecords * Populate the Courier DataObject with information about our courier, so that it installs correctly. * * @return void */ public function requireDefaultRecords() { /* Inherit Default Record Creation */ parent::requireDefaultRecords(); $courier_name = get_class($this); /* If no records exist, create defaults */ if (!DataObject::get_one($courier_name)) { $n = new $courier_name(); //Disable the courier by default. $n->Enabled = 0; //System name for this gateway $n->SystemName = "Flat Rate Per Item"; //Friendly name for this courier. $n->Title = "Flat Rate Per Item"; //Default minimum spend $n->FlatRate = 0; //Write our configuration changes to the courier database tables. $n->write(); unset($n); DB::alteration_message('Successfully installed the courier "' . $courier_name . '"', 'created'); } }