Cache returns the same page for every category
-
Hi. I bought the cache-plugin months ago. At that time, I were experiencing some problems with the cache-plugin returning the response incorrectly. However, I didn’t have the time to look deeper into this issue, before now.
I’ve just installed the newest version of ALM + cache (the previous error has been fixed it seems). However, whenever I navigate through my category-pages (with cacheplugin activated) it returns the same content for every page. For instance, if I started in my /stearinlys/kalenderlys, this cache is being written correctly to my dir. If I refresh this page, the same content is being displayed (which ofcourse is correct). However, if I afterwards navigate to a new category, the content from the previous category is being displayed.
I’ve spend some hours to troubleshooting this error, but I’ve to be honest, I’m pretty confused about how this cache is suppose to work.
function alm_cache_file
dosen’t take any parameters, where the url (or category-slug) are taking into consideration. It only differs from the actual page-number /page1/2, etc… When I go to your javascript-file:alm.AjaxLoadMore.loadPosts = function () { if(!alm.disable_ajax){ // Check for ajax blocker if(!alm.paging){ alm.button.addClass('loading'); if(alm.button_loading_label !== false){ alm.button.text(alm.button_loading_label); } } alm.loading = true; // If cache = true && cache_logged_in setting is false if(alm.cache === 'true' && !alm.cache_logged_in){ var cache_page; if(alm.init && alm.seo && alm.isPaged){ // If the request a paged URL (/page/3/) var firstpage = '1'; cache_page = alm.cache_path + '/page-' + firstpage +'-'+ alm.start_page +'.html'; } else { // standard request url cache_page = alm.cache_path + '/page-' + (alm.page + 1) +'.html'; } $.get(cache_page, function( data ) { alm.AjaxLoadMore.success(data, true); // data contains whatever the request has returned }).fail(function() { alm.AjaxLoadMore.ajax('standard'); }); } else { // Standard ALM query alm.AjaxLoadMore.ajax('standard'); } } };
Shouldn’t this codestructure contains a precondition, here:
if(alm.cache === 'true' && !alm.cache_logged_in){
, which actually checks whether a cached version exist? It keeps sending me to the else-part (// standard request url), which just returns the same cached version (from the previous category). Here thecache_page
just keeps being assigned with the same values, as no variables contain the url, slug, term (or whatever), which would make a difference in thecache_page
-variable. As far as I can see, it’s pretty obvious why the same content (~ cached file) is being retrieved from the$.get
-call.However, I might have misunderstood this completely. I can just conclude that the cache-plugin still dosen’t work. Can you help me out?
I’m using the following shortcode:
echo do_shortcode( '[ajax_load_more cache="true" cache_id="5449479887" id="ordinary" scroll_distance="-300" css_classes="products clearfix products-3" order="DESC" orderby="meta_value_num menu_order date" meta_key="total_sales" post_type="product" posts_per_page="9" taxonomy="product_cat" taxonomy_terms="' . $cat_slug . '" taxonomy_operator="IN" transition_container="false"]' );
- The topic ‘Cache returns the same page for every category’ is closed to new replies.