litespeedtech / lscache_prestashop

LiteSpeed Cache Plugin for Prestashop
GNU General Public License v3.0
26 stars 16 forks source link

Wrong cache if customer is in several customer groups #39

Open wucherpfennig opened 4 years ago

wucherpfennig commented 4 years ago

Dear all

Thank you for this amazing module. We are using it and have been happy with it till recently.

We noticed that there are issues with wrong caches delivered if you work with several customer groups for discounting purposes etc.

example: User JohnDoe is in group A + C + D User JaneDoe is in group B + C + E

we noticed that it can happen that Jane Doe (gr. B) might see discounts applied from JohnDoe (gr. A) since they got served by the same customer group 'C'.

We did not have this issue with other caching modules which provide an additional option to generate cache according to all selected customer groups.

I hope I was able to explain myself.

--- edit

without any further knowledge of the internals of this module I assume that the issue might be related to the follow lines:

https://github.com/litespeedtech/lscache_prestashop/blob/a7cfa9fe38912af5d82155951840ddd5bdfca881/classes/VaryCookie.php#L199-L206

Maybe a simple adjustment like the following line might solve the issue?

...
$data['cg'] = implode('-',$context->customer->getGroups());
...

If this fixes the problem we might think about the order of the returned ids. E.g. like in our case we have a lot of customers with the same "group configuration" but the order when those groups were applied might differ from customer to customer (for example: JohnDoe got discout group C [assigned groups = ACD] directly applied after the registration but JaneDoe got group C after 1 one year when she reached a certain turn over [assigned groups = ADC])...

BR wucherpfennig

wucherpfennig commented 4 years ago

Hi everyone

Is this repository abandoned?

BR wucherpfennig

litespeedtech commented 1 year ago

currently it uses $context->customer->id_default_group; I think it still won't work for your case, right? and your code snippet looks fine for me. Let me know if you are still using the plugin and we will look into it. Very sorry for late reply.

wucherpfennig commented 1 year ago

Yes and no. I think this is still a valid and a fixable request but no we currently use another module (although it does not work as well).