| Conditions | 5 |
| Paths | 4 |
| Total Lines | 19 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 30 |
| Changes | 0 | ||
| 1 | <?php |
||
| 41 | public function updateCollectionItems(&$collection, &$searchCriteria) |
||
| 42 | { |
||
| 43 | $class = $this->owner->data()->ManagedClass; |
||
| 44 | |||
| 45 | if (isset($searchCriteria['CategoryID']) && $searchCriteria['CategoryID'] != '') { |
||
| 46 | $category = CatalogCategory::get()->byID($searchCriteria['CategoryID']); |
||
| 47 | $products = $category->Products(); |
||
| 48 | $docs = new ArrayList(); |
||
| 49 | |||
| 50 | foreach($products as $product) { |
||
| 51 | $records = $class::get()->filter(['Products.ID' => $product->ID]); |
||
| 52 | foreach ($records as $record) { |
||
| 53 | $docs->push($record); |
||
| 54 | } |
||
| 55 | } |
||
| 56 | |||
| 57 | $collection = $docs; |
||
| 58 | } |
||
| 59 | } |
||
| 60 | } |