/**
  * Create {@link ComplexTableField} for managing {@link FlatFeeShippingRate}s.
  * 
  * @see DataObjectDecorator::updateCMSFields()
  */
 function updateCMSFields(FieldSet &$fields)
 {
     $fields->findOrMakeTabSet('Root.Shop.Shipping');
     $fields->addFieldToTab("Root.Shop.Shipping", new Tab('FlatFeeShipping'));
     $managerClass = class_exists('DataObjectManager') ? 'DataObjectManager' : 'ComplexTableField';
     $flatFeeManager = new $managerClass($this->owner, 'FlatFeeShippingRates', 'FlatFeeShippingRate', array('Title' => 'Label', 'Description' => 'Description', 'Country.Title' => 'Country', 'SummaryOfAmount' => 'Amount'), 'getCMSFields_forPopup');
     $fields->addFieldToTab("Root.Shop.Shipping.FlatFeeShipping", $flatFeeManager);
 }
    /**
     * Adding fields for shop settings such as email, license key.
     * 
     * @see DataObjectDecorator::updateCMSFields()
     */
    function updateCMSFields(FieldSet &$fields)
    {
        $fields->findOrMakeTabSet('Root.Shop');
        //License key
        $fields->addFieldToTab("Root.Shop", new Tab('LicenseKey'));
        $licenseKeyField = new TextField('LicenseKey', _t('ShopSettings.LICENSEKEY', 'License Key'), self::$license_key);
        $fields->addFieldToTab('Root.Shop.LicenseKey', $licenseKeyField->performReadonlyTransformation());
        //TODO include the license here in a text area field and some info about setting the license key perhaps
        //Shop emails
        $fields->addFieldToTab("Root.Shop", new TabSet('Emails'));
        $fields->addFieldToTab("Root.Shop.Emails", new Tab('Receipt'), new Tab('Notification'));
        $fields->addFieldToTab('Root.Shop.Emails.Receipt', new TextField('ReceiptFrom', _t('ShopSettings.FROM', 'From')));
        $receiptTo = new TextField('ReceiptTo', _t('ShopSettings.TO', 'To'));
        $receiptTo->setValue(_t('ShopSettings.RECEIPT_TO', 'Sent to customer'));
        $receiptTo = $receiptTo->performReadonlyTransformation();
        $fields->addFieldToTab('Root.Shop.Emails.Receipt', $receiptTo);
        $fields->addFieldToTab('Root.Shop.Emails.Receipt', new TextField('ReceiptSubject', _t('ShopSettings.SUBJECT_LINE', 'Subject line')));
        $fields->addFieldToTab('Root.Shop.Emails.Receipt', new TextareaField('ReceiptBody', _t('ShopSettings.MESSAGE', 'Message (order details are included in the email)'), 8));
        $fields->addFieldToTab('Root.Shop.Emails.Receipt', new TextareaField('EmailSignature', _t('ShopSettings.SIGNATURE', 'Signature'), 8));
        $notificationFrom = new TextField('NotificationFrom', _t('ShopSettings.FROM', 'From'));
        $notificationFrom->setValue(_t('ShopSettings.NOTIFICATION_FROM', 'Customer email address'));
        $notificationFrom = $notificationFrom->performReadonlyTransformation();
        $fields->addFieldToTab('Root.Shop.Emails.Notification', $notificationFrom);
        $fields->addFieldToTab('Root.Shop.Emails.Notification', new TextField('NotificationTo', _t('ShopSettings.TO', 'To')));
        $fields->addFieldToTab('Root.Shop.Emails.Notification', new TextField('NotificationSubject', _t('ShopSettings.SUBJECT_LINE', 'Subject line')));
        $fields->addFieldToTab('Root.Shop.Emails.Notification', new TextareaField('NotificationBody', _t('ShopSettings.MESSAGE', 'Message (order details are included in the email)'), 10));
        //Shipping
        $fields->findOrMakeTabSet('Root.Shop.Shipping');
        $fields->addFieldToTab("Root.Shop.Shipping", new Tab('Countries'));
        $fields->addFieldToTab("Root.Shop.Shipping", new Tab('Regions'));
        $managerClass = class_exists('DataObjectManager') ? 'DataObjectManager' : 'ComplexTableField';
        $manager = new $managerClass($this->owner, 'ShippingCountries', 'Country_Shipping');
        $fields->addFieldToTab("Root.Shop.Shipping.Countries", $manager);
        $managerClass = class_exists('DataObjectManager') ? 'DataObjectManager' : 'ComplexTableField';
        $manager = new $managerClass($this->owner, 'ShippingRegions', 'Region_Shipping');
        $fields->addFieldToTab("Root.Shop.Shipping.Regions", $manager);
        if (file_exists(BASE_PATH . '/swipestripe') && ShopSettings::get_license_key() == null) {
            $warning = _t('ShopSettings.LICENCE_WARNING', '
        Warning: You have SwipeStripe installed without a license key. 
        Please <a href="http://swipestripe.com" target="_blank">purchase a license key here</a> before this site goes live.
			');
            $fields->addFieldToTab("Root.Main", new LiteralField("SwipeStripeLicenseWarning", '<p class="message warning">' . $warning . '</p>'), "Title");
        }
    }