Skip to content

Commit

Permalink
ecommerce support
Browse files Browse the repository at this point in the history
  • Loading branch information
sujaykundu777 committed Aug 31, 2019
1 parent 9ccbb4e commit ccb165e
Show file tree
Hide file tree
Showing 16 changed files with 297 additions and 62 deletions.
35 changes: 30 additions & 5 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ baseurl: "" # the subpath of your site, e.g. /blog
urls:
- text: Blog
url: /blog
- text: Shop
url : /shop/
- text: About Me
url: /about
url: /about/
- text: Contact Me
url : /contact
- text: Search
url : /search
url : /contact/
- text: Styleguide
url: /styleguide
url: /styleguide/


# Edit these details

Expand Down Expand Up @@ -133,3 +134,27 @@ compress_html:
# layout: archive
# permalinks:
# category: '/category/:name/'


collections:
- products

# Exclude from processing.
# The following items will not be processed, by default.
# Any item listed under the `exclude:` key here will be automatically added to
# the internal "default list".
#
# Excluded items can be processed by explicitly listing the directories or
# their entries' file path in the `include:` list.
#
# exclude:
# - .sass-cache/
# - .jekyll-cache/
# - gemfiles/
# - Gemfile
# - Gemfile.lock
# - node_modules/
# - vendor/bundle/
# - vendor/cache/
# - vendor/gems/
# - vendor/ruby/
110 changes: 54 additions & 56 deletions _includes/head.html
Original file line number Diff line number Diff line change
@@ -1,71 +1,69 @@
<head>
<meta charset="utf-8">

<title>{{ site.title }} - {{ site.subtitle }}</title>

<meta http-equip="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">

<meta name="description" content="{{ site.description }}">


<link rel="stylesheet" href="{{site.url}}/assets/css/main.css" />
<link rel="stylesheet" href="{{site.url}}/assets/css/custom-style.css" />

<link rel="icon" href="/assets/img/favicon.ico" type="image/gif" sizes="16x16">
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49"
<link rel="icon" href="{{site.url}}/assets/img/favicon.ico" type="image/gif" sizes="16x16">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"
integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49"
crossorigin="anonymous"></script>
<script async defer src="https://buttons.github.io/buttons.js"></script>
<link href="https://fonts.googleapis.com/css?family=Quicksand&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB"
crossorigin="anonymous">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.1.0/css/all.css" integrity="sha384-lKuwvrZot6UHsBSfcMvOkWwlCMgc0TaWr+30HWe3a4ltaBwTZhyTEggF5tJv8tbt"
crossorigin="anonymous">

<!-- Including InstantSearch.js library and styling -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/instantsearch.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.20.1/moment.min.js"></script>
<link href="https://fonts.googleapis.com/css?family=Quicksand&display=swap" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/instantsearch.min.css">
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/instantsearch-theme-algolia.min.css">


<script>
(function(d, h, m){
var js, fjs = d.getElementsByTagName(h)[0];
if (d.getElementById(m)){return;}
js = d.createElement(h); js.id = m;
js.onload = function(){
window.makerWidgetComInit({
position: "right",
widget: "ofeeof264otl2l5g-zspk40eq2gaomj2n-higi2qphmveubksi"
})};
js.src = "https://makerwidget.com/js/embed.js";
fjs.parentNode.insertBefore(js, fjs)
}(document, "script", "dhm"))
<script async defer src="https://buttons.github.io/buttons.js"></script>
<link href="https://fonts.googleapis.com/css?family=Quicksand&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css"
integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB" crossorigin="anonymous">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.1.0/css/all.css"
integrity="sha384-lKuwvrZot6UHsBSfcMvOkWwlCMgc0TaWr+30HWe3a4ltaBwTZhyTEggF5tJv8tbt" crossorigin="anonymous">
<!-- Including Snipcart -->
<link rel="stylesheet" href="https://cdn.snipcart.com/themes/v3.0.0-beta.3/default/snipcart.css" />
<!-- Including InstantSearch.js library and styling -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/instantsearch.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.20.1/moment.min.js"></script>
<link href="https://fonts.googleapis.com/css?family=Quicksand&display=swap" rel="stylesheet">
<link rel="stylesheet" type="text/css"
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/instantsearch.min.css">
<link rel="stylesheet" type="text/css"
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/instantsearch-theme-algolia.min.css">
<script>
(function (d, h, m) {
var js, fjs = d.getElementsByTagName(h)[0];
if (d.getElementById(m)) { return; }
js = d.createElement(h); js.id = m;
js.onload = function () {
window.makerWidgetComInit({
position: "right",
widget: "ofeeof264otl2l5g-zspk40eq2gaomj2n-higi2qphmveubksi"
})
};
js.src = "https://makerwidget.com/js/embed.js";
fjs.parentNode.insertBefore(js, fjs)
}(document, "script", "dhm"))
</script>

{% if jekyll.environment == "production" %}
{% if jekyll.environment == "production" %}

<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
<script>
(function (i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date(); a = s.createElement(o),
m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g; m.parentNode.insertBefore(a, m)
})(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');

ga('create', '{{ site.google_analytics }}', 'auto');
ga('send', 'pageview');
</script>
{% endif %}
ga('create', '{{ site.google_analytics }}', 'auto');
ga('send', 'pageview');
</script>
{% endif %}

<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<script>
(adsbygoogle = window.adsbygoogle || []).push({
google_ad_client: "ca-pub-7259836434848202",
enable_page_level_ads: true
});
</script>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<script>
(adsbygoogle = window.adsbygoogle || []).push({
google_ad_client: "ca-pub-7259836434848202",
enable_page_level_ads: true
});
</script>

</head>
</head>
15 changes: 15 additions & 0 deletions _includes/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,21 @@ <h1 class="profile-name"> {{ site.title }}</h1>
<a class="nav-link" href="{{ i.url }}">{{ i.text }}</a>
</li>
{% endfor %}
<li class="nav-item">
<a class="nav-link" href="{{ site.url}}/search/"><i class="fa fa-search" aria-hidden="true"></i></a>
</li>
<li class="nav-item">
<button class="header__checkout snipcart-checkout">

<svg width="31" height="27" viewBox="0 0 31 27" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
d="M1.10512 0.368718C0.560256 0.368718 0.118164 0.812066 0.118164 1.35848C0.118164 1.9049 0.560256 2.34824 1.10512 2.34824H4.90887L8.30138 18.4009C8.43503 19.0053 8.83085 19.5079 9.32946 19.5041H25.7788C26.3005 19.5118 26.7799 19.0375 26.7799 18.5143C26.7799 17.9911 26.3006 17.5168 25.7788 17.5245H10.1315L9.71003 15.545H27.095C27.5371 15.5412 27.9547 15.2048 28.0511 14.7718L30.354 4.87412C30.4825 4.29933 29.9852 3.67172 29.3979 3.66786H7.21171L6.6771 1.15221C6.58329 0.71276 6.15921 0.368652 5.7107 0.368652L1.10512 0.368718ZM7.623 5.64746H12.7634L13.2569 8.61674H8.25005L7.623 5.64746ZM14.7785 5.64746H20.9881L20.4946 8.61674H15.2719L14.7785 5.64746ZM23.0031 5.64746H28.1537L27.4649 8.61674H22.5097L23.0031 5.64746ZM8.67181 10.5963H13.5862L14.0797 13.5656H9.29919L8.67181 10.5963ZM15.6009 10.5963H20.1656L19.6721 13.5656H16.0944L15.6009 10.5963ZM22.1807 10.5963H27.0023L26.3135 13.5656H21.6872L22.1807 10.5963ZM12.6197 20.164C10.8141 20.164 9.32979 21.6525 9.32979 23.4632C9.32979 25.2739 10.8141 26.7624 12.6197 26.7624C14.4252 26.7624 15.9095 25.2739 15.9095 23.4632C15.9095 21.6525 14.4252 20.164 12.6197 20.164ZM22.4892 20.164C20.6837 20.164 19.1994 21.6525 19.1994 23.4632C19.1994 25.2739 20.6837 26.7624 22.4892 26.7624C24.2948 26.7624 25.7791 25.2739 25.7791 23.4632C25.7791 21.6525 24.2948 20.164 22.4892 20.164ZM12.6197 22.1435C13.3586 22.1435 13.9356 22.7222 13.9356 23.4632C13.9356 24.2042 13.3586 24.7829 12.6197 24.7829C11.8807 24.7829 11.3037 24.2042 11.3037 23.4632C11.3037 22.7222 11.8807 22.1435 12.6197 22.1435ZM22.4892 22.1435C23.2282 22.1435 23.8052 22.7222 23.8052 23.4632C23.8052 24.2042 23.2282 24.7829 22.4892 24.7829C21.7503 24.7829 21.1733 24.2042 21.1733 23.4632C21.1733 22.7222 21.7503 22.1435 22.4892 22.1435Z"
fill="#9094FF" class="header__checkout-fill"></path>
</svg>
<span class="snipcart-items-count"></span>
<!-- <span class="snipcart-total-price"></span> -->
</button>
</li>
</ul>

</div>
Expand Down
9 changes: 9 additions & 0 deletions _includes/product.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<div class="blog-post card product">
<img src="{{ product.image }}" alt="{{ product.name }} product image" class="product__image card-img-top">
<div class="product__information">
<h2 class="product__title">{{ product.name }}</h2>
<p class="product__description">{{ product.content | remove: '<p>' | remove: '</p>' }}</p>
{% include product_definition.html %}
</div>

</div>
10 changes: 10 additions & 0 deletions _includes/product_definition.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<button
class="buy-button snipcart-add-item btn-success"
data-item-id="{{ product.identifier }}"
data-item-name="{{ product.name }}"
data-item-price="{{ product.price }}"
data-item-image="{{ product.image }}"
data-item-url="https://devlopr.netlify.com{{ page.url }}"
data-item-description="{{ product.content | remove: '<p>' | remove: '</p>' }}">
Add to cart (${{ product.price }})
</button>
2 changes: 2 additions & 0 deletions _layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,6 @@
</div>
</body>

<div hidden id="snipcart" data-api-key="Y2I1NTAyNWYtMTNkMy00ODg0LWE4NDItNTZhYzUxNzJkZTI5NjM3MDI4NTUzNzYyMjQ4NzU0"></div>
<script src="https://cdn.snipcart.com/themes/v3.0.0-beta.3/default/snipcart.js" defer></script>
</html>
11 changes: 11 additions & 0 deletions _layouts/product.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
layout: default
---

<div class="row">
<div class="products-container col-lg-8">
{% for product in site.products %}
{% include product.html %}
{% endfor %}
</div>
</div>
8 changes: 8 additions & 0 deletions _products/product1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
identifier: john-doe-tshrirt
name: John Doe Tshirt
price: 50
image: /assets/img/products/product1.jpg
---

This is a high-quality replica of The Starry Night by the Dutch post-impressionist painter Vincent van Gogh. Using brand new techniques such as magneto-reluctance and capacitive reactance, we were able to reproduce the original colours with a 99.99% accuracy.
8 changes: 8 additions & 0 deletions _products/product2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
identifier: jekyll-starry-night-2
name: John Doe Mug
price: 10
image: /assets/img/products/product2.jpg
---

This is a high-quality replica of The Starry Night by the Dutch post-impressionist painter Vincent van Gogh. Using brand new techniques such as magneto-reluctance and capacitive reactance, we were able to reproduce the original colours with a 99.99% accuracy.
8 changes: 8 additions & 0 deletions _products/product3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
identifier: jekyll-starry-night-3
name: John Doe Mug
price: 10
image: /assets/img/products/product3.jpg
---

This is a high-quality replica of The Starry Night by the Dutch post-impressionist painter Vincent van Gogh. Using brand new techniques such as magneto-reluctance and capacitive reactance, we were able to reproduce the original colours with a 99.99% accuracy.
Loading

0 comments on commit ccb165e

Please sign in to comment.