Skip to content

Clear category caches after product (mass)save#248

Open
royduin wants to merge 1 commit intoGordonLesti:masterfrom
royduin:master
Open

Clear category caches after product (mass)save#248
royduin wants to merge 1 commit intoGordonLesti:masterfrom
royduin:master

Conversation

@royduin
Copy link
Copy Markdown

@royduin royduin commented Jul 13, 2016

See: #241

foreach ($productIds as $productId) {
$tags[] = sha1('product_' . $productId);

$product = Mage::getModel('catalog/product')->load($productId);
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown

@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
Copy Markdown
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
Copy Markdown
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