Does anyone know why this "Login To See Prices" code isnt working.

I am hiding certain products within the certain categories by using the categort and product ID.
Customer can see the product details but needs to login to see the prices of those products. I was able to do this with the below code in includes/functions_categories.php

Array IDs shows category IDs and products IDs within the category.
Is there a updated version?
My Zencart version is v1.5.7c

Thanks


$chk_category_sql = "SELECT master_categories_id FROM " . TABLE_PRODUCTS . " WHERE products_id = '" . (int)$product_id . "'";
$chk_category = $db->Execute($chk_category_sql);
if ($_SESSION['customer_id'] ==0 && in_array((int)$chk_category->fields['master_categories_id'], array(1160,1058,1088,980,1022,1023,1181,1165,1167,1166)) ) {
$login_for_price = '<a href="' . zen_href_link(FILENAME_LOGIN, '', 'SSL') . '">' . TEXT_LOGIN_FOR_PRICE_BUTTON_REPLACE . '</a>';
return $login_for_price;
}
// eof: Login for Price button