Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Hide category from registered customers?


MarcellaE

Recommended Posts

Posted

I'm trying to get the Contrib - Hide Category to work. I want to show a category to the general public but want to hide it from certain registered users.

This contrib works to hide a category unless youre logged in and it lets the Admin then decide which registered/logged in users can view that category.

 

I'm trying to make it just the opposite - show the category but hide it from certain registered users (by default the category is hidden. I want to make the default not hidden).

I think the trick is here in this code to turn it around but I don't know where or how. Any ideas?? :

 

//HIDE_CATEGORY CHANGES - START

 

 

 

//default categories query

 

$categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '0' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' and c.categories_hide=0 order by sort_order, cd.categories_name");

 

 

 

if (tep_session_is_registered('customer_id'))

 

{

 

$customers_query = tep_db_query("select c.customers_view_category from " . TABLE_CUSTOMERS . " c where c.customers_id = '" . (int)$customer_id . "'");

 

$customers_view_category = tep_db_fetch_array($customers_query);

 

if($customers_view_category['customers_view_category'] == 1)

 

{

 

$categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '0' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name");

 

}

 

}

 

//HIDE_CATEGORY CHANGES - END

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...