Product Detail, Products Blocks Same Category

Hi anyone know how to list block products in product detail only same categories?

for eg: best seller block in product detail. show protuct from all categories ?

maybe this help to someone.

in get_products_before_select hook

    if (AREA == C) {
        if (isset($_REQUEST['product_id'])) {
            $detail = array('newest', 'most_popular');
            if (isset($params['block_data']['content']['items']['filling']) && in_array($params['block_data']['content']['items']['filling'], $detail)) {
                $cid = db_get_field('SELECT category_id FROM ?:products_categories WHERE product_id = ?i AND link_type = ?s', $_REQUEST['product_id'], 'M');
                $params['cid'] = $cid;
            }
        }
    }