コード例 #1
0
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->addFieldsToTab('Root.Main', PhoneNumberField::create('Age', 'Age num'));
     $fields->addFieldsToTab('Root.Main', TextField::create('Job', 'Your Job'));
     return $fields;
 }
コード例 #2
0
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->removeByName('Password');
     $fields->removeByName('LastVisited');
     $fields->removeByName('Locale');
     $fields->removeByName('DirectGroups');
     $fields->removeByName('DateFormat');
     $fields->removeByName('TimeFormat');
     $fields->removeByName('FailedLoginCount');
     $fields->addFieldToTab('Root.Main', new TextField('StreetAddress1', 'Street Address 1'), 'StreetAddress2');
     $fields->addFieldToTab('Root.Main', new TextField('StreetAddress2', 'Street Address 2'), 'PostOfficeBox');
     $fields->addFieldToTab('Root.Main', new TextField('PostOfficeBox', 'Post Office Box Number'), 'Suburb');
     $fields->addFieldToTab('Root.Main', new TextField('PostCode', 'Post Code'), 'Country');
     $fields->addFieldToTab('Root.Main', new CountryDropdownField('Country'), 'PostOnly');
     $fields->addFieldToTab('Root.Main', new CheckboxField('PostOnly', 'Post only (no email)'), 'MembershipTypeID');
     return $fields;
 }
コード例 #3
0
 /**
  * Add some fields for managing Members in the CMS.
  * 
  * @return FieldSet
  */
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->addFieldToTab('Root.Address', new TextField('Address', _t('Customer.ADDRESS', "Address")));
     $fields->addFieldToTab('Root.Address', new TextField('AddressLine2', ''));
     $fields->addFieldToTab('Root.Address', new TextField('City', _t('Customer.CITY', "City")));
     $fields->addFieldToTab('Root.Address', new TextField('State', _t('Customer.STATE', "State")));
     $fields->addFieldToTab('Root.Address', new TextField('PostalCode', _t('Customer.POSTAL_CODE', "Postal Code")));
     $fields->addFieldToTab('Root.Address', new DropdownField('Country', _t('Customer.COUNTRY', "Country"), Geoip::getCountryDropDown()));
     $fields->removeByName('Street');
     $fields->removeByName('Suburb');
     $fields->removeByName('CityTown');
     $fields->removeByName('DateFormat');
     $fields->removeByName('TimeFormat');
     $fields->removeByName('Notes');
     $fields->removeByName('Orders');
     $fields->removeByName('Addresses');
     $fields->removeByName('Groups');
     $fields->removeByName('Permissions');
     return $fields;
 }
コード例 #4
0
 /**
  * getCMSFields
  * Alter the FieldList provided by the Member class to 
  * the requirements of an online store.
  * 
  * @return FieldList
  */
 public function getCMSFields()
 {
     Requirements::css('torindul-silverstripe-shop/css/LeftAndMain.css');
     $fields = parent::getCMSFields();
     /** REMOVE SCAFFOLDED FIELDS TO ADD LATER
      * -- Locale is removed. As these users will not use the CMS itself so the default values will suffice for now.
      * -- DirectGroups is removed. Customer group membership is handled by onAfterWrite().
      * -- DateFormat and TimeFormat are removed. The default will be fine for nearly all installations.
      * -- Those fields not mentioned are re-added later.
      */
     $fields->removeFieldsFromTab("Root.Main", array("FirstName", "Surname", "CompanyName", "Email", "Password", "StoreCredit", "LandlineNumber", "MobileNumber", "DirectGroups", "Locale", "FailedLoginCount", "LastVisited", "TimeFormat", "DateFormat"));
     //If the customer record has been created, display the ID of the record as the account number.
     if ($this->exists()) {
         $fields->addFieldsToTab("Root.Main", array(HeaderField::create("Account Details"), CompositeField::create(ReadonlyField::create("AccountNo", "Account Number", $this->ID), ReadonlyField::create("LastVisited", "Last Signed In", $this->LastVisited), NumericField::create("StoreCredit", "StoreCredit")->setRightTitle("The amount of credit this customer can spend on orders in your store."))));
     }
     //Add Customer Details Fields
     $fields->addFieldsToTab("Root.Main", array(HeaderField::create("Customer Details"), CompositeField::create(TextField::create("FirstName", "First Name"), TextField::create("Surname", "Surname"), TextField::create("CompanyName", "Company Name"), TextField::create("LandlineNumber", "Landline Number"), TextField::create("MobileNumber", "Mobile Number")), HeaderField::create("Login Details"), CompositeField::create(EmailField::create("Email", "Email Address"), NumericField::create("FailedLoginCount", "Failed Login Count")->setRightTitle("The total number of failed login attempts this customer has made. Set to 0 to unblock their account."))));
     //Add Confirmed Password Field befoe the FailedLoginCount field
     $password = ConfirmedPasswordField::create('Password', null, null, null, true)->setCanBeEmpty(true);
     if (!$this->ID) {
         $password->showOnClick = false;
     }
     $fields->addFieldToTab("Root.Main", $password, "FailedLoginCount");
     //Customer Address Book Tab
     $fields->addFieldsToTab("Root.AddressBook", array(HeaderField::create($this->exists() ? $this->FirstName . " " . $this->Surname . "'s Address Book" : "Customer Address Book"), CompositeField::create(LiteralField::create($title = "CustomFieldsDescription", "<div class=\"literal-field literal-field-noborder\">\n\t\t\t\t\t\tThe address book is used to store multiple customer addresses for shipping and billing purposes.\n\t\t\t\t\t</div>"), $this->exists() ? GridField::create("Customer_AddressBook", "", $this->Addresses(), GridFieldConfig_RecordEditor::create()) : LiteralField::create($title = "AddressBookNotice", "<div class=\"literal-field field\">\n\t\t\t\t\t\t\n\t\t\t\t\t\t<div class=\"message notice\">\n\t\t\t\t\t\t\t<i class=\"fa fa-info-circle\"></i>\n\t\t\t\t\t\t\tThis customer doesn't exist in the system yet. To be able to see addresses for this customer you must first \n\t\t\t\t\t\t\tclick create.\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\n\t\t\t\t\t</div>"))));
     //Customer Orders Tab
     $fields->addFieldsToTab("Root.Orders", array(HeaderField::create($this->exists() ? $this->FirstName . " " . $this->Surname . "'s Orders" : "Customer Orders"), CompositeField::create(LiteralField::create($title = "CustomFieldsDescription", "<div class=\"literal-field literal-field-noborder\">\n\t\t\t\t\t\tIf this customer has placed orders with your store you can see them below.\n\t\t\t\t\t</div>"), $this->exists() ? GridField::create("Customers_Orders", "", $this->Orders(), GridFieldConfig_RecordEditor::create()) : LiteralField::create($title = "OrdersNotice", "<div class=\"literal-field field\">\n\t\t\t\t\t\t\n\t\t\t\t\t\t<div class=\"message notice\">\n\t\t\t\t\t\t\t<i class=\"fa fa-info-circle\"></i>\n\t\t\t\t\t\t\tThis customer doesn't exist in the system yet. To be able to see orders for this customer you must first \n\t\t\t\t\t\t\tclick create.\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\n\t\t\t\t\t</div>"))));
     //Update Store Credit Field
     $storecredit = NumericField::create("StoreCredit", "Store Credit (" . Product::getDefaultCurrency() . ")");
     $fields->replaceField("StoreCredit", $storecredit);
     //Remove Automatically Generated Address GridField
     $fields->removeFieldFromTab("Root", "Addresses");
     $fields->removeFieldFromTab("Root", "Permissions");
     $fields->removeFieldFromTab("Root.Orders", "Orders");
     return $fields;
 }
コード例 #5
0
ファイル: ShopClient.php プロジェクト: pstaender/ShopSystem
 function getCMSFields()
 {
     $fields = parent::getCMSFields();
     return $fields;
 }
コード例 #6
0
	public function getCMSFields() {
		$fields = parent::getCMSFields();
		$fields->removeByName('Groups');

		return $fields;
	}