Jump to:

2088 Posts in 1008 Topics by 455 members

E-Commerce Modules

SilverStripe Forums » E-Commerce Modules » Show Custom fields in OrderInformation.ss

Discuss about the various e-commerce modules available:
Ecommerce, SS Shop, SilverCart and SwipeStripe
Alternatively, have a look the shared mailinglist.

Moderators: martimiz, Nicolaas, Sean, frankmullenger, biapar, Willr, Ingo, Jedateach, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1233 Views
  • costarricense
    Community Member
    8 Posts

    Show Custom fields in OrderInformation.ss Link to this post

    Hi there.

    After work hard trying finding how add a custom form to the order page finally i got it, so when submit the form the custom information doesn't appear in OrderInformation.ss

    i did the same steps posted here


    If someone can help me with this i'll be extremely grateful


  • costarricense
    Community Member
    8 Posts

    Re: Show Custom fields in OrderInformation.ss Link to this post

    Someone help me please.

    I am very frustrated with SS, is very complicated for do a simple change like a extra fields in a form and the few documentation not help me much.


  • Digital-Punk.co.uk
    Community Member
    51 Posts

    Re: Show Custom fields in OrderInformation.ss Link to this post

    Did you did domainname../?flush=all ?

  • costarricense
    Community Member
    8 Posts

    Re: Show Custom fields in OrderInformation.ss Link to this post

    Thanks for reply,

    Yes i did it, i can show the custom fields in the form, but now when i click on submit button SS redirect me to the form and not process the data

    I modified the DB with my fields,dont know whats is wrong.

    My code below


    * @package ecommerce

    * EcommerceRole is a DataObjectDecorator for the member class to allow additional
    * member fields for the module. It has a base set of contact fields that can be
    * statically called anywhere in the system using singleton('Member')->getEcommerceFields();
    * The OrderForm and MemberForm class uses this call.
    class EcommerceRole extends DataObjectDecorator {

        * Edit the given query object to support queries for this extension
       function augmentSQL(SQLQuery &$query) {}

        * Update the database data, migrating ShopMember into Member, if necessary
       function augmentDefaultRecords() {
          $exist = DB::query("SHOW TABLES LIKE 'ShopMember'")->numRecords();
          if($exist > 0) {
             DB::query("UPDATE `Member`, `ShopMember` " .
                "SET `Member`.`ClassName` = 'Member'," .
                "`Member`.`CompanyName` = `ShopMember`.``," .
                "`Member`.`Name` = `ShopMember`.``," .
                "`Member`.`Address01` = `ShopMember`.``," .
                "`Member`.`Address02` = `ShopMember`.``," .
                "`Member`.`City` = `ShopMember`.``," .
                "`Member`.`Zip` = `ShopMember`.``," .
                "`Member`.`MainPhone` = `ShopMember`.``," .
                "`Member`.`Fax` = `ShopMember`.``," .
                "`Member`.`Mobile` = `ShopMember`.``," .
                "`Member`.`Fax` = `ShopMember`.``," .
                "`Member`.`Mobile` = `ShopMember`.``," .
                "`Member`.`EmailAddress` = `ShopMember`.``," .
                "`Member`.`PrepDate` = `ShopMember`.``," .
                "`Member`.`ShipDate` = `ShopMember`.``," .
                "`Member`.`StartDate` = `ShopMember`.``," .
                "`Member`.`ReturnDate` = `ShopMember`.``," .
                "`Member`.`DirectorOfPhotography` = `ShopMember`.``," .
                "`Member`.`PhoneNumber` = `ShopMember`.``," .
                "`Member`.`AssistantCameraman` = `ShopMember`.``," .
                "`Member`.`APhoneNumber` = `ShopMember`.``," .
                "WHERE `Member`.`ID` = `ShopMember`.`ID`"
             echo("<div style=\"padding:5px; color:white; background-color:blue;\">The data transfer has succeeded. However, to complete it, you must delete the ShopMember table. To do this, execute the query \"DROP TABLE 'ShopMember'\".</div>");

        * Define extra database fields for this extension.
       function extraDBFields() {
          return array(
             'db' => array(
                'CompanyName' => 'Varchar',
                'Name' => 'Varchar',
                'Address01' => 'Varchar',
                'Address02' => 'Varchar',
                'City' => 'Varchar',
                'Zip' => 'Varchar',
                'MainPhone' => 'Varchar',
                'Fax' => 'Varchar',
                'Mobile' => 'Varchar',
                'EmailAddress' => 'Varchar',
                'PrepDate' => 'Varchar',
                'ShipDate' => 'Varchar',
                'StartDate' => 'Varchar',
                'ReturnDate' => 'Varchar',
                'DirectorOfPhotography' => 'Varchar',
                'PhoneNumber' => 'Varchar',
                'AssistantCameraman' => 'Varchar',
                'APhoneNumber' => 'Varchar'

        * Add fields to the member popup box in the CMS.
       function updateCMSFields(FieldSet &$fields) {
          $fields->push(new TextField('CompanyName', 'Company Name'));
          $fields->push(new TextField('Name', 'Name'));
          $fields->push(new TextField('Address01', 'Address01'));
          $fields->push(new TextField('Address02', 'Address02'));
          $fields->push(new TextField('City', 'City'));
          $fields->push(new TextField('State', 'State'));
          $fields->push(new TextField('Zip', 'Zip'));
          $fields->push(new TextField('MainPhone', 'Main Phone'));
          $fields->push(new TextField('Fax', 'Fax'));
          $fields->push(new TextField('Mobile', 'Mobile'));
          $fields->push(new TextField('EmailAddress', 'Email Address'));
          $fields->push(new TextField('PrepDate', 'Prep Date'));
          $fields->push(new TextField('ShipDate', 'Ship Date'));
          $fields->push(new TextField('StartDate', 'Start Date'));
          $fields->push(new TextField('DirectorOfPhotography', 'Director Of Photography'));
          $fields->push(new TextField('PhoneNumber', 'PhoneNumber'));
          $fields->push(new TextField('AssistantCameraman', 'Assistant Cameraman'));
          $fields->push(new TextField('APhoneNumber', 'Assistant Phone Number'));
        * Return the member fields to be shown on order forms.
        * For orders made by existing members, this will be called on that memeber.
        * For new orders, this will be called on the singleton object.
       function getEcommerceFields() {
          $fields = new FieldSet(
             new HeaderField('Contact Information', 3),
             new TextField('CompanyName', 'CompanyName'),
             new TextField('Name', 'First &amp; Last Name'),
             new TextField('Address01', 'Address 01'),
             new TextField('Address02', 'Address 02'),
             new TextField('City', 'City'),
             new TextField('State', 'State'),
             new TextField('Zip', 'Zip'),
             new TextField('MainPhone', 'Main Phone'),
             new TextField('Fax', 'Fax'),
             new TextField('Mobile', 'Mobile'),
             new TextField('EmailAddress', 'Email Address'),
             new TextField('PrepDate', 'Prep Date'),
             new TextField('ShipDate', 'Ship Date'),
             new TextField('StartDate', 'Start Date'),
             new TextField('ReturnDate', 'Return Date'),
             new TextField('DirectorOfPhotography', 'Director Of Photography'),
             new TextField('PhoneNumber', 'Phone Number'),
             new TextField('AssistantCameraman', 'Assistant Cameraman'),
             new TextField('APhoneNumber', 'Phone Number')
             /*new TextField('FirstName', 'First Name'),
             new TextField('Surname', 'Surname'),
             new TextField('HomePhone', 'Phone'),
             new TextField('MobilePhone', 'Mobile'),
             new EmailField('Email', 'Email'),
             new TextField('Address', 'Address'),
             new TextField('AddressLine2', 'Address Line 2'),
             new TextField('City', 'City'),
             new TextField('fuck', 'fuck'),
             new DropdownField('Country', 'Country', Geoip::getCountryDropDown(), self::findCountry())*/
          $this->owner->extend('augmentEcommerceFields', $fields);
          return new CompositeField($fields);

        * Create a new member from the given data or merge with the built-in fields.
        * @param data the array data from a submitted form.
       public static function createOrMerge($data) {
          // Because we are using a ConfirmedPasswordField, the password will
          // be an array of two fields
          if(isset($data['Password']) && is_array($data['Password'])) {
             $data['Password'] = $data['Password']['_Password'];
          if($existingMember = Member::currentUser()) {
             return $existingMember;
          } else {
             $member = new Member();
             return $member;
        * Find the member country, if the member doesn't exist then return
        * the Geoip visitor country based on their IP address.
       static function findCountry(){
          $member = Member::currentUser();
          if($member && $member->Country) {
             $country = $member->Country;
          } else {
             $country = Geoip::visitor_country();
          return $country;
        * Give the two letter code to resolve the title of the country.
        * @param $code - the two letter country code you want the full name of.
       static function findCountryTitle($code) {
          $countries = Geoip::getCountryDropDown();
          // check if code was provided, and is found in the country array
          if($code && $countries[$code]) {
             return $countries[$code];      
          } else {
             return false;



    Someone help me please!!!!


Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.