Code Duplication    Length = 9-14 lines in 4 locations

catalog/includes/functions/general.php 1 location

@@ 100-109 (lines=10) @@
97
////
98
// Return a product's name
99
// TABLES: products
100
  function tep_get_products_name($product_id, $language = '') {
101
    global $languages_id;
102
103
    if (empty($language)) $language = $languages_id;
104
105
    $product_query = tep_db_query("select products_name from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$product_id . "' and language_id = '" . (int)$language . "'");
106
    $product = tep_db_fetch_array($product_query);
107
108
    return $product['products_name'];
109
  }
110
111
////
112
// Return a product's special price (returns nothing if there is no offer)

catalog/admin/includes/functions/general.php 3 locations

@@ 473-486 (lines=14) @@
470
  // Description : Function to retrieve the state/province code (as in FL for Florida etc)
471
  //
472
  ////////////////////////////////////////////////////////////////////////////////////////////////
473
  function tep_get_zone_code($country, $zone, $def_state) {
474
475
    $state_prov_query = tep_db_query("select zone_code from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country . "' and zone_id = '" . (int)$zone . "'");
476
477
    if (!tep_db_num_rows($state_prov_query)) {
478
      $state_prov_code = $def_state;
479
    }
480
    else {
481
      $state_prov_values = tep_db_fetch_array($state_prov_query);
482
      $state_prov_code = $state_prov_values['zone_code'];
483
    }
484
485
    return $state_prov_code;
486
  }
487
488
  function tep_get_uprid($prid, $params) {
489
    $uprid = $prid;
@@ 527-535 (lines=9) @@
524
    return $category['categories_name'];
525
  }
526
527
  function tep_get_orders_status_name($orders_status_id, $language_id = '') {
528
    global $languages_id;
529
530
    if (!$language_id) $language_id = $languages_id;
531
    $orders_status_query = tep_db_query("select orders_status_name from " . TABLE_ORDERS_STATUS . " where orders_status_id = '" . (int)$orders_status_id . "' and language_id = '" . (int)$language_id . "'");
532
    $orders_status = tep_db_fetch_array($orders_status_query);
533
534
    return $orders_status['orders_status_name'];
535
  }
536
537
  function tep_get_orders_status() {
538
    global $languages_id;
@@ 550-558 (lines=9) @@
547
    return $orders_status_array;
548
  }
549
550
  function tep_get_products_name($product_id, $language_id = 0) {
551
    global $languages_id;
552
553
    if ($language_id == 0) $language_id = $languages_id;
554
    $product_query = tep_db_query("select products_name from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$product_id . "' and language_id = '" . (int)$language_id . "'");
555
    $product = tep_db_fetch_array($product_query);
556
557
    return $product['products_name'];
558
  }
559
560
  function tep_get_products_description($product_id, $language_id) {
561
    $product_query = tep_db_query("select products_description from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$product_id . "' and language_id = '" . (int)$language_id . "'");