Code Duplication    Length = 13-13 lines in 2 locations

code/ModuleProductGroup.php 2 locations

@@ 269-281 (lines=13) @@
266
                }
267
            }
268
            $tags = EcommerceProductTag::get()->filterAny(array("Title:PartialMatch" => $search, "Synonyms:PartialMatch" => $search, "Explanation:PartialMatch" => $search));
269
            if ($tags->count()) {
270
                foreach ($tags as $tag) {
271
                    $rows = DB::query("SELECT ProductID FROM EcommerceProductTag_Products WHERE EcommerceProductTagID = ".$tag->ID);
272
                    if ($rows) {
273
                        foreach ($rows as $row) {
274
                            $item = ModuleProduct::get()->byID($row["ProductID"]);
275
                            if ($item) {
276
                                $data["Results"]->push($item);
277
                            }
278
                        }
279
                    }
280
                }
281
            }
282
            $authors = Member::get()
283
                ->filterAny(
284
                    array(
@@ 289-301 (lines=13) @@
286
                        "FirstName:PartialMatch" => $search,
287
                        "Surname:PartialMatch" => $search)
288
                );
289
            if ($authors->count()) {
290
                foreach ($authors as $author) {
291
                    $rows = DB::query("SELECT \"ModuleProductID\" FROM \"ModuleProduct_Authors\" WHERE \"MemberID\" = ".$author->ID);
292
                    if ($rows) {
293
                        foreach ($rows as $row) {
294
                            $item = ModuleProduct::get()->byID($row["ModuleProductID"]);
295
                            if ($item) {
296
                                $data["Results"]->push($item);
297
                            }
298
                        }
299
                    }
300
                }
301
            }
302
        }
303
        if ($data["Results"] && $data["Results"] instanceof DataObjectSet) {
304
            $data["Results"]->removeDuplicates();