Jump to content

how can i restrict a group from accessing certain categories?


Recommended Posts

You can assign users to groups and select groups with access to a particular category.
Simply put products into the right groups.

version 1.2.0.7 has bug that found my products that are not supposed to be visible but the version after that has since fixed this issue, thanks to the wonderful work of the Prestashop Team.

Hope this helps.

Link to comment
Share on other sites

thanks for making the effort but no it does not help.

I have a category that is available for the online (default) users.
I want that category NOT to be accessible to me other group.

But in prestashop, if you add a category to the online(default) then every other group will see it.

any thoughts?

Link to comment
Share on other sites

yes, i have seen that//

I dont know why you dont seem to understand my issue...
let me explain it again clearer:


I have 2 groups:
1)i have retail customers that just find me on google and buy my products (they get automatically assigned to 'default' group/online group)
2)I have shops (wholesale customers) that i have them in a group with 30% discount , the group it is called 'wholesale'

i have 2 categories:
1)category selling TVs (for that i can afford giving the wholesale customers 30% and the online 0%... so all good with this one
2)category selling cameras, Icannot afford to give 30% on cameras to wholesale. so i have only the online checkbox checked.
however, my wholesale customers can still see this category and they can buy cameras with 30% discount.

how can i restrict the wholesale from accessing the camera category. becasue i cannot give them discount on it?

the problem is, when you tick a category for the default group. every other group will be able to access it.
how can i change that so only online default fgroup can access it?

Link to comment
Share on other sites

hi all,
let me join to this topic

I have a similar question.
At this moment I have 3 customers groups. 1st - defaul for everyone, 2nd - my regular clients with dicount. Both 1 and 2 goups are for all categories exclude 1. And 3d group is for clients forall categories include that one my 1 and 2 can't use.. With 1 and 2 everything is clear. With 3d: if you are in this small group you can see this category and buy it's products. If you are not in, you cant buy anything and don't see products but you still can see that this category exist!!!

So is there any way to hide this category from everyone exclude that special 3d group? I just don't wan't to let to know about this category to those client who is not in this group. They can't buy but it looks not very good it they know about section they can't in.

Link to comment
Share on other sites

yes, that is what i did
every caterory checked to be open for all necessary groups
but even if i'm not logged in i can see link to category for special group. i cant see it's products, i cant order anything from this category but i can see that this category exists.

Link to comment
Share on other sites

I am still now able to get the result that i need.

Category1 (includes product1 = £1000)
Category2 (includes product2 = £1000)

Group1 (includes customer1 only) 50% discount
Group2 (includes customer2 only) 30% discount
Group3 (the default group for all other client with 0% discount

I want:
Customer1 to buy from category 1 with 50%discount and from category2 with 0%discount
Customer2 to buy from category 2 with 50%discount and from category1 with 0%discount
Online customers of the default group only to have 0% discount on everything.

How can i achieve this ?
I tried many different combinations but still cannnot find the right way of doing it.

can someone please post a solution?

Link to comment
Share on other sites

  • 3 months later...

This is only possible when in backoffice can remove costumer from defaul Public group :)

Because if you create
retail group 20%
and creat for category ipods 10%

Discount it´s made by retail group 20% :) because can´t remove costumer from public group and give acess only to categorie ipod :)

Link to comment
Share on other sites

  • 1 month later...

I have been asking myself this question but in the swedish part of this forum... since my skills in mysql is not the best i was thinking about modifying the call to the database in blockcategories.php when building the block categories....

my idea is that only show the categories that has been assigned to certain groups like first1 is talking about... i was thinking in my case since i will only have default users and retailers (retail group)... since assigned id_group for a retailer would be group 2 (retail)...

quick check to get select(MAX(id_group)) from customer_group WHERE id_customer=$id_customer BUT i have no idea how to put this in the sql-query... it would solve my problem if the query checks the highest value assigned to the id_group for the particular customer... if customer only has id_group=1 then show default, but if customer nr 2 also has id_group=2 (retail) then show only categories/products assigned with id_group(retail)...

anyone understanding what i am looking for here?
thanks

Link to comment
Share on other sites

  • 2 months later...
yes, that is what i did
every caterory checked to be open for all necessary groups
but even if i'm not logged in i can see link to category for special group. i cant see it's products, i cant order anything from this category but i can see that this category exists.


I would also like to know if there's a solution to this problem.
I don't want restricted categories' names to be visible to all.
The names are visible inside categories' page when I'm dealing with subcategories restrictions.
Link to comment
Share on other sites

  • 2 months later...

try on a test server first and do a back up.

you need to implement a function and call it everytime you check for access:

1)create another field in the mysql database, table ps_category_group:
I called it
gr_cat_red
it is a decimal(10,2)
this field would tell the system, the group category reduction (gr_cat_red) of each group and each category.
in this field you will need to put the reduction discount i.e. 55.7% for cat 11, group 3

2) in classes/Category.php

add this fuction:

public function checkCategoryRed($id_customer,$id_category_default,$id_group)
   {

       if (!$id_customer)
       {            
       $result = Db::getInstance()->getRow('
       SELECT ctg.gr_cat_red AS reduction 
       FROM '._DB_PREFIX_.'category_group ctg
       WHERE ctg.id_category = '.$id_category_default.' 
       AND ctg.id_group = 1')  ; 
       } else 
       {
           $result = Db::getInstance()->getRow('
           SELECT ctg.`gr_cat_red` AS reduction
           FROM '._DB_PREFIX_.'category_group ctg
           INNER JOIN '._DB_PREFIX_.'customer_group cg on cg.`id_customer` = '.$id_customer.' AND ctg.`id_group` = '.$id_group.'
           WHERE ctg.`id_category` = '.$id_category_default );
       }
       return $result['reduction'];
   }



call this fuction anytime you want to check for access.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...