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