/** * Manipulate search form to add some grouping. * * @return void * * @author Sebastian Diel <*****@*****.**> * @since 25.06.2014 */ public function SearchForm() { $searchForm = parent::SearchForm(); $fields = $searchForm->Fields(); $order = singleton('SilvercartOrder'); $basicLabelField = new HeaderField('BasicLabelField', $order->fieldLabel('BasicData')); $customerLabelField = new HeaderField('CustomerLabelField', $order->fieldLabel('CustomerData')); $positionLabelField = new HeaderField('PositionLabelField', $order->fieldLabel('OrderPositionData')); $miscLabelField = new HeaderField('MiscLabelField', $order->fieldLabel('MiscData')); $origOrderStatusField = $fields->dataFieldByName('q[SilvercartOrderStatus__ID]'); $orderStatusField = new SilvercartMultiDropdownField('q[SilvercartOrderStatus__ID]', $origOrderStatusField->Title(), $origOrderStatusField->getSource()); $positionQuantityField = new TextField('q[OrderPositionQuantity]', $order->fieldLabel('OrderPositionQuantity')); $positionIsLimitField = new CheckboxField('q[OrderPositionIsLimit]', $order->fieldLabel('OrderPositionIsLimit')); $limitField = new TextField('q[SearchResultsLimit]', $order->fieldLabel('SearchResultsLimit')); $fields->insertBefore($basicLabelField, 'q[OrderNumber]'); $fields->insertAfter($fields->dataFieldByName('q[Created]'), 'q[OrderNumber]'); $fields->insertAfter($orderStatusField, 'q[IsSeen]'); $fields->insertBefore($customerLabelField, 'q[Member__CustomerNumber]'); $fields->insertBefore($positionLabelField, 'q[SilvercartOrderPositions__ProductNumber]'); $fields->insertAfter($positionQuantityField, 'q[SilvercartOrderPositions__ProductNumber]'); $fields->insertAfter($positionIsLimitField, 'q[OrderPositionQuantity]'); $fields->insertAfter($miscLabelField, 'q[OrderPositionIsLimit]'); $fields->insertAfter($limitField, 'q[MiscLabelField]'); $fields->dataFieldByName('q[SilvercartOrderStatus__ID]')->setEmptyString(_t('SilvercartOrderSearchForm.PLEASECHOOSE')); $fields->dataFieldByName('q[SilvercartPaymentMethod__ID]')->setEmptyString(_t('SilvercartOrderSearchForm.PLEASECHOOSE')); $fields->dataFieldByName('q[SilvercartShippingMethod__ID]')->setEmptyString(_t('SilvercartOrderSearchForm.PLEASECHOOSE')); $fields->dataFieldByName('q[SilvercartShippingAddress__SilvercartCountry__ID]')->setEmptyString(_t('SilvercartOrderSearchForm.PLEASECHOOSE')); return $searchForm; }
/** * Manipulate search form to add some grouping. * * @return void * * @author Sebastian Diel <*****@*****.**> * @since 25.06.2014 */ public function SearchForm() { $searchForm = parent::SearchForm(); $fields = $searchForm->Fields(); $customer = singleton('Member'); $basicLabelField = new HeaderField('BasicLabelField', $customer->fieldLabel('BasicData')); $addressLabelField = new HeaderField('AddressLabelField', $customer->fieldLabel('AddressData')); $invoiceLabelField = new HeaderField('InvoiceLabelField', $customer->fieldLabel('InvoiceData')); $shippingLabelField = new HeaderField('ShippingLabelField', $customer->fieldLabel('ShippingData')); $fields->insertBefore($basicLabelField, 'q[FirstName]'); $fields->insertBefore($fields->dataFieldByName('q[CustomerNumber]'), 'q[FirstName]'); $fields->insertBefore($fields->dataFieldByName('q[Email]'), 'q[FirstName]'); $fields->insertAfter($addressLabelField, 'q[SubscribedToNewsletter]'); $fields->insertAfter($invoiceLabelField, 'q[SilvercartAddresses__SilvercartCountryID]'); $fields->insertAfter($shippingLabelField, 'q[SilvercartInvoiceAddress__SilvercartCountry__ID]'); return $searchForm; }
/** * Builds and returns the edit form. * Add the component SilvercartGridFieldDuplicateAction to the GridField. * * @param int $id The current records ID. Won't be used for ModelAdmins. * @param FieldList $fields Fields to use. Won't be used for ModelAdmins. * * @return Form */ public function getEditForm($id = null, $fields = null) { $form = parent::getEditForm($id, $fields); $this->getGridFieldConfig($form)->addComponent(new SilvercartGridFieldDuplicateAction()); return $form; }