-
Notifications
You must be signed in to change notification settings - Fork 69
/
recently-viewed.liquid
97 lines (82 loc) · 1.91 KB
/
recently-viewed.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
{{ '//ajax.aspnetcdn.com/ajax/jquery.templates/beta1/jquery.tmpl.min.js' | script_tag }}
{{ 'jquery.products.min.js' | asset_url | script_tag }}
<div id="recently-viewed-products" class="collection clearfix" style="display:none">
<h2>Recently Viewed Products</h2>
</div>
{% raw %}
<script id="recently-viewed-product-template" type="text/x-jquery-tmpl">
<div id="product-${handle}" class="product">
<div class="image">
<a href="${url}">
<img src="${Shopify.Products.resizeImage(featured_image, "medium")}" />
</a>
</div>
<div class="details">
<a href="${url}">
<span class="title">${title}</span>
<span class="price">{{if price_varies}}From {{/if}}${Shopify.formatMoney(price)}</span>
</a>
</div>
</div>
</script>
{% endraw %}
<script>
Shopify.Products.showRecentlyViewed( { howManyToShow:4 } );
</script>
<style>
/* Some styles to get you started */
.collection {
clear: both;
padding-top: 50px;
}
.collection .product {
float: left;
text-align: center;
width: 162px; /* 160px + 1px + 1px for the borders on either side */
margin: 0 14px 14px 0;
padding: 0;
position: relative; /* used to display absolutely positioned sale tag */
overflow: hidden;
}
.collection .product.last {
margin-right: 0;
}
.collection .product .image {
border: 1px solid #E0E0E0;
margin-bottom: 10px;
height: 160px;
overflow: hidden;
}
.collection .product .cy {
display: block;
margin: 0 auto;
}
.collection .product .image img {
max-width: 160px;
}
.collection .product .title {
display: block;
line-height: 16px;
font-size: 12px;
color: #222;
font-weight: 700;
}
.collection .product .price {
display: block;
line-height: 16px;
font-size: 11px;
color: #777;
font-weight: normal;
}
/* new clearfix */
.clearfix:after {
visibility: hidden;
display: block;
font-size: 0;
content: " ";
clear: both;
height: 0;
}
* html .clearfix { zoom: 1; } /* IE6 */
*:first-child+html .clearfix { zoom: 1; } /* IE7 */
</style>