Answer the question
In order to leave comments, you need to log in
How to keep the checked state without flushing the cache?
Guys, hello! Does anyone have an idea why the input's checked state only fires after the cache is flushed?
<input <?= (array_key_exists($arResult['ID'], $_SESSION["CATALOG_COMPARE_LIST"][5]["ITEMS"]) ? 'checked' : '') ?> type="checkbox" id="compareid_<?= $arResult['ID']; ?>" onchange="compare_tov(<?= $arResult['ID']; ?>);">
Answer the question
In order to leave comments, you need to log in
Because you are using values from $_SESSION, but your component's cache (is this code written in your component?) does not take into account the values from the session.
And warning your next question - do not make the component cache dependent on the values in the session, the whole meaning of the cache will disappear, it will only take up extra memory / space.
From simple:
- either disable the cache on the component (quick, simple and bad solution)
- or set this checked through JS, which you can add to the page in the non-cacheable part of the component (read about component_epilog.php )
I know why, cached because, logically?
Apparently, this is related to adding products to the comparison, you call the fastest in the section or product card component, the html code is cached there, there are several ways to solve the problem
intel and only intel. there will be fewer problems. installed and forgotten. And even it's not about performance, but about stability.
Plus, you have already been asked before: for what purposes is a PC purchased? Perhaps i3 is enough for you, but to purchase ssd + if the gaming platform, then allocate more funds for the video card. Plus, does it make sense to overpay for a K processor? will you do overclocking? maybe just a regular processor without an unlocked multiplier is enough (because there is enough performance), again it all depends on what the PC is for...
You just want to justify buying AMD for some reason. For nothing. Take i5 and don't worry.
I would consider Intel based solutions. For what purposes do you plan to build a PC?
Well, consider the modern 1150 socket. If 1155 is still popular, then the rarer, but tempting 1156 at a price is definitely not worth it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question