HeyVoOn Posted April 29, 2015 Share Posted April 29, 2015 (edited) Hello everyone, I am running PS 1.6.0.14 with TitanShop and some custom modules. In this theme I use "cshotdeals" and "cscountdown". cshotdeals shows a block on the left with deals and a countdown timer based on the time set for the product deal. The problem is the the block only shows the countdown if the Prestashop CACHE is OFF. Otherwise the countdown doesn't show up. Below please find the code for the countdown.tpl {addJsDefL name=cd_day}{l s='days' mod='cscountdown'}{/addJsDefL} {addJsDefL name=cd_hour}{l s='hours' mod='cscountdown'}{/addJsDefL} {addJsDefL name=cd_min}{l s='mins' mod='cscountdown'}{/addJsDefL} {addJsDefL name=cd_sec}{l s='secs' mod='cscountdown'}{/addJsDefL} {if $timeRemaining !== null && $timeRemaining >= 0} <div id="countdown_{$id_product}" class="timer"></div> <script> (function() { var seconds = {$timeRemaining}; function secondPassed(){ var hour = 24; var minutes = 60; var day = Math.round((seconds - (86400 / 2)) / 86400); var remainingSeconds = seconds % 60; if (seconds === 0) { clearInterval(countdownTimer); $('#countdown_{$id_product}').html('0:00:00:00'); } else{ var cd_html = ''; if ((seconds % 86400) !== 0) { hour = Math.round(((seconds % 86400) - 1800) / 3600); } if ((seconds % 3600) !== 0) { minutes = Math.round(((seconds % 3600) - 30) / 60); } cd_html +='<ul class="clock">'; if(day > 0) { cd_html += '<li><span class="days">'+day+'</span>'; cd_html += '<p class="timeRefDays">'+cd_day+'</p></li>'; } cd_html += '<li><ul class="clock-sub">'; cd_html += '<li><span class="hour">'+hour+'</span>'; cd_html += '<p class="timeRefhour">'+cd_hour+'</p></li>'; cd_html +='<li><span class="minutes">'+minutes+'</span>'; cd_html += '<p class="timeRefminutes">'+cd_min+'</p></li>'; cd_html += '<li><span class="remainingSeconds">'+remainingSeconds+'</span>'; cd_html += '<p class="timeRefseconds">'+cd_sec+'</p></li>'; cd_html += '</ul></li>'; cd_html += '</ul>'; $('#countdown_{$id_product}').html(cd_html); seconds--; } } var countdownTimer = setInterval(function(){ secondPassed(); }, 1000); })(jQuery); </script> {/if} Could anyone please help me figure out why this ishappening when PS CACHE is On? Thank you in advance for any clue. This is driving me nuts! Edited April 29, 2015 by HeyVoOn (see edit history) Link to comment Share on other sites More sharing options...
PascalVG Posted May 1, 2015 Share Posted May 1, 2015 Maybe the old tpl is still in cache available, therefore not adding the timer code? Clear all cache, turn OFF caching in advanced parameters->Performance (here you can also clear cache (top right of page) turn ON force compile here as well When it now works, turn caching on again and see if this helped. (Then turn off force compile) My 2 cents, pascal. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now