protected function editableItems()
    {
        $editables = ArrayList::create();
        foreach ($this->items as $item) {
            $buyable = $item->Buyable();
            if (!$buyable) {
                continue;
            }
            // If the buyable is a variation, use the belonging product instead for variation-form generation
            if ($buyable instanceof Variation) {
                $buyable = $buyable->Product();
            }
            $name = $this->name . "[$item->ID]";
            $quantity = TextField::create(
                $name . '[Quantity]',
                'Quantity',
                $item->Quantity
            )
                ->addExtraClass('numeric')
                ->setAttribute('type', 'number')
                ->setAttribute('min', '0');

            $variationfield = false;
            if ($buyable->hasMany('Variations')) {
                $variations = $buyable->Variations();
                if ($variations->exists()) {
                    $variationfield = DropdownField::create(
                        $name . '[ProductVariationID]',
                        _t('SilverShop\Model\Variation\Variation.SINGULARNAME', 'Variation'),
                        $variations->map('ID', 'Title'),
                        $item->ProductVariationID
                    );
                }
            }
            $remove = CheckboxField::create($name . '[Remove]', _t('SilverShop\Generic.Remove', 'Remove'));
            $editables->push(
                $item->customise(
                    array(
                        'QuantityField' => $quantity,
                        'VariationField' => $variationfield,
                        'RemoveField' => $remove,
                    )
                )
            );
        }

        if (is_callable($this->editableItemsCallback)) {
            $callback = $this->editableItemsCallback;
            $editables = $callback($editables);
        }

        return $editables;
    }
protected function editableItems()
    {
        $editables = ArrayList::create();
        foreach ($this->items as $item) {
            $buyable = $item->Buyable();
            if (!$buyable) {
                continue;
            }
            // If the buyable is a variation, use the belonging product instead for variation-form generation
            if ($buyable instanceof Variation) {
                $buyable = $buyable->Product();
            }
            $name = $this->name . "[$item->ID]";
            $quantity = TextField::create(
                $name . '[Quantity]',
                'Quantity',
                $item->Quantity
            )
                ->addExtraClass('numeric')
                ->setAttribute('type', 'number')
                ->setAttribute('min', '0');

            $variationfield = false;
            if ($buyable->hasMany('Variations')) {
                $variations = $buyable->Variations();
                if ($variations->exists()) {
                    $variationfield = DropdownField::create(
                        $name . '[ProductVariationID]',
                        _t('SilverShop\Model\Variation\Variation.SINGULARNAME', 'Variation'),
                        $variations->map('ID', 'Title'),
                        $item->ProductVariationID
                    );
                }
            }
            $remove = CheckboxField::create($name . '[Remove]', _t('SilverShop\Generic.Remove', 'Remove'));
            $editables->push(
                $item->customise(
                    array(
                        'QuantityField' => $quantity,
                        'VariationField' => $variationfield,
                        'RemoveField' => $remove,
                    )
                )
            );
        }

        if (is_callable($this->editableItemsCallback)) {
            $callback = $this->editableItemsCallback;
            $editables = $callback($editables);
        }

        return $editables;
    }
protected function editableItems ( ) { $ editables = ArrayList :: create ( ) ; foreach ( $ this -> items as $ item ) { $ buyable = $ item -> Buyable ( ) ; if ( ! $ buyable ) { continue ; } // If the buyable is a variation, use the belonging product instead for variation-form generation if ( $ buyable instanceof Variation ) { $ buyable = $ buyable -> Product ( ) ; } $ name = $ this -> name . "[$item->ID]" ; $ quantity = TextField :: create ( $ name . '[Quantity]' , 'Quantity' , $ item -> Quantity ) -> addExtraClass ( 'numeric' ) -> setAttribute ( 'type' , 'number' ) -> setAttribute ( 'min' , '0' ) ; $ variationfield = false ; if ( $ buyable -> hasMany ( 'Variations' ) ) { $ variations = $ buyable -> Variations ( ) ; if ( $ variations -> exists ( ) ) { $ variationfield = DropdownField :: create ( $ name . '[ProductVariationID]' , _t ( 'SilverShop\Model\Variation\Variation.SINGULARNAME' , 'Variation' ) , $ variations -> map ( 'ID' , 'Title' ) , $ item -> ProductVariationID ) ; } } $ remove = CheckboxField :: create ( $ name . '[Remove]' , _t ( 'SilverShop\Generic.Remove' , 'Remove' ) ) ; $ editables -> push ( $ item -> customise ( array ( 'QuantityField' => $ quantity , 'VariationField' => $ variationfield , 'RemoveField' => $ remove , ) ) ) ; } if ( is_callable ( $ this -> editableItemsCallback ) ) { $ callback = $ this -> editableItemsCallback ; $ editables = $ callback ( $ editables ) ; } return $ editables ; }
Add quantity, variation and remove fields to the
item set.

@param SS_List $items
Add quantity variation and remove fields to the item set .