Skip to content

Commit

Permalink
Merge pull request #3 from mikimpe/invalidate-parent-cache
Browse files Browse the repository at this point in the history
Invalidate parent product cache on child stock item save
  • Loading branch information
giacmir authored Jan 21, 2021
2 parents 494941c + 50fb470 commit 4e2e864
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion app/code/local/MSP/LTS2/Model/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,15 @@ public function invalidateOnModelSave($modelInstance)
{
$invalidations = Mage::getSingleton('msp_ltsr2/cache')->getBlocksModelInvalidation($modelInstance);
$tags = array();


if ($modelInstance instanceof Mage_CatalogInventory_Model_Stock_Item) {
$parentIds = Mage::getSingleton('catalog/product_type_configurable')
->getParentIdsByChild($modelInstance->getProductId());
foreach($parentIds as $parentId) {
$tags[] = 'CATALOG_PRODUCT_' . $parentId;
}
}

foreach ($invalidations['global'] as $blockName) {
$tags[] = 'MSP_BLOCK_NAME_'.$blockName;
}
Expand Down
2 changes: 1 addition & 1 deletion app/code/local/MSP/LTS2/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<config>
<modules>
<MSP_LTS2>
<version>1.0.1</version>
<version>1.0.2</version>
</MSP_LTS2>
</modules>

Expand Down

0 comments on commit 4e2e864

Please sign in to comment.