I need help on modify this best seller script to comply with cat_filter by multisite.

The problem: Best seller script shows all the product across multiple carts. How do I implement or trigger the categories filter set by multisite?

Anyone can help?


Script as below:

Code:
<?php
/**
 * Best Sellers Alpha 1
 */

if (BEST_SELLERS_SHOW_OUT_OF_STOCK == 'true') {

$listing_sql = "select distinct p.products_quantity, p.products_id, p.products_image, pd.products_name, p.products_ordered
                      from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
                      where p.products_status = '1'
                      and p.products_ordered > 0
					  and p.products_id = pd.products_id
                      and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
                      order by p.products_ordered desc, pd.products_name";
					  
} else {
					  
$listing_sql = "select distinct p.products_quantity, p.products_id, p.products_image, pd.products_name, p.products_ordered
                      from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
                      where p.products_status = '1'
                      and p.products_ordered > 0
					  and p.products_id = pd.products_id
                      and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
					  and p.products_quantity > 0
                      order by p.products_ordered desc, pd.products_name";
					  
}
$define_list = array('PRODUCT_LIST_MODEL' => PRODUCT_LIST_MODEL,
  'PRODUCT_LIST_NAME' => PRODUCT_LIST_NAME,
  'PRODUCT_LIST_MANUFACTURER' => PRODUCT_LIST_MANUFACTURER,
  'PRODUCT_LIST_PRICE' => PRODUCT_LIST_PRICE,
  'PRODUCT_LIST_QUANTITY' => PRODUCT_LIST_QUANTITY,
  'PRODUCT_LIST_WEIGHT' => PRODUCT_LIST_WEIGHT,
  'PRODUCT_LIST_IMAGE' => PRODUCT_LIST_IMAGE);

  /*                         ,
  'PRODUCT_LIST_BUY_NOW' => PRODUCT_LIST_BUY_NOW);
  */
  asort($define_list);
  reset($define_list);
  $column_list = array();
  foreach ($define_list as $key => $value)
  {
    if ($value > 0) $column_list[] = $key;
  }
?>
Thank you in advanced