• Resolved Stormit

    (@stormit)


    Hello,

    When we enable Leverage browser caching, your plugin does not work well. Because it is cached. So we have to add a random number to your link. Below is what we do

    Change the woocompare.js file

    $(document).on('click', '.product a.compare.added', function (ev) {
    	ev.preventDefault();
    	
    	/* customize */
    	var rand = Math.floor(Math.random() * 1000000);
    	var href = this.href;
    	var rand_pos = href.indexOf('random');
    	if( rand_pos != -1 ){
    		var arr = href.split('random');
    		href = arr[0] + 'random=' + rand;
    	}
    	else{
    		href += '&random=' + rand;
    	}
    	$(this).attr('href', href);
    	/* end customize */
    
    	var table_url = this.href;
    
    	if (typeof table_url == 'undefined')
    		return;
    
    	$('body').trigger('yith_woocompare_open_popup', {response: table_url, button: $(this)});
    });

    Change the class.yith-woocompare-frontend.php file

    $url_args = array(
    	'action'    => $this->action_view,
    	'iframe'    => true,
    	'random'    => rand(0, 1000000) /* Customize */
    );

    I hope you can update your plugin. So we will not need to change your plugin file when updating it.

    Thank you!

    • This topic was modified 7 years, 10 months ago by Stormit.
    • This topic was modified 7 years, 10 months ago by Stormit.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author YITHEMES

    (@yithemes)

    Hi there,

    thanks for your reporting. I send this post to our developers like an idea for a future update.

    Im having the same issue, im using WP Super Cache, and when i activate it the plugin doesnt work. Any solution without writting my files?

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Compatible with Leverage browser caching’ is closed to new replies.