0

We are updating the product prices every 10min using cron. The prices are pulled from a external API.

We are using the following way to update the price,

$this->updateProductAttribute('price', $productId, $price);

Then we are doing reindex for the updated items,

$categoryIndexer->reindexList(array_unique(array_keys($products)));

After the price update, Product detail page showing correct updated price. But the Category page still showing the old price. If I refresh the cache or save the product from admin then category page showing updated price.

Instead of using updateProductAttribute if I save the product from code then category page works.

Whether it advisable to save 100 of products every 10min programmatically?

Or, Do we have any other way to handle the category page cache issue?

0

Magento 1 and magento 2 are both not great at this. They're just not designed for rapid data change.

My best advice is to handle your 100 product update as fast as you can and then refresh the cache programatically after the update just the once. You wont need to clear all of the caches but it will be trial and error which one

You will probably have to do a price update hourly though.

That's the closest you are going to get to realtime prices.

Or completely different solution. Refresh your prices via ajax on page load. Make sure your ajax controller is uncached.

0

This solves my problem,

When we have made the Update on Save index to Update by schedule, this issue has been resolved.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.