-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Widget cache error #4389
Comments
Hello @twslade! Thank you for the report! We have created issue in our bugtracker system MAGETWO-54008 . It will be fixed as soon as possible. |
Hi @oserediuk Do you have any update for timeframe of the MAGETWO-54008 issue? Thanks |
Hi @mcspronko ! Nope |
Hi @pboisvert Are there any deadlines for this issue? Thanks, |
This is not caused by the cache key. The rule property is a shared object. This can be solved by defining the rule argument in the constructor as not shared in di.xml.
|
@LuckyLoek solution doesn't seem to work for me. If someone found a solution to this bug and share it, it would be greatly appreciated. |
@pinicio I think @LuckyLoek misunderstood the problem. The issue is that the widget_id isn't stored within the cache key. I fixed it by adding the widget ID to the \Magento\CatalogWidget\Block\Product\ProductsList::getCacheKeyInfo function in the return. See below. I only came across this scenario because I was making lots of widgets that were the same conditions for mocking client data during a project. public function getCacheKeyInfo()
{
$conditions = $this->getData('conditions')
? $this->getData('conditions')
: $this->getData('conditions_encoded');
return [
'CATALOG_PRODUCTS_LIST_WIDGET',
$this->_storeManager->getStore()->getId(),
$this->_design->getDesignTheme()->getId(),
$this->httpContext->getValue(\Magento\Customer\Model\Context::CONTEXT_GROUP),
intval($this->getRequest()->getParam($this->getData('page_var_name'), 1)),
$this->getProductsPerPage(),
$conditions . $this->getData('id'),
serialize($this->getRequest()->getParams())
];
} |
@twslade, I didn't misunderstand the problem as I had exactly the same problem. The situations might still be different however. I had unique conditions and therefor a unique cache key for each widget. Still this didn't produce the result I expected. I can't test right now but I guess it depends on the widget settings. I think both solutions should be considered depending on the situation. |
@LuckyLoek The reason I thought you misunderstood the problem is because I had no context into how you came across the bug/solution you provided. As described above, my conditions were the same in both widgets, so the same products were assigned to each widget. The titles were different even though the frontend showed the same block each time, because they had identical cache keys. I noticed that you said above that the issue doesn't have to do with cache key, but instead the shared rules. Can you give details on steps to reproduce and expected/actual results? |
@twslade, it was also too easy from my side to assume the problem as described was exactly the same as mine. I will provide details to reproduce as soon as I find some time on my hands. |
@LuckyLoek @twslade great, thank you both. I wasn't setting any conditions, so I was able to make it work just by passing the widget id. public function getCacheKeyInfo()
{
return [
'CATALOG_PRODUCTS_LIST_WIDGET',
$this->_storeManager->getStore()->getId(),
$this->_design->getDesignTheme()->getId(),
$this->httpContext->getValue(\Magento\Customer\Model\Context::CONTEXT_GROUP),
intval($this->getRequest()->getParam($this->getData('page_var_name'), 1)),
$this->getProductsPerPage(),
'my_widget_id',
serialize($this->getRequest()->getParams())
];
} |
Any fixes for this yet? Has been over 6 months, but the issue still remains in 2.1.3. |
@twslade, thank you for your report. |
#mageconf |
@AlexandrKozyr thank you for joining. Please accept team invitation here and self-assign the issue. |
-fixed CacheKey assignment
- fixed CacheKey assignment
Hi @twslade. Thank you for your report. The fix will be available with the upcoming 2.2.5 release. |
Hi @twslade. Thank you for your report. The fix will be available with the upcoming 2.3.0 release. |
It's still existing into magento 2.2.5 when we add cms static block using widget |
[Magento Community Engineering] Community Contributions - GraphQL
It's still existing in magento 2.3.2. when I add the same widget twice in one cms page. |
Steps to reproduce
develop
branch.Expected result
Actual result
The text was updated successfully, but these errors were encountered: