Jump to content

[SOLVED] PS 1.6 Current group not correct if user not identified


Prestashop Addict

Recommended Posts

Hi,

Version used PS: 1.6.1.17

I notice a strange behavior with the method Group::getCurrent()  in core class GroupCore that retrieve the current default group of the user context.

To reproduce the issue :

  1. Create a category, and assign to only default group (means only users with account)
  2. Browse the boutique as unidentified user, category doesn't appear in menu => good
  3. Browse the boutique as identified user, category appears in menu => good
  4. Disconnect and browse the boutique as unidentified user, category doesn't appear in menu => good
  5. Now go directly to url of the category, the page is displayed => bad (according to default group only users with account should access this category, we should have an error message: you cannot access this category)

 

When I analyse the method in class th problem comes from this part of code :

        if (!$groups[$id_group]->isAssociatedToShop(Context::getContext()->shop->id)) {
            $id_group = (int)$ps_customer_group;
            if (!isset($groups[$id_group])) {
                $groups[$id_group] = new Group($id_group);
            }

Before this test, the $id_group is well assigned to  Configuration::get('PS_UNIDENTIFIED_GROUP').

Why this test force to Configuration::get('PS_CUSTOMER_GROUP') ?

I think it's a bug isn't it ?

John

Link to comment
Share on other sites

I found the issue.

The bug coming from ps_group_shop table that didn't contain initial values  for guest and customer.

You should run SQL command
 

INSERT INTO `ps_group_shop` (`id_group`, `id_shop`) VALUES ('2', '1');

INSERT INTO `ps_group_shop` (`id_group`, `id_shop`) VALUES ('3', '1');

I don't know if it's a Prestashop install bug or upgrade.

Hope this help.

 

Link to comment
Share on other sites

  • Prestashop Addict changed the title to [SOLVED] PS 1.6 Current group not correct if user not identified

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...