public function updateCMSFields(FieldList $fields)
    {
        $fields->addFieldsToTab('Root.Variations', [
            ListboxField::create(
                'VariationAttributeTypes',
                _t(__CLASS__ . '.Attributes', "Attributes"),
                AttributeType::get()->map('ID', 'Title')->toArray()
            )
                ->setDescription(_t(
                    __CLASS__ . '.AttributesDescription',
                    'These are fields to indicate the way(s) each variation varies. Once selected, they can be edited on each variation.'
                )),
            GridField::create(
                'Variations',
                _t(__CLASS__ . '.Variations', 'Variations'),
                $this->owner->Variations(),
                GridFieldConfig_RecordEditor::create()
            )
        ]);
        if ($this->owner->Variations()->exists()) {
            $fields->addFieldToTab(
                'Root.Pricing',
                LabelField::create(
                    'variationspriceinstructinos',
                    _t(
                        __CLASS__ . '.VariationsInfo',
                        'Price - Because you have one or more variations, the price can be set in the "Variations" tab.'
                    )
                )
            );
            $fields->removeFieldFromTab('Root.Pricing', 'BasePrice');
            $fields->removeFieldFromTab('Root.Main', 'InternalItemID');
        }
    }
public function updateCMSFields(FieldList $fields)
    {
        $fields->addFieldsToTab('Root.Variations', [
            ListboxField::create(
                'VariationAttributeTypes',
                _t(__CLASS__ . '.Attributes', "Attributes"),
                AttributeType::get()->map('ID', 'Title')->toArray()
            )
                ->setDescription(_t(
                    __CLASS__ . '.AttributesDescription',
                    'These are fields to indicate the way(s) each variation varies. Once selected, they can be edited on each variation.'
                )),
            GridField::create(
                'Variations',
                _t(__CLASS__ . '.Variations', 'Variations'),
                $this->owner->Variations(),
                GridFieldConfig_RecordEditor::create()
            )
        ]);
        if ($this->owner->Variations()->exists()) {
            $fields->addFieldToTab(
                'Root.Pricing',
                LabelField::create(
                    'variationspriceinstructinos',
                    _t(
                        __CLASS__ . '.VariationsInfo',
                        'Price - Because you have one or more variations, the price can be set in the "Variations" tab.'
                    )
                )
            );
            $fields->removeFieldFromTab('Root.Pricing', 'BasePrice');
            $fields->removeFieldFromTab('Root.Main', 'InternalItemID');
        }
    }
public function updateCMSFields ( FieldList $ fields ) { $ fields -> addFieldsToTab ( 'Root.Variations' , [ ListboxField :: create ( 'VariationAttributeTypes' , _t ( __CLASS__ . '.Attributes' , "Attributes" ) , AttributeType :: get ( ) -> map ( 'ID' , 'Title' ) -> toArray ( ) ) -> setDescription ( _t ( __CLASS__ . '.AttributesDescription' , 'These are fields to indicate the way(s) each variation varies. Once selected, they can be edited on each variation.' ) ) , GridField :: create ( 'Variations' , _t ( __CLASS__ . '.Variations' , 'Variations' ) , $ this -> owner -> Variations ( ) , GridFieldConfig_RecordEditor :: create ( ) ) ] ) ; if ( $ this -> owner -> Variations ( ) -> exists ( ) ) { $ fields -> addFieldToTab ( 'Root.Pricing' , LabelField :: create ( 'variationspriceinstructinos' , _t ( __CLASS__ . '.VariationsInfo' , 'Price - Because you have one or more variations, the price can be set in the "Variations" tab.' ) ) ) ; $ fields -> removeFieldFromTab ( 'Root.Pricing' , 'BasePrice' ) ; $ fields -> removeFieldFromTab ( 'Root.Main' , 'InternalItemID' ) ; } }
Adds variations specific fields to the CMS.
Adds variations specific fields to the CMS .