INSTALL POGODAN'S CODE DISTRIBUTION & TOUR DATE APP
INSTALL POGODAN'S CODE DISTRIBUTION APP
Add this URL in your browser. https://onelivemedia.automatik.io/login?shop=MYURL.myshopify.com
Replace MYURL.myshopify.com with the URL the store.
Create a page template and paste the following code. Adjust as needed. Assign a page to the new template.
{% comment %}
Rian, you can use this file as a template for designing tour pages for each store.
In the FSD demo store it is included in page.tours.liquid.
I've included comments so that you can see what the liquid is doing, but I would recommend
duplicating this file and deleting the comments when you use it in production.
Don't modify anything in the variables or the if/else logic (unless you're confident that you
know what you're doing) But feel free to add/remove html structure/content in order to create a new
design for a new store.
Feel free to modify the html and the output tour/event data.
questions: support@pogodan.com
{% endcomment %}
{% assign tours = shop.metafields.automatik.tours %}
<!-- Loop through the tours -->
{% for t in tours %}
<!-- Tour Name -->
<h1>{{ t.tour.name }}</h1>
<!-- Loop through the events in a tour -->
{% for e in t.events %}
<!-- Set variables -->
<!---- For comparison to 'now' ---->
{% assign time_now = "now" | date: '%s' %}
<!---- Set blank publishing date/times to 'now' (i.e. visible by default) ---->
<!---- This also prevents the dates being persitsted accross loops ---->
<!------ For Events ------>
{% assign e_on = "now" | date: '%s' %}
{% assign e_off = "now" | date: '%s' %}
<!------ For Links ------>
{% assign u_1_on = "now" | date: '%s' %}
{% assign u_2_on = "now" | date: '%s' %}
{% assign u_3_on = "now" | date: '%s' %}
{% assign u_4_on = "now" | date: '%s' %}
{% assign u_5_on = "now" | date: '%s' %}
{% assign u_1_off = "now" | date: '%s' %}
{% assign u_2_off = "now" | date: '%s' %}
{% assign u_3_off = "now" | date: '%s' %}
{% assign u_4_off = "now" | date: '%s' %}
{% assign u_5_off = "now" | date: '%s' %}
<!---- For non-blank publishing date/times, set the datetime ---->
<!---- Here we override the publishing date/times ONLY for links/events that have them ---->
<!------ For Events ------>
{% unless e.publish_on == blank %}{% assign e_on = e.publish_on | date: '%s' %}{% endunless %}
{% unless e.remove_on == blank %}{% assign e_off = e.remove_on | date: '%s' %}{% endunless %}
<!------ For Links ------>
{% unless e.url_1_publish_on == blank %}{% assign u_1_on = e.url_1_publish_on | date: '%s' %}{% endunless %}
{% unless e.url_2_publish_on == blank %}{% assign u_2_on = e.url_2_publish_on | date: '%s' %}{% endunless %}
{% unless e.url_3_publish_on == blank %}{% assign u_3_on = e.url_3_publish_on | date: '%s' %}{% endunless %}
{% unless e.url_4_publish_on == blank %}{% assign u_4_on = e.url_4_publish_on | date: '%s' %}{% endunless %}
{% unless e.url_5_publish_on == blank %}{% assign u_5_on = e.url_5_publish_on | date: '%s' %}{% endunless %}
{% unless e.url_1_remove_on == blank %}{% assign u_1_off = e.url_1_remove_on | date: '%s' %}{% endunless %}
{% unless e.url_2_remove_on == blank %}{% assign u_2_off = e.url_2_remove_on | date: '%s' %}{% endunless %}
{% unless e.url_3_remove_on == blank %}{% assign u_3_off = e.url_3_remove_on | date: '%s' %}{% endunless %}
{% unless e.url_4_remove_on == blank %}{% assign u_4_off = e.url_4_remove_on | date: '%s' %}{% endunless %}
{% unless e.url_5_remove_on == blank %}{% assign u_5_off = e.url_5_remove_on | date: '%s' %}{% endunless %}
<!-- End Variables -->
<!-- Show if the event is published and we are within the publishing timeframe -->
{% if e.published == "1" and time_now >= e_on and time_now <= e_off %}
<!-- Event Info -->
<p>{{ e.title }}</p>
<p>{{ e.event_date | date: '%m-%d-%Y' }}, {{ e.venue }}, {{ e.city }} {{ e.providence }} {{ e.country }}</p>
<p>{{ e.description }}</p>
<p><a href="{{ e.page_url }}">{{ e.page_url }}</a>
<!-- Show Link 1 if enabled on tour -->
{% if t.tour.url_1 %}
<!-- Show if we have a URL and we are within the URL publishing times on the event -->
{% if e.url_1 and time_now >= u_1_on and time_now <= u_1_off %}
<a href="{{ e.url_1 }}" class="btn btn-primary button">{{ t.tour.url_1 }}</a>
{% endif %}
{% endif %}
<!-- Show Link 2 if enabled on tour -->
{% if t.tour.url_2 != blank %}
<!-- Show if we have a URL and we are within the URL publishing times on the event -->
{% if e.url_2 and time_now >= u_2_on and time_now <= u_2_off %}
<a href="{{ e.url_2 }}" class="btn btn-primary button">{{ t.tour.url_2 }}</a>
{% endif %}
{% endif %}
<!-- Show Link 3 if enabled on tour -->
{% if t.tour.url_3 != blank %}
<!-- Show if we have a URL and we are within the URL publishing times on the event -->
{% if e.url_3 and time_now >= u_3_on and time_now <= u_3_off %}
<a href="{{ e.url_3 }}" class="btn btn-primary button">{{ t.tour.url_3 }}</a>
{% endif %}
{% endif %}
<!-- Show Link 4 if enabled on tour -->
{% if t.tour.url_4 != blank %}
<!-- Show if we have a URL and we are within the URL publishing times on the event -->
{% if e.url_4 and time_now >= u_4_on and time_now <= u_4_off %}
<a href="{{ e.url_4 }}" class="btn btn-primary button">{{ t.tour.url_4 }}</a>
{% endif %}
{% endif %}
<!-- Show Link 5 if enabled on tour-->
{% if t.tour.url_5 != blank %}
<!-- Show if we have a URL and we are within the URL publishing times on the event -->
{% if e.url_5 and time_now >= u_5_on and time_now <= u_5_off %}
<a href="{{ e.url_5 }}" class="btn btn-primary button">{{ t.tour.url_5 }}</a>
{% endif %}
{% endif %}
<!-- End Links -->
<hr style="background:#ccc;">
<!-- End Published Event Info -->
{% endif %}
<!-- End Event Loop -->
{% endfor %}
<!-- End Tour Loop -->
{% endfor %}
<!-- For admin/debugging purposes only (remove in production) -->
<pre><code>{{ tours }}</code></pre>