/**
  * @param \Controller $controller
  */
 public function __construct($controller, $name)
 {
     $this->addExtraClass('vend-form');
     $this->controller = $controller;
     $config = \SiteConfig::current_site_config();
     $vendToken = VendToken::get()->first();
     $vendAccessToken = $vendToken->AccessToken;
     $vendShopName = $config->VendShopName;
     $fields = new \FieldList();
     $actions = new \FieldList();
     $fields->add(new \LiteralField('vend', "<h1>Vend Integration</h1>"));
     if (!is_null($vendAccessToken) && !empty($vendAccessToken)) {
         $url = $this->getAuthURL();
         $fields->add(new \LiteralField('explanation', "<p>You're all setup!<br> If you need to reauthenticate, click <a href='{$url}' target='_blank'>here</a></p>"));
     } else {
         if (!is_null($vendShopName) && !empty($vendShopName)) {
             $url = $this->getAuthURL();
             $fields->add(new \LiteralField('explanation', "Please authenticate by clicking <a href='{$url}' target='_blank'>here</a>"));
         } else {
             $fields->add(new \LiteralField('explanation', "Please remember to set your app settings in a config file."));
         }
     }
     $fields->add(new \TextField('VendShopName', 'Vend Shop Name (yourshopname.vendhq.com)', $vendShopName));
     $actions->push(new \FormAction('doSave', 'Save'));
     // Reduce attack surface by enforcing POST requests
     $this->setFormMethod('POST', true);
     parent::__construct($controller, $name, $fields, $actions);
 }
 function __construct($controller, $name)
 {
     $fields = new FieldList(array($t1 = new TextField('ExternalOrderId', 'Eventbrite Order #'), $checkbox = new CheckboxField('SharedContactInfo', 'Allow to share contact info?')));
     $t1->setAttribute('placeholder', 'Enter your Eventbrite order #');
     $t1->addExtraClass('event-brite-order-number');
     $attendees = Session::get('attendees');
     if (count($attendees) > 0) {
         $t1->setValue(Session::get('ExternalOrderId'));
         $t1->setReadonly(true);
         $checkbox->setValue(intval(Session::get('SharedContactInfo')) === 1);
         $fields->add(new LiteralField('ctrl1', 'Current Order has following registered attendees, please select one:'));
         $options = array();
         foreach ($attendees as $attendee) {
             $ticket_external_id = intval($attendee['ticket_class_id']);
             $ticket_type = SummitTicketType::get()->filter('ExternalId', $ticket_external_id)->first();
             if (is_null($ticket_type)) {
                 continue;
             }
             $options[$attendee['id']] = $attendee['profile']['name'] . ' (' . $ticket_type->Name . ')';
         }
         $attendees_ctrl = new OptionSetField('SelectedAttendee', '', $options);
         $fields->add($attendees_ctrl);
         $validator = new RequiredFields(array('ExternalOrderId'));
         // Create action
         $actions = new FieldList($btn_clear = new FormAction('clearSummitAttendeeInfo', 'Clear'), $btn = new FormAction('saveSummitAttendeeInfo', 'Done'));
         $btn->addExtraClass('btn btn-default active');
         $btn_clear->addExtraClass('btn btn-danger active');
     } else {
         $validator = new RequiredFields(array('ExternalOrderId'));
         // Create action
         $actions = new FieldList($btn = new FormAction('saveSummitAttendeeInfo', 'Get Order'));
         $btn->addExtraClass('btn btn-default active');
     }
     parent::__construct($controller, $name, $fields, $actions, $validator);
 }
 private function buildForm()
 {
     $contact_fields = $this->ContactFields();
     $fields = new FieldList();
     $required_fields = array();
     foreach ($contact_fields as $contact_field) {
         switch ($contact_field->Type) {
             case 'TextField':
                 $fields->add(new TextField($contact_field->Name, $contact_field->Name));
                 break;
             case 'EmailField':
                 $fields->add(new EmailField($contact_field->Name, $contact_field->Name));
                 break;
             case 'TextareaField':
                 $fields->add(new TextareaField($contact_field->Name, $contact_field->Name));
                 break;
             case 'DropdownField':
                 $values = explode("\n", $contact_field->Values);
                 $dropdown_values = array();
                 foreach ($values as $value) {
                     $dropdown_values[trim($value)] = trim($value);
                 }
                 $fields->add(new DropdownField($contact_field->Name, $contact_field->Name, $dropdown_values));
                 break;
         }
         if ($contact_field->Required) {
             $required_fields[] = $contact_field->Name;
         }
     }
     $actions = new FieldList(FormAction::create("doSubmitContactForm")->setTitle("Contact"));
     $required = new RequiredFields($required_fields);
     $form = new Form($this, 'ContactForm', $fields, $actions, $required);
     return $form;
 }
 /**
  * A simple form for creating blog entries
  */
 function FrontEndPostForm()
 {
     if ($this->owner->request->latestParam('ID')) {
         $id = (int) $this->owner->request->latestParam('ID');
     } else {
         $id = 0;
     }
     $membername = Member::currentUser() ? Member::currentUser()->getName() : "";
     // Set image upload
     $uploadfield = UploadField::create('FeaturedImage', _t('BlogFrontEnd.ShareImage', "Share an image"));
     $uploadfield->setCanAttachExisting(false);
     $uploadfield->setCanPreviewFolder(false);
     $uploadfield->setAllowedFileCategories('image');
     $uploadfield->relationAutoSetting = false;
     if (BlogFrontEnd::config()->allow_wysiwyg_editing) {
         $content_field = TrumbowygHTMLEditorField::create("Content", _t("BlogFrontEnd.Content"));
     } else {
         $content_field = TextareaField::create("Content", _t("BlogFrontEnd.Content"));
     }
     $form = new Form($this->owner, 'FrontEndPostForm', $fields = new FieldList(HiddenField::create("ID", "ID"), TextField::create("Title", _t('BlogFrontEnd.Title', "Title")), $uploadfield, $content_field), $actions = new FieldList(FormAction::create('doSavePost', _t('BlogFrontEnd.PostEntry', 'Post Entry'))), new RequiredFields('Title'));
     $uploadfield->setForm($form);
     if ($this->owner->Categories()->exists()) {
         $fields->add(CheckboxsetField::create("Categories", _t("BlogFrontEnd.PostUnderCategories", "Post this in a category? (optional)"), $this->owner->Categories()->map()));
     }
     if ($this->owner->Tags()->exists()) {
         $fields->add(CheckboxsetField::create("Categories", _t("BlogFrontEnd.AddTags", "Add a tag? (optional)"), $this->owner->Tags()->map()));
     }
     if ($id && ($post = BlogPost::get()->byID($id))) {
         $form->loadDataFrom($post);
     }
     $this->owner->extend("updateFrontEndPostForm", $form);
     return $form;
 }
Example #5
0
 public function __construct($controller, $name)
 {
     $member = Member::currentUser();
     $requiredFields = null;
     if ($member && $member->exists()) {
         $fields = new FieldList();
         $fields->add(new HeaderField('AddressHeader', _t('Addressable.ADDRESSHEADER', 'Avatar / Description')));
         $uploadField = new UploadField('Avatar', 'Select avatar');
         $uploadField->setCanAttachExisting(false);
         $comment = new TextareaField('Description', 'Description*');
         $email = EmailField::create('Email', _t('CheckoutField.EMAIL', 'Email'));
         $fields->add($uploadField);
         $fields->add($comment);
         $fields->add($email);
         $requiredFields = $member->getValidator();
         $requiredFields->addRequiredField('Avatar', 'Description', 'Email');
     } else {
         $fields = new FieldList();
     }
     if (get_class($controller) == 'ChefAccountPage_Controller') {
         $actions = new FieldList(new FormAction('submit', _t('MemberForm.SAVE', 'Save Changes')));
     }
     parent::__construct($controller, $name, $fields, $actions, $requiredFields);
     if ($member) {
         $member->Password = "";
         //prevents password field from being populated with encrypted password data
         $this->loadDataFrom($member);
     }
     if ($record = $controller->data()) {
         $record->extend('updateChefAccountForm', $fields, $actions, $requiredFields);
     }
 }
 public function getCMSFields()
 {
     $fields = new FieldList();
     $fields->add(new TextField('Title', 'Title'));
     $fields->add(new TextField('Url', 'Url'));
     return $fields;
 }
 public function getCMSFields()
 {
     $fields = new FieldList();
     $fields->add(new TextField('Name', 'Name (Without Spaces)'));
     $fields->add(new HtmlEditorField('Content', 'Content'));
     return $fields;
 }
 public function getCMSFields()
 {
     $fields = new FieldList();
     $fields->add(new TextField('Name', 'Name (Without Spaces)'));
     $fields->add(new HtmlEditorField('Content', 'Content'));
     $fields->add(new CheckboxField('Hidden', 'Hide on front-end?'));
     return $fields;
 }
 public function getCMSFields()
 {
     $fields = new FieldList();
     $fields->add(new TextField('Title', 'Title'));
     $fields->add(new TextField('Url', 'Url'));
     $this->extend('updateCMSFields', $fields);
     return $fields;
 }
 public function getCMSFields()
 {
     $fields = new FieldList();
     $fields->add(new TextField('Title', 'Title'));
     $fields->add(new HtmlEditorField('Description', 'Description'));
     $fields->add(new DropdownField('Category', 'Category', $this->dbObject('Category')->enumValues()));
     return $fields;
 }
 public function getCMSFields()
 {
     $fields = new FieldList();
     $fields->add($name = new TextField('Name', 'Name'));
     $name->setReadonly(true);
     $fields->add(new TextField('Message', 'Custom Message'));
     return $fields;
 }
Example #12
0
 public function getCMSFields()
 {
     $fields = new FieldList();
     $fields->add(new TextField('Type', 'Type'));
     $fields->add(new ColorField("Color", "Color"));
     $fields->add(new HiddenField('SummitID', 'SummitID'));
     return $fields;
 }
 public function getCMSFields()
 {
     $fields = new FieldList();
     $fields->add($name = new TextField('Name', 'Name'));
     $fields->add(new NumericField('MinLength', 'Min Length'));
     $fields->add(new TextField('Message', 'Custom Message'));
     return $fields;
 }
 public function getCMSFields()
 {
     $fields = new FieldList();
     $fields->add(new TextField('Value', 'Value'));
     $fields->add(new TextareaField('Label', 'Label'));
     $fields->add(new HiddenField('OwnerID', 'OwnerID'));
     return $fields;
 }
 public function getCMSFields()
 {
     $fields = new FieldList();
     $fields->add(new TextField('Title', 'Title'));
     $fields->add(new CheckboxField('ShowQuantity', 'Show Quantities'));
     $fields->add(new TextField('Cost', 'Cost'));
     $fields->add(new NumericField('MaxAvailable', 'Max. Available'));
     $fields->add(new NumericField('CurrentlyAvailable', 'Currently Available'));
     return $fields;
 }
 public function getCMSFields()
 {
     $f = new FieldList();
     $f->add(new TextField('Title', 'Title'));
     $image = new UploadField('Image', 'Pic');
     $image->setAllowedMaxFileNumber(1);
     $image->setFolderName(sprintf('summits/%s/highlights/pics', $this->SummitHighlightsPage()->SummitID));
     $f->add($image);
     $f->add(new HiddenField('SummitHighlightsPageID', 'SummitHighlightsPageID'));
     return $f;
 }
 public function getCMSFields()
 {
     $fields = new FieldList();
     $fields->add($type_txt = new TextField('Type', 'Type'));
     if ($this->ID > 0 && Summit::isDefaultEventType($this->Type)) {
         $type_txt->setReadonly(true);
     }
     $fields->add(new ColorField("Color", "Color"));
     $fields->add(new CheckboxField("BlackoutTimes", "Blackout Times"));
     $fields->add(new HiddenField('SummitID', 'SummitID'));
     return $fields;
 }
 public function getCMSFields()
 {
     $f = new FieldList();
     $f->add(new TextField('Name', 'Name'));
     $f->add(new HtmlEditorField('Description', 'Description'));
     $map_field = new UploadField('Map', 'Map');
     $map_field->setAllowedMaxFileNumber(1);
     $map_field->setFolderName(sprintf('summits/%s/locations/maps/', $this->Location()->SummitID));
     $f->add($map_field);
     $f->add(new HiddenField('LocationID', 'LocationID'));
     return $f;
 }
 public function getCMSFields()
 {
     $f = new FieldList();
     $f->add(new TextField('Name', 'Name'));
     $f->add(new HtmlEditorField('Description', 'Description'));
     $map_field = new UploadField('Picture', 'Picture');
     $map_field->setAllowedMaxFileNumber(1);
     $map_field->setFolderName(sprintf('summits/%s/locations/%s/images/', $_REQUEST['SummitID'], $_REQUEST['LocationID']));
     $map_field->getValidator()->setAllowedMaxFileSize(array('*' => 500 * 1024));
     $f->add($map_field);
     $f->add(new HiddenField('LocationID', 'LocationID'));
     return $f;
 }
Example #20
0
 public function __construct($controller, $name)
 {
     $product = new Product();
     $title = new TextField('Title', _t('Product.PAGETITLE', 'Product Title'));
     $urlSegment = new TextField('URLSegment', 'URL Segment');
     $menuTitle = new TextField('MenuTitle', 'Navigation Title');
     $sku = TextField::create('InternalItemID', _t('Product.CODE', 'Product Code/SKU'), '', 30);
     $categories = DropdownField::create('ParentID', _t("Product.CATEGORY", "Category"), $product->categoryoptions())->setDescription(_t("Product.CATEGORYDESCRIPTION", "This is the parent page or default category."));
     $otherCategories = ListBoxField::create('ProductCategories', _t("Product.ADDITIONALCATEGORIES", "Additional Categories"), ProductCategory::get()->filter("ID:not", $product->getAncestors()->map('ID', 'ID'))->map('ID', 'NestedTitle')->toArray())->setMultiple(true);
     $model = TextField::create('Model', _t('Product.MODEL', 'Model'), '', 30);
     $featured = CheckboxField::create('Featured', _t('Product.FEATURED', 'Featured Product'));
     $allow_purchase = CheckboxField::create('AllowPurchase', _t('Product.ALLOWPURCHASE', 'Allow product to be purchased'), 1, 'Content');
     $price = TextField::create('BasePrice', _t('Product.PRICE', 'Price'))->setDescription(_t('Product.PRICEDESC', "Base price to sell this product at."))->setMaxLength(12);
     $image = UploadField::create('Image', _t('Product.IMAGE', 'Product Image'));
     $content = new HtmlEditorField('Content', 'Content');
     $fields = new FieldList();
     $fields->add($title);
     //$fields->add($urlSegment);
     //$fields->add($menuTitle);
     //$fields->add($sku);
     $fields->add($categories);
     //$fields->add($otherCategories);
     $fields->add($model);
     $fields->add($featured);
     $fields->add($allow_purchase);
     $fields->add($price);
     $fields->add($image);
     $fields->add($content);
     //$fields = $product->getFrontEndFields();
     $actions = new FieldList(new FormAction('submit', _t("ChefProductForm.ADDPRODUCT", 'Add product')));
     $requiredFields = new RequiredFields(array('Title', 'Model', 'Price'));
     parent::__construct($controller, $name, $fields, $actions, $requiredFields);
 }
 public function __construct($controller, $name = "Users_EditAccountForm")
 {
     $fields = new FieldList();
     $fields->add(HiddenField::create("ID"));
     $fields->add(TextField::create("FirstName", _t('Member.FIRSTNAME', "First Name")));
     $fields->add(TextField::create("Surname", _t('Member.SURNAME', "Surname")));
     $fields->add(EmailField::create("Email", _t("Member.EMAIL", "Email")));
     $this->extend("updateFormFields", $fields);
     $cancel_url = Controller::join_links($controller->Link());
     $actions = new FieldList(LiteralField::create("cancelLink", '<a class="btn btn-red" href="' . $cancel_url . '">' . _t("Users.CANCEL", "Cancel") . '</a>'), FormAction::create("doUpdate", _t("CMSMain.SAVE", "Save"))->addExtraClass("btn")->addExtraClass("btn-green"));
     $this->extend("updateFormActions", $actions);
     $required = new RequiredFields(array("FirstName", "Surname", "Email"));
     $this->extend("updateRequiredFields", $required);
     parent::__construct($controller, $name, $fields, $actions, $required);
 }
 public function NewEntryForm()
 {
     // Create fields
     $entry = new GuestbookEntry();
     $labels = $entry->fieldLabels();
     $fields = new FieldList(new TextField('Name', $labels['Name']), new EmailField('Email', $labels['Email']), TextField::create('Website', $labels['Website'])->setAttribute('type', 'url'), new TextareaField("Message", $labels['Message']));
     if ($this->EnableEmoticons) {
         $smileyButtons = $this->SmileyButtons("Form_NewEntryForm_Message");
         $smileyField = new LiteralField("Smileys", $smileyButtons);
         $fields->add($smileyField);
     }
     // Create actions
     $actions = new FieldList(new FormAction('postEntry', _t("GuestbookController.POST", 'Post')));
     $validator = new RequiredFields('Name', 'Message');
     $form = new Form($this, 'NewEntryForm', $fields, $actions, $validator);
     $form->setRedirectToFormOnValidationError(true);
     if ($this->UseSpamProtection) {
         if (Form::has_extension('FormSpamProtectionExtension')) {
             $form->enableSpamProtection();
         } else {
             $message = _t('GuestbookController.SPAMPROTECTIONNOTINSTALLED', 'Spam protection has been enabled, but no spam protection module is installed!');
             $form->setMessage($message, 'warning');
         }
     }
     return $form;
 }
 /**
  * @param null $params
  * @return FieldList
  */
 public function getFrontendFields($params = NULL)
 {
     $fields = new FieldList();
     $config = new FrontEndGridFieldConfig_RecordEditor(20);
     $gf = new FrontEndGridField('Incidents', 'Incidents', Incident::get(), $config);
     $fields->add($gf);
     return $fields;
 }
 public function getCMSFields()
 {
     $fields = new FieldList();
     $_REQUEST['entity_survey'] = 1;
     $fields->add(new TextField('EntityName', 'Entity Name (Without Spaces)'));
     $fields->add(new CheckboxField('Enabled', 'Is Enabled?'));
     $fields->add(new CheckboxField('UseTeamEdition', 'Allow Team Edition?'));
     $fields->add(new HiddenField('CreatedByID', 'CreatedByID', Member::currentUserID()));
     $fields->add(new HiddenField('ParentID', 'ParentID'));
     //steps
     if ($this->ID > 0) {
         $_REQUEST['survey_template_id'] = $this->ID;
         // steps
         $config = GridFieldConfig_RecordEditor::create();
         $config->removeComponentsByType('GridFieldAddNewButton');
         $multi_class_selector = new GridFieldAddNewMultiClass();
         $multi_class_selector->setClasses(array('SurveyRegularStepTemplate' => 'Regular Step'));
         $config->addComponent($multi_class_selector);
         $config->addComponent(new GridFieldSortableRows('Order'));
         $gridField = new GridField('Steps', 'Steps', $this->Steps(), $config);
         $fields->add($gridField);
         $config = GridFieldConfig_RecordEditor::create();
         $config->removeComponentsByType('GridFieldAddNewButton');
         $multi_class_selector = new GridFieldAddNewMultiClass();
         $migration_mapping_types = array('OldDataModelSurveyMigrationMapping' => 'Old Survey Data Mapping');
         $multi_class_selector->setClasses($migration_mapping_types);
         $config->addComponent($multi_class_selector);
         $gridField = new GridField('MigrationMappings', 'Migration Mappings', $this->MigrationMappings(), $config);
         $fields->add($gridField);
     }
     return $fields;
 }
 /**
  * Add FocusPoint field for selecting focus
  */
 public function updateCMSFields(FieldList $fields)
 {
     $f = new FocusPointField($this->owner);
     if ($fields->hasTabSet()) {
         $fields->addFieldToTab('Root.Main', $f);
     } else {
         $fields->add($f);
     }
 }
 public function getCMSFields()
 {
     $fields = new FieldList();
     $fields->add($upload_0 = new UploadField('Image', 'Photo'));
     $upload_0->setFolderName('summits/overview/networking');
     $upload_0->setAllowedMaxFileNumber(1);
     $upload_0->setAllowedFileCategories('image');
     return $fields;
 }
 public function updateCMSFields(FieldList $fields)
 {
     //Add FocusPoint field for selecting focus
     $f = new FocusPointField($name = "FocusXY", $title = "Focus point", $value = $this->owner->FocusX . ',' . $this->owner->FocusY, $imageID = $this->owner->ID);
     //$f->setValue(FocusPointField::sourceCoordsToFieldValue($this->owner->FocusX,$this->owner->FocusY));
     if ($fields->hasTabSet()) {
         $fields->addFieldToTab('Root.Main', $f);
     } else {
         $fields->add($f);
     }
 }
 function getCMSFields()
 {
     $fields = new FieldList();
     $fields->add(new TextField('Name', 'Name'));
     if ($this->ID) {
         $config = GridFieldConfig_RelationEditor::create(PHP_INT_MAX);
         $config->addComponent(new GridFieldSortableRows('Order'));
         $data_columns = $config->getComponentByType('GridFieldDataColumns');
         $data_columns->setDisplayFields(array('Name' => 'Name', 'Type.Name' => 'Type', 'Status' => 'Status'));
         $gridField = new GridField('Capabilities', 'Capabilities', $this->Capabilities(), $config);
         $fields->add($gridField);
         $config = GridFieldConfig_RelationEditor::create(PHP_INT_MAX);
         $config->addComponent(new GridFieldSortableRows('Order'));
         $data_columns = $config->getComponentByType('GridFieldDataColumns');
         $data_columns->setDisplayFields(array('Name' => 'Name', 'Guidance' => 'Guidance', 'Status' => 'Status'));
         $gridField = new GridField('DesignatedSections', 'Designated Sections', $this->DesignatedSections(), $config);
         $fields->add($gridField);
     }
     return $fields;
 }
 public function __construct($controller, $name, $discussion = null)
 {
     // Get member and upload path
     $member = Member::currentUser();
     $fields = new FieldList(HiddenField::create("ID"), TextField::create("Title", _t("Discussions.GiveTitle", "Give your discussion a title")), TextAreaField::create("Content", _t("Discussions.AddContent", "And some content (optional)")), TextField::create("Tags", _t("Discussions.AddTags", "Finally, add some tags (optional)"))->setAttribute("placeholder", "Tag 1, Tag 2"));
     if ($controller->Categories()->exists()) {
         $fields->add(CheckboxsetField::create("Categories", _t("Discussions.Categories", "Or Post this under a category? (optional)"), $controller->Categories()->map()));
     }
     $actions = new FieldList(FormAction::create("post")->setTitle(_t("Discussions.Post", "Post")));
     $validator = new RequiredFields("Title", "Content");
     parent::__construct($controller, $name, $fields, $actions, $validator);
 }
 public function index()
 {
     $site = SiteConfig::current_site_config();
     $order = $this->order;
     // Setup the paypal gateway URL
     if (Director::isDev()) {
         $gateway_url = "https://www.sandbox.paypal.com/cgi-bin/webscr";
     } else {
         $gateway_url = "https://www.paypal.com/cgi-bin/webscr";
     }
     $callback_url = Controller::join_links(Director::absoluteBaseURL(), Payment_Controller::config()->url_segment, "callback", $this->payment_gateway->ID);
     $success_url = Controller::join_links(Director::absoluteBaseURL(), Payment_Controller::config()->url_segment, 'complete');
     $error_url = Controller::join_links(Director::absoluteBaseURL(), Payment_Controller::config()->url_segment, 'complete', 'error');
     $back_url = Controller::join_links(Director::absoluteBaseURL(), Checkout_Controller::config()->url_segment, "finish");
     $fields = new FieldList(HiddenField::create('business', null, $this->payment_gateway->BusinessID), HiddenField::create('item_name', null, $site->Title), HiddenField::create('cmd', null, "_cart"), HiddenField::create('paymentaction', null, "sale"), HiddenField::create('invoice', null, $order->OrderNumber), HiddenField::create('custom', null, $order->OrderNumber), HiddenField::create('upload', null, 1), HiddenField::create('discount_amount_cart', null, $order->DiscountAmount), HiddenField::create('amount', null, $order->Total), HiddenField::create('currency_code', null, $site->Currency()->GatewayCode), HiddenField::create('first_name', null, $order->FirstName), HiddenField::create('last_name', null, $order->Surname), HiddenField::create('address1', null, $order->Address1), HiddenField::create('address2', null, $order->Address2), HiddenField::create('city', null, $order->City), HiddenField::create('zip', null, $order->PostCode), HiddenField::create('country', null, $order->Country), HiddenField::create('email', null, $order->Email), HiddenField::create('return', null, $success_url), HiddenField::create('notify_url', null, $callback_url), HiddenField::create('cancel_return', null, $error_url));
     $i = 1;
     foreach ($order->Items() as $item) {
         $fields->add(HiddenField::create('item_name_' . $i, null, $item->Title));
         $fields->add(HiddenField::create('amount_' . $i, null, number_format($item->Price + $item->Tax, 2)));
         $fields->add(HiddenField::create('quantity_' . $i, null, $item->Quantity));
         $i++;
     }
     // Add shipping as an extra product
     $fields->add(HiddenField::create('item_name_' . $i, null, _t("Commerce.Postage", "Postage")));
     $fields->add(HiddenField::create('amount_' . $i, null, number_format($order->PostageCost + $order->PostageTax, 2)));
     $fields->add(HiddenField::create('quantity_' . $i, null, "1"));
     $actions = FieldList::create(LiteralField::create('BackButton', '<a href="' . $back_url . '" class="btn btn-red commerce-action-back">' . _t('Commerce.Back', 'Back') . '</a>'), FormAction::create('Submit', _t('Commerce.ConfirmPay', 'Confirm and Pay'))->addExtraClass('btn')->addExtraClass('btn-green'));
     $form = Form::create($this, 'Form', $fields, $actions)->addExtraClass('forms')->setFormMethod('POST')->setFormAction($gateway_url);
     $this->extend('updateForm', $form);
     return array("Title" => _t('Commerce.CheckoutSummary', "Summary"), "MetaTitle" => _t('Commerce.CheckoutSummary', "Summary"), "Form" => $form);
 }