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

Clear category caches after product (mass)save #248

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Clear category caches after product (mass)save #248

wants to merge 1 commit into from

Conversation

royduin
Copy link

@royduin royduin commented Jul 13, 2016

See: #241

@@ -152,6 +147,14 @@ protected function _catalogProductSaveAfterMassAction(array $productIds)
$tags = array();
foreach ($productIds as $productId) {
$tags[] = sha1('product_' . $productId);

$product = Mage::getModel('catalog/product')->load($productId);
Copy link
Owner

Choose a reason for hiding this comment

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

Please do not load products in a loop.

Copy link
Author

Choose a reason for hiding this comment

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

Suggestions? Use a collection before the loop and load all $productIds?

Copy link

@hoanglonguit hoanglonguit Dec 21, 2016

Choose a reason for hiding this comment

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

My suggestion is query directly to database for getting categories, catalog_category_product table is a good start.

@GordonLesti
Copy link
Owner

GordonLesti commented Jul 16, 2016

Hello @royduin
thank you for the PR. Just a general thought from #241 again. I'm not sure if it is a good idea to mix sometimes product tags on category pages and having also the loop after over all categories after a product save. One of these procedures is superfluous. Did you know what I mean?

@royduin
Copy link
Author

royduin commented Aug 5, 2016

I don't think it's superfluous. If I change a single product from the backend it would be nice if all category caches where the product is present will be cleaned. The same for a mass action from the backend product grid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants