Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix orders by shop #39

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open

Conversation

lmeyer1
Copy link
Contributor

@lmeyer1 lmeyer1 commented Jul 22, 2022

Questions Answers
Description? In multishop environment, we must take into account the shop where the orders were placed. Create an index to optimize the query.
Type? bug fix
BC breaks? no
Deprecations? no
Fixed ticket? Fixes PrestaShop/PrestaShop#29136.
How to test? See the behavior explained in PrestaShop/PrestaShop#29136

@kpodemski
Copy link
Contributor

@lmeyer1

I think we should move the optimization part to the core itself. It does make sense to have an index on this field, but the native module shouldn't be responsible for core optimization.

btw. great job with finding all these issues with multi-store, love it ❤️

@lmeyer1 lmeyer1 force-pushed the fix-orders-by-shop branch from d657650 to 71f9e37 Compare July 22, 2022 08:49
@lmeyer1
Copy link
Contributor Author

lmeyer1 commented Jul 22, 2022

@kpodemski

I think we should move the optimization part to the core itself.

You suggest just to delete the new upgrade_module file. Right?
And where should I add the index in the core project ?

@kpodemski
Copy link
Contributor

@lmeyer1

yes :)

The problem is that DB changes are not possible in patch versions, so the next version for this could be either 8.0 or 8.1 - and I'm pretty sure for a store with many orders, this change is critical? I'm unsure if we can put it in 8.0 as it has been feature-frozen.

About the process. You need to modify the DB structure in the core + add this upgrade script to the autoupgrade module. Example:
https://github.com/PrestaShop/autoupgrade/pull/494/files

Before doing that, we need to make sure if it's a good change + if we can do that for 8.1 or somehow put it to 8.0.

I'll ping other maintainers to help us out @PrestaShop/prestashop-maintainers

@lmeyer1
Copy link
Contributor Author

lmeyer1 commented Jul 22, 2022

@kpodemski
I'm not really sure if the combination index-query is the best for performance in all configurations.
What really counts for performance, is to restrict the number of analyzed carts (#41). When reducing from 2078 to 24 carts, even without the index, it is already literally thousands of times better than before (reducing query time form 10 s to 5 ms).
Meanwhile, I will just remove the upgrade file with the index declaration.

@atomiix
Copy link
Contributor

atomiix commented Nov 29, 2022

@kpodemski I think @lmeyer1 is right, we can already merge this fix while we can work on the index of the core db structure for later?

@kpodemski kpodemski added the waiting for QA Status: Waiting for QA feedback label Dec 2, 2022
@MhiriFaten MhiriFaten self-assigned this Dec 5, 2022
Copy link

@MhiriFaten MhiriFaten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @lmeyer1 ,

As mentioned in the issue, I didn't reproduce it without PR.
PrestaShop/PrestaShop#29136 (comment)

The behavior without PR is the same as with PR, so I am waiting for your feedback before testing it.

Thank you ! 🙏

@MhiriFaten MhiriFaten added waiting for author and removed waiting for QA Status: Waiting for QA feedback labels Dec 5, 2022
@MhiriFaten MhiriFaten removed their assignment Dec 5, 2022
@lmeyer1
Copy link
Contributor Author

lmeyer1 commented Dec 6, 2022

@MhiriFaten As stated in the issue, you didn't observe the behavior of the crossselling module in the product details in the FO. But the difference in behavior is there, where you didn't look at!

@Hlavtox
Copy link
Contributor

Hlavtox commented Jan 12, 2023

@kpodemski @lmeyer1 I think we can merge it right away, it works fine.

But I have one last question - what do you think about an idea of adding a switch for this behavior? Maybe it does not matter on which store the people bought the products together, no? You would maybe get a bigger sample with the original behavior.

Something like Use all shops to get frequently bought products - YES/NO.

@kpodemski
Copy link
Contributor

@Hlavtox it makes sense if you have shared catalog between shops

@lmeyer1, what do you think?

@lmeyer1
Copy link
Contributor Author

lmeyer1 commented Jan 13, 2023

@Hlavtox is right. There are scenarios, where it makes sense to use all shop's data to get the list of products to display, and others where we want to avoid to mix the data from different shops.

@Hlavtox Hlavtox added this to the 2.0.2 milestone Jan 31, 2023
@Hlavtox Hlavtox modified the milestones: 2.0.2, 2.0.3 Feb 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ps_crossselling: Does not take into account the shop in which the orders were placed
5 participants