Thanks for the tip. I should have posted that I have it mostly figured out.
I have a wholesale category that I don't want anyone but wholesalers to see.
So I had to make some hacks that I know will cause problems when we upgrade - if anyone has some ideas for improvement, I'm up for that.
Changes made:
includes/modules/pages/login/header_php.php
I added "customers_group_pricing" to the SQL query
Code:
$check_customer_query = "SELECT customers_id, customers_firstname, customers_lastname, customers_password,
customers_email_address, customers_default_address_id,
customers_authorization, customers_group_pricing, customers_referral
FROM " . TABLE_CUSTOMERS . "
WHERE customers_email_address = :email";
Then I set a session variable to indicate if they are wholesale members or not
Code:
// PDD - added info to check for wholesalers
$_SESSION['wholesale_member'] = 0;
if (isset($_SESSION['customer_id']) ) {
$pdd_group_member_of = $check_customer->fields['customers_group_pricing'];
$sql = "select group_id from " . TABLE_GROUP_PRICING . "
where group_name = 'Wholesalers'";
$pdd_group_result = $db->Execute($sql);
$pdd_group_number = $pdd_group_result->fields['group_id'];
if ($pdd_group_member_of == $pdd_group_number) {
$_SESSION['wholesale_member'] = 1;
} // end if member of wholesale group
} // end if customer logged in
I included an if statement in my SQL query construction to exclude the wholesale category if they are not wholesalers.
includes/classes/category_tree.php
Code:
if (!(isset($_SESSION['wholesale_member']) && ($_SESSION['wholesale_member'] == 1) )) {
$categories_query .= " and c.categories_id != 2 ";
}
This works great, unless they view ALL or NEW products. I have determined that I really need to modify the product retrieval query and if I excluded products from the wholesale category, then that category shouldn't even show up because there would be 0 products in the query result.
I made changes to the product query, but I'm getting an SQL error about the syntax being incorrect on the SELECT COUNT part of the query. I tested the query itself and it runs fine. I just think that SELECT COUNT can't support a LEFT JOIN. I'm still investigating this.
This is my first Zen-cart install and I wish I knew more.
/Wendy