| @@ 17-40 (lines=24) @@ | ||
| 14 | /** |
|
| 15 | * @param FieldList $fields |
|
| 16 | */ |
|
| 17 | public function updateCMSFields(FieldList $fields) |
|
| 18 | { |
|
| 19 | $fields->removeByName(array( |
|
| 20 | 'PurchaseLimit', |
|
| 21 | 'EmbargoLimit', |
|
| 22 | 'NumberPurchased', |
|
| 23 | )); |
|
| 24 | ||
| 25 | $fields->addFieldsToTab('Root.Inventory', array( |
|
| 26 | CheckboxField::create('ControlInventory', 'Control Inventory?') |
|
| 27 | ->setDescription('limit the number of this product available for purchase'), |
|
| 28 | DisplayLogicWrapper::create( |
|
| 29 | NumericField::create('PurchaseLimit') |
|
| 30 | ->setTitle('Number Available') |
|
| 31 | ->setDescription('add to cart form will be disabled once number available equals purchased'), |
|
| 32 | ReadonlyField::create('NumberPurchased', 'Purchased', $this->getNumberPurchased())//, |
|
| 33 | /* |
|
| 34 | NumericField::create('EmbargoLimit') |
|
| 35 | ->setTitle('Embargo Time') |
|
| 36 | ->setDescription('time in seconds to reserve an item once added to cart') |
|
| 37 | */ |
|
| 38 | )->displayIf('ControlInventory')->isChecked()->end(), |
|
| 39 | )); |
|
| 40 | } |
|
| 41 | ||
| 42 | /** |
|
| 43 | * @return bool |
|
| @@ 16-34 (lines=19) @@ | ||
| 13 | /** |
|
| 14 | * @param FieldList $fields |
|
| 15 | */ |
|
| 16 | public function updateCMSFields(FieldList $fields) |
|
| 17 | { |
|
| 18 | $fields->removeByName(array( |
|
| 19 | 'PurchaseLimit', |
|
| 20 | 'EmbargoLimit', |
|
| 21 | 'NumberPurchased', |
|
| 22 | )); |
|
| 23 | ||
| 24 | $fields->addFieldsToTab('Root.Inventory', array( |
|
| 25 | CheckboxField::create('ControlInventory', 'Control Inventory?') |
|
| 26 | ->setDescription('limit the number of this product available for purchase'), |
|
| 27 | DisplayLogicWrapper::create( |
|
| 28 | NumericField::create('PurchaseLimit') |
|
| 29 | ->setTitle('Number Available') |
|
| 30 | ->setDescription('add to cart form will be disabled once number available equals purchased'), |
|
| 31 | ReadonlyField::create('NumberPurchased', 'Purchased', $this->getNumberPurchased())//, |
|
| 32 | )->displayIf('ControlInventory')->isChecked()->end(), |
|
| 33 | )); |
|
| 34 | } |
|
| 35 | ||
| 36 | /** |
|
| 37 | * @return bool |
|