How to set up Time limited packages

A Time limited package will allow you to set up a package which can only be purchased for a limited amount of time, it will also display a countdown timer by default on the package listing pages. 

If you would like to create a time limited package you can find the option in the package edit page under "Show package until:" .

After saving the package it will display the time left for the package by default on the Flat template as shown below. Once a package reaches "Time Expired!" you will not be able to add it to your basket and it will not appear when the page is reloaded.

Custom templates:

If you are using a custom template and would like to use the countdown timer along with your time limited packages you will need to add a few things to your templated as detailed below.

Add this code after the package name in category.html (note, it may need to be entered twice, once for the list layout and once for the grid layout): 

{% if package.countdownEnds %}<span>&nbsp;&nbsp;<i></i> <span data-countdown="{{ package.countdownEnds }}">Ending Soon!</span>{% endif %}

The following then needs adding to layout.html (after the rest of the <script> tags at the bottom of the file): 

		var countdowns = $(".countdown-to");

		    setInterval(function(ele) {                    
			timeLeft = parseInt(ele.attr("data-countdown"));                    
			if (timeLeft == 0) {                        
			    ele.html("Time Expired!");                    
			} else {                        
			    ele.attr("data-countdown", timeLeft);                       
			  var days = Math.floor(timeLeft / (60 * 60 * 24));                       
			  var hours = Math.floor((timeLeft % (60 * 60 * 24)) / (60 * 60));                       
			  var minutes = Math.floor((timeLeft % (60 * 60)) / (60));                       
			  var seconds = Math.floor((timeLeft % 60));                       
			  ele.html(days + "d " + hours + "h " + minutes + "m " + seconds + "s");                    
		    }, 1000, jQuery(this));              

Still need help? Contact Us Contact Us