Conditions | 4 |
Paths | 4 |
Total Lines | 18 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Tests | 4 |
CRAP Score | 9.8312 |
Changes | 0 |
1 | <?php |
||
14 | 1 | public function updateFoxyStripePurchaseForm(&$form) |
|
15 | { |
||
16 | 1 | if (!$this->owner->getIsProductAvailable()) { |
|
17 | 1 | $form = false; |
|
18 | 1 | return; |
|
19 | } |
||
20 | |||
21 | if ($this->owner->getHasInventory()) { |
||
22 | $quantityMax = $this->owner->getNumberAvailable(); |
||
23 | $count = 1; |
||
24 | $quantity = array(); |
||
25 | while ($count <= $quantityMax) { |
||
26 | $countVal = ProductPage::getGeneratedValue($this->owner->Code, 'quantity', $count, 'value'); |
||
27 | $quantity[$countVal] = $count; |
||
28 | $count++; |
||
29 | } |
||
30 | $fields = $form->Fields(); |
||
31 | $fields->replaceField('quantity', DropdownField::create('quantity', 'Quantity', $quantity)); |
||
32 | } |
||
35 |