Conditions | 5 |
Paths | 4 |
Total Lines | 19 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 30 |
Changes | 0 |
1 | <?php |
||
51 | public function updateCollectionItems(&$collection, &$searchCriteria) |
||
52 | { |
||
53 | $class = $this->owner->data()->ManagedClass; |
||
54 | |||
55 | if (isset($searchCriteria['CategoryID']) && $searchCriteria['CategoryID'] != '') { |
||
56 | $category = CatalogCategory::get()->byID($searchCriteria['CategoryID']); |
||
57 | $products = $category->Products(); |
||
58 | $docs = new ArrayList(); |
||
59 | |||
60 | foreach($products as $product) { |
||
61 | $records = $class::get()->filter(['Products.ID' => $product->ID]); |
||
62 | foreach ($records as $record) { |
||
63 | $docs->push($record); |
||
64 | } |
||
65 | } |
||
66 | |||
67 | $collection = $docs; |
||
68 | } |
||
69 | } |
||
70 | } |