Version: current

     1 <?php
     2
     3 /**
     4  * Расширения группы для указания групповых скидок
     5  *
     6  * @package cart
     7  * @author dvp
     8  */
     9 class ExtendGroupDiscount extends DataObjectDecorator {
    10
    11     function extraStatics() {
    12         return array(
    13             'db' => array(
    14                 'Discount' => 'Int', // Скидка %
    15             ),
    16         );
    17     }
    18
    19     function updateCMSFields(& $fields) {
    20         $fields->insertAfter(new NumericField('Discount', $this->owner->fieldLabel('Discount')), 'Title');
    21     }
    22
    23     function Discount() {
    24         $discount = $this->owner->Discount;
    25         if ($discount > 0) {
    26             return $discount;
    27         }
    28         return false;
    29     }
    30 }
    31

[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -