This repository has been archived by the owner on Nov 13, 2023. It is now read-only.
forked from zakhardage/Shopify-Wish-List
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwishlist-page.liquid
70 lines (65 loc) · 4.13 KB
/
wishlist-page.liquid
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
{% if customer %}
<ul>
{% for tag in customer.tags %}
{% assign the_test = 'nutthin' %}
{% capture tag_id %}{{ tag }}{% endcapture %}
{% assign tag_size = tag_id.size %}
{% for tag in customer.tags %}
{% capture cur_tag %}{{ tag }}{% endcapture %}
{% if cur_tag contains tag_id %}
{% assign difference = tag_size | minus:cur_tag.size %}
{% if difference == 0 %}
{% assign the_test = tag_id %}
{% else %}
{% assign the_test = 'nutthin' %}
{% endif %}
{% endif %}
{% endfor %}
{% for collection in collections %}
{% paginate collection.products by collection.all_products_count %}
{% for product in collection.products %}
{% capture product_id %}{{ product.id }}{% endcapture %}
{% unless used contains product_id %}
{% capture diff %}{{ tag_size | minus:product_id.size | money_without_currency | times:100 | divided_by:2 }}{% endcapture %}
{% assign check = diff | split:'.' %}
{% if check[1] contains '5' %}{% assign display = false %}{% else %}{% assign display = true %}{% endif %}
{% if display and the_test contains product_id %}
<li>
<a href='{{ product.url }}'>{{ product.title }}</a><br />
<a href='#remove' onclick="removeTag('x{{ tag_id }}')">remove</a><br />
<a href='#add-to-cart' onclick="addToCart('{{ product.variants.first.id }}')">add to cart</a>
</li>
{% capture used %}{{ product_id }} {{ used }}{% endcapture %}
{% endif %}
{% endunless %}
{% endfor %}
{% endpaginate %}
{% endfor %}
{% endfor %}
</ul>
<form method='post' action='/contact' id='remove' accept-charset='UTF-8'>
<input name='form_type' type='hidden' value='customer'/>
<input name='utf8' type='hidden' value='✓'>
<input type='hidden' name='contact[email]' value='{{ customer.email }}'/>
<input type='hidden' name='contact[tags]' id='remove-value' value='' />
</form>
<form action='/cart/add' id='add-variant' method='post'>
<input type='hidden' name='id' id='product-select' value='' />
</form>
<script type='text/javascript'>
function removeTag(tagID) {
document.getElementById('remove-value').value = tagID;
document.getElementById('remove').submit();
}
function addToCart(variantID) {
document.getElementById('product-select').value = variantID;
document.getElementById('add-variant').submit();
}
</script>
{% capture subject %}My%20{{ shop.name | replace: ' ','%20' }}%20Wish%20List{% endcapture %}
{% capture body %}I’ve%20added%20the%20following%20items%20to%20my%20wish%20list%20at%20{{ shop.name | replace: ' ','%20' }}{% endcapture %}
{% capture body %}{{ body }}{% for tag in customer.tags %}{% assign the_test = 'nutthin' %}{% capture tag_id %}{{ tag }}{% endcapture %}{% assign tag_count = 0 %}{% assign tag_size = tag_id | size %}{% for tag in customer.tags %}{% capture cur_tag %}{{ tag }}{% endcapture %}{% if cur_tag contains tag_id %}{% assign cur_tag_size = cur_tag | size %}{% assign difference = tag_size | minus: cur_tag_size %}{% if difference == 0 %}{% assign the_test = tag_id %}{% else %}{% assign the_test = 'nutthin' %}{% endif %}{% endif %}{% endfor %}{% for collection in collections %}{% paginate collection.products by collection.all_products_count %}{% for p in collection.products %}{% capture pID %}{{ p.id }}{% endcapture %}{% unless email_used contains pID %}{% capture difference %}{{ tag_size | minus:pID.size | money_without_currency | times:100 | divided_by: 2 }}{% endcapture %}{% assign check = difference | split:'.' %}{% if check[1] contains '5' %}{% assign display = false %}{% else %}{% assign display = true %}{% endif %}{% if display and the_test contains pID %}%0A%0A{{ p.title | replace: ' ','%20' }}%3A%20%20{{ shop.url }}{{ p.url }}{% capture email_used %}{{ pID }} {{ email_used }}{% endcapture %}{% endif %}{% endunless %}{% endfor %}{% endpaginate %}{% endfor %}{% endfor %}{% endcapture %}
<a href='mailto:?subject={{ subject }}&body={{ body }}'>Share my wish list via email</a>
{% else %}
<p>To create a wish list you must <a href='/account/login'>sign in</a> or <a href='/account/register'>create an account</a>.</p>
{% endif %}