| Total Complexity | 4 |
| Total Lines | 30 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 10 | class PageControllerExtension extends Extension |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * @param $form |
||
| 14 | */ |
||
| 15 | public function updateAddToCartForm(&$form) |
||
| 16 | { |
||
| 17 | if ($this->owner->data()->getActiveDiscount()) { |
||
| 18 | $code = $this->owner->data()->Code; |
||
| 19 | $fields = $form->Fields(); |
||
| 20 | $fields->push( |
||
| 21 | HiddenField::create(AddToCartForm::getGeneratedValue( |
||
| 22 | $code, |
||
| 23 | 'discount_quantity_percentage', |
||
| 24 | $this->getDiscountFieldValue() |
||
| 25 | ))->setValue($this->getDiscountFieldValue()) |
||
| 26 | ); |
||
| 27 | } |
||
| 28 | } |
||
| 29 | |||
| 30 | /** |
||
| 31 | * @return string |
||
| 32 | */ |
||
| 33 | public function getDiscountFieldValue() |
||
| 40 | } |
||
| 41 | } |
||
| 42 |