Questions tagged [block-cache]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
0answers
19 views

Magento 2 : Set Catalog price rules based on customer IDs

I need to setup a catalog price rules based on customer ID. for that i added "customer_id column in "catalogrule_product_price" table. and put condition of customer ID in getRulePrice ...
1
vote
1answer
40 views

Disable specific Block is getting cached in Magento2

I am trying to disable cache for specific block, Have used below code. app\code\Vendor\Module\view\frontend\layout\default.xml <referenceContainer name="header.panel"> ...
0
votes
0answers
14 views

Magento 2.4 Change page content based on query string

I want to show custom text on category pages based on query string on category pages. for example : for category shirt with urls like category/shirts.html?color=red category/shirts.html?color=blue ...
0
votes
1answer
119 views

Magento 2.3 Store Switcher provides wrong/old urls

Hi we have a Magento store. (2.3.6) ... ... and have the problem with the store switcher switching to wrong / outdated pages. We simply need the corresponding page in the other store/language to be ...
0
votes
2answers
365 views

Magento 2: why we use cache mechanism at a block level?

I have a doubt that I see some cache codes in layout xml like below <referenceContainer name="store.menu"> <block class="Vendor\Megamenu\Block\Megamenu" ...
0
votes
1answer
71 views

Magento2: Cannot get the attribute value with cache enabled

I want to show the Product price and Add to Cart in product listing page when only we set custom attribute value as Approved. So, I have overridden the ListProduct block and written a function for ...
0
votes
1answer
23 views

Remove cacheable="false" form Block in Layout file

In my multiple layout file has many block which have cacheable="false" attribute <block class="Block\Class" name="blockname" cacheable="false" /> if cacheable="false" is not add there have ...
2
votes
1answer
176 views

Disable cache for particular custom block called in layout xml

I want to disable cache only for particular block which is called in some pages like Home Page, Category Listing page , Product page and Shopping cart page etc. <block class="Namespace\Module\...
1
vote
4answers
201 views

Magento 2: What is difference between Cache Clean & Cache Refresh? [duplicate]

What is difference between cache refresh (when we select something and click refresh) and Cache clean?
0
votes
1answer
124 views

How to refresh the cache programatically in magento 1 EE

What is the code for clean or refresh the cache programmatically because I have got lots of snippets but all are not working in Magento 1 enterprise edition. Does anyone know how to solve it? Thanks ...
1
vote
2answers
2k views

Magento 2 clear particular block cache

I have a block that displays a product grid with SKUs mention in admin system configuration and I have provided cache lifetime for that block as 3600 sec. It works perfectly fine. Now when admin ...
1
vote
1answer
362 views

Magento 2 - How to conditionally show/hide the minicart block based on the customer permissions

The problem: I'm running into an issue with the page/block caching and the minicart. In the template cart/minicart.phtml we have a permission check to see if the current customer is allowed to add ...
1
vote
1answer
108 views

Magento 2: The style.css inside Magento installation directory is effecting cache

I am very new to Magento. Recently I have to add extra styles to my magento website. So I go to adminpanel -> content-> design->configuration->my theme ->HTML Head I add the following ...
3
votes
0answers
54 views

Cache life time with varnish

Magento Magento\Framework\View\Element\AbstractBlock has method getCacheFiletime, it return lifetime of cache in seconds. How it will work with varnish?
1
vote
2answers
4k views

Magento 2: Set Cache life time to block

I am creating an extension for displaying labels in product page and listing page. Everything works fine except the cache issue. If I set the status to inactive, then the labels will display in the ...
1
vote
1answer
68 views

Magento 1.14.4.1: Not able to clean specific type of cache while using redis cache

I have redis which is hosted separably. I need to clean specific type of cache (i.e. block_html) using a script. The problem is that whenever I update product it doesn't reflect on the front-end side ...
2
votes
5answers
2k views

How to make page non-cacheable in cms

I have added below code to load custom template file from cms. <p>{{block class="Vendor\Module\Block\Testblock" template="Vendor_Module::test_template.phtml"}}</p> If ...
2
votes
0answers
96 views

Magento 1.14.4.0: Programmatically clear cache of individual product

I need to clear the cache for individual product. For example, If admin change any detail/price/qty of product. I need to run script that clear the cache for that particular product only. I am running ...
0
votes
0answers
80 views

Why cacheable="false" is not recommended on marketplace?

I have developed a custom module, If my cache enables dynamic data pages are not on updating every request so I have added cacheable="false" now everything is working perfectly. XML file : view/...
1
vote
1answer
52 views

Cookie based conditional issues

I want to show a popup phtml based on wether a cookie has been set or not in my block class. The logic is roughly: class Popup extends \Magento\Framework\View\Element\Template { public function ...
1
vote
1answer
94 views

Does FPC respect block lifetime?

Example: FPC lifetime is 1 day but a page contains a block with a lifetime of 1 hour. How will that be handled? Will the page be served from the cache after the hour?
0
votes
2answers
718 views

Magento 2 Remove Page Cache in Home Page

I don't want cache to happen with home page but need them for all other pages. I am new to Magento and on going through I found that cacheable="false" in block will ignore cache in that page. How ...
1
vote
3answers
1k views

Magento 2 Header Sign In Sign Out Issue on Home Page

I'm facing an issue on Magento 2.2 . The details are as under 1.Go to home page 2.Click 'Sign In' from header 3.Enter login credentials to enter customer account 4.Click website logo to go back ...
3
votes
2answers
5k views

How to cache a block in block_html cache type in Magento 2?

I have a block file that does heavy data processing due to which my product page PHP rendering time increases above 2 seconds. I have disabled page_cache in my Magento 2 system so i cannot use ...
3
votes
1answer
714 views

How Magento manages store-wise cache

I am currently working on an architecture where I'd like to maintain separate caches (block cache, collection cache, FPC) for each zipcode. I am making the user select a zipcode at the beginning of ...
2
votes
0answers
64 views

Magento 1.9.3.6 - Disable cache for a specific module [duplicate]

could someone explain to me how to disable the cache of a specific module? I have this code in cms static block: {{block type="filterproducts/featured_home_list" name="featured_list" product_count="...
2
votes
3answers
3k views

How to disable cache for particular block in magento2?

I have created a block in header <referenceContainer name="columns.top"> <block class="XXX\ABC\Block\Category\News" name="news" template="XXX_ABC::catalog/product/...
0
votes
0answers
51 views

Customer name shouldn't display after rebooting the system

Steps to reproduce. login as a user close the tab without logged out restart the system open browser and open magento local see the welcome message ACTUAL RESULTS - Welcome!User name! - Sign in - ...
0
votes
1answer
661 views

How to display the current time in .phtml with caching enabled?

I created a really simple block in my child theme: /Magento_Theme/layout/default.xml: <referenceContainer name="content"> <block class="Magento\Framework\View\Element\Template" name="...
0
votes
0answers
236 views

Disable cache for block Mage_Catalog_Block_Product_Price

I want to disable cache for block Mage_Catalog_Block_Product_Price. I know that if it was a different block I can disable it with this: <action method="setCacheLifetime"> <s>null&...
2
votes
0answers
501 views

Disable cache of static block Magento 1.9

How can I disable a widget or static block from being cached inside the Blocks HTML output cache? The widget loads a specific static block on all CMS pages. Inside the static block, I load a template ...
0
votes
1answer
2k views

Magento 1.9 Cache Custom Block Data

I have a custom module that displays products from a given category in a carousel. Now, I was wanting to cache the results, so the database is not queried and duly for speed optimisation. However, I ...
0
votes
1answer
930 views

How to turn off cache for a block?

i want to completely remove from cache the header-minicart. It is confused when magento cache and fpc work together. how can i do that?
5
votes
1answer
933 views

Hole punching full page cache on magento 2

I'm working in Magento 2 industry as a developer. I'm in a situation that i need to make a hole punching for a specific block. The block contains the reviews got from Trustpilot. I use curl to call ...
1
vote
0answers
102 views

Browser History back() Method decreases minicart quantity

We have discovered an interesting phenomenon with browsers history. When I add some products from several product pages to the basket then the minicart at top will always update and shows me the ...
0
votes
2answers
600 views

How flush specific type of cache

I need to flush only block HTML of Magento 1,9 If I write try { Mage::app()->getCacheInstance()->cleanType('block_html'); } catch (Exception $e) { die("[ERROR:" . $e->...
0
votes
1answer
928 views

How to clear cache on page loading magento 2?

I need to flush cache when a controller is loaded. This is mandatory for me because some function works only when cache is cleared. I Hope will get help.
0
votes
0answers
68 views

my custom block (in admin panel) cache

i create block in magento admin panel and i Calling template in it,the code is this (dynamic data) {{block type="core/template" template="catalog/category/sub.phtml"}} My problem is here, my block ...
7
votes
5answers
3k views

Magento 2 EE : Need to remove one single block from cache

I just need to remove single block phtml from FPC cache. How can I do that without using cacheable = "false". Because cacheable = "false" has an effect on the whole page. I am using a .phtml file in ...
0
votes
2answers
144 views

Grouped products doesn't display on category page only at first time

I am facing this unusual issue where grouped products are not being displayed only when the page loads for the first time. After refreshing the category page all products are being displayed. I have ...
-1
votes
1answer
691 views

How to get current product from esi request?

I need to specify a ttl for a custom product block to force varnish cache invalidation on it without loosing FPC. Is there a way to get product (at least the productId) from the ESI request so that I ...
2
votes
1answer
2k views

Magento 2: Force block to be cached

I've a mega menu extension which I feel is quite slow. It seems to add about 2 seconds on load time for each page. As this menu does not change between pages I was wondering how to cache a block? I ...
1
vote
0answers
57 views

turning off caching on specific blocks

I'm working with emarsys and i keep having issues with their webextend scripts. Data is being served to wrong customers and abandoned emails are populating the wrong items. They keep telling me it's ...
2
votes
1answer
2k views

Why do I have to refresh Blocks HTML output / Page blocks HTML every other hour? [duplicate]

Whenever I login to magento backend it shows invalidated Block HTML Cache. This is happening even without making a change to the website or database. Why is that and how to fix it? I am using Magento ...
3
votes
2answers
10k views

Magento 2: get customer id of logged in user with cache enabled

I need to get the customer id of the user that is logged in. Using the following code it works fine for blocks where cache is disabled. But when there's a cached block on the page, it's null. Even if ...
1
vote
1answer
1k views

Enable cache for AJAX block

I'm having problems with caching a block in Magento 2. The theme I'm using is getting content from the block via an AJAX call. Is it possible how to cache such block in M2? Thank you, Mateusz
1
vote
0answers
761 views

Magento 2. Flush cache programmatically for particular block

I'm creating catalog rule programmatically and I want to see update price block on category and product pages immediately after that. Is there way to flush cache for price block only? Or what is the ...
1
vote
3answers
2k views

Where can I see a different between cacheable="true" and "false" in layout?

I know this is seem stupid question but I'm a newbie in Magento 2. So I want to ask you guys that Where can I see a different between cacheable ='false' and cacheable='true'?. I checked in Local ...
0
votes
1answer
2k views

Lifetime disable of html cache block [duplicate]

I'm on Magento 1.9.2.2 and getting the static block bug. As a work around I disable the blocks html cache, the problem goes away. But every day something goes in and the block html cache gets ...
0
votes
1answer
2k views

Public\private content

Refering to this piece of docs: http://devdocs.magento.com/guides/v2.1/config-guide/cache/cache-priv-priv.html, is it possible to put some private content into page which is public and it will not ...