Code Duplication    Length = 15-17 lines in 2 locations

catalog/includes/functions/general.php 2 locations

@@ 567-581 (lines=15) @@
564
////
565
// Return all subcategory IDs
566
// TABLES: categories
567
  function tep_get_subcategories(&$subcategories_array, $parent_id = 0) {
568
    $OSCOM_Db = Registry::get('Db');
569
570
    $Qsub = $OSCOM_Db->prepare('select categories_id from :table_categories where parent_id = :parent_id');
571
    $Qsub->bindInt(':parent_id', $parent_id);
572
    $Qsub->execute();
573
574
    while ($Qsub->fetch()) {
575
      $subcategories_array[sizeof($subcategories_array)] = $Qsub->valueInt('categories_id');
576
577
      if ($Qsub->valueInt('categories_id') != $parent_id) {
578
        tep_get_subcategories($subcategories_array, $Qsub->valueInt('categories_id'));
579
      }
580
    }
581
  }
582
583
////
584
// Parse search string into indivual objects
@@ 870-886 (lines=17) @@
867
////
868
// Recursively go through the categories and retreive all parent categories IDs
869
// TABLES: categories
870
  function tep_get_parent_categories(&$categories, $categories_id) {
871
    $OSCOM_Db = Registry::get('Db');
872
873
    $Qparent = $OSCOM_Db->prepare('select parent_id from :table_categories where categories_id = :categories_id');
874
    $Qparent->bindInt(':categories_id', $categories_id);
875
    $Qparent->execute();
876
877
    while ($Qparent->fetch()) {
878
      if ($Qparent->valueInt('parent_id') == 0) return true;
879
880
      $categories[sizeof($categories)] = $Qparent->valueInt('parent_id');
881
882
      if ($Qparent->valueInt('parent_id') != $categories_id) {
883
        tep_get_parent_categories($categories, $Qparent->valueInt('parent_id'));
884
      }
885
    }
886
  }
887
888
////
889
// Construct a category path to the product