From 64bcaf231780e843c6305666eae569936e8d1fc1 Mon Sep 17 00:00:00 2001
From: Carson Shold
Date: Thu, 19 Feb 2015 14:03:03 -0500
Subject: [PATCH 1/3] Updated product sale presentation in grid/list
---
locales/de.json | 1 +
locales/en.default.json | 1 +
locales/es.json | 1 +
locales/fr.json | 1 +
locales/pt-BR.json | 1 +
locales/pt-PT.json | 1 +
snippets/product-grid-item.liquid | 17 ++++++---
snippets/product-list-item.liquid | 59 +++++++++++++++++++------------
8 files changed, 55 insertions(+), 27 deletions(-)
diff --git a/locales/de.json b/locales/de.json
index a0c21a123..f2a89e3f9 100644
--- a/locales/de.json
+++ b/locales/de.json
@@ -262,6 +262,7 @@
},
"product": {
"sold_out": "Ausverkauft",
+ "on_sale": "Im Angebot",
"on_sale_from_html": "Im Angebot ab {{ price }}",
"unavailable": "Nicht verfügbar",
"compare_at": "Vergleichen bei",
diff --git a/locales/en.default.json b/locales/en.default.json
index 898f2617d..666ff9c19 100644
--- a/locales/en.default.json
+++ b/locales/en.default.json
@@ -262,6 +262,7 @@
},
"product": {
"sold_out": "Sold Out",
+ "on_sale": "On Sale",
"on_sale_from_html": "On Sale from {{ price }}",
"unavailable": "Unavailable",
"compare_at": "Compare at",
diff --git a/locales/es.json b/locales/es.json
index da7e82256..0a7cae6dc 100644
--- a/locales/es.json
+++ b/locales/es.json
@@ -262,6 +262,7 @@
},
"product": {
"sold_out": "Agotado",
+ "on_sale": "En oferta",
"on_sale_from_html": "En oferta desde {{ price }}",
"unavailable": "No disponible",
"compare_at": " Comparar en",
diff --git a/locales/fr.json b/locales/fr.json
index b312fcffd..633d12e85 100644
--- a/locales/fr.json
+++ b/locales/fr.json
@@ -262,6 +262,7 @@
},
"product": {
"sold_out": "Épuisé",
+ "on_sale": "En solde",
"on_sale_from_html": "En solde {{ price }}",
"unavailable": "Non disponible",
"compare_at": "Était",
diff --git a/locales/pt-BR.json b/locales/pt-BR.json
index 5b49edcb5..06e2c1f0d 100644
--- a/locales/pt-BR.json
+++ b/locales/pt-BR.json
@@ -262,6 +262,7 @@
},
"product": {
"sold_out": "Esgotado",
+ "on_sale": "Em promoção",
"on_sale_from_html": "Em promoção, a partir de {{ price }}",
"unavailable": "Indisponível",
"compare_at": "Preço normal:",
diff --git a/locales/pt-PT.json b/locales/pt-PT.json
index 630eb0f1a..3a1ffb0a0 100644
--- a/locales/pt-PT.json
+++ b/locales/pt-PT.json
@@ -262,6 +262,7 @@
},
"product": {
"sold_out": "Esgotado",
+ "on_sale": "Em Promoção",
"on_sale_from_html": "Em Promoção desde {{ price }}",
"unavailable": "Indisponível",
"compare_at": "Comparar em",
diff --git a/snippets/product-grid-item.liquid b/snippets/product-grid-item.liquid
index 1783b5599..8e5f9f0f3 100755
--- a/snippets/product-grid-item.liquid
+++ b/snippets/product-grid-item.liquid
@@ -66,14 +66,23 @@
You can show a leading 'from' or 'up to' by checking 'product.price_varies'
if your variants have different prices.
{% endcomment %}
- {% if product.price_varies %}{{ 'products.general.from' | t }}{% endif %}
- {{ product.price | money }}
+ {% if on_sale %}
+ {% if product.price_varies %}
+ {% assign sale_price = product.price | money %}
+ {{ 'products.product.on_sale_from_html' | t: price: sale_price }}
+ {% else %}
+ {{ 'products.product.on_sale' | t }}
+ {{ product.price | money }}
+ {% endif %}
+ {% else %}
+ {% if product.price_varies %}{{ 'products.general.from' | t }}{% endif %}
+ {{ product.price | money }}
+ {% endif %}
{% if sold_out %}
{{ 'products.product.sold_out' | t }}
{% endif %}
{% if on_sale %}
- {% assign sale_price = product.compare_at_price | money %}
-
{{ 'products.product.on_sale_from_html' | t: price: sale_price }}
+
{{ product.compare_at_price | money }}
{% endif %}
diff --git a/snippets/product-list-item.liquid b/snippets/product-list-item.liquid
index ac3fc88ce..0b55e355f 100755
--- a/snippets/product-list-item.liquid
+++ b/snippets/product-list-item.liquid
@@ -45,30 +45,43 @@
-
-
{{ product.title }}
-
- {% if product.excerpt.size > 0 %}
- {{ product.excerpt }}
- {% else %}
-
{{ product.content | strip_html | truncatewords: 30 }}
- {% endif %}
+
+
+
+
{{ product.title }}
+
+ {% if product.excerpt.size > 0 %}
+ {{ product.excerpt }}
+ {% else %}
+
{{ product.content | strip_html | truncatewords: 30 }}
+ {% endif %}
+
+
+
+ {% comment %}
+ You can show a leading 'from' or 'up to' by checking 'product.price_varies'
+ if your variants have different prices.
+ {% endcomment %}
+ {% if on_sale %}
+ {% if product.price_varies %}
+ {% assign sale_price = product.price | money %}
+ {{ 'products.product.on_sale_from_html' | t: price: sale_price }}
+ {% else %}
+ {{ 'products.product.on_sale' | t }}
+ {{ product.price | money }}
+ {% endif %}
+ {% else %}
+ {% if product.price_varies %}{{ 'products.general.from' | t }}{% endif %}
+ {{ product.price | money }}
+ {% endif %}
+ {% if sold_out %}
+
{{ 'products.product.sold_out' | t }}
+ {% endif %}
+ {% if on_sale %}
+
{{ product.compare_at_price | money }}
+ {% endif %}
+
-
- {% comment %}
- You can show a leading 'from' or 'up to' by checking 'product.price_varies'
- if your variants have different prices.
- {% endcomment %}
- {% if product.price_varies %}{{ 'products.general.from' | t }}{% endif %}
- {{ product.price | money }}
- {% if sold_out %}
-
{{ 'products.product.sold_out' | t }}
- {% endif %}
- {% if on_sale %}
- {% assign sale_price = product.compare_at_price | money %}
-
{{ 'products.product.on_sale_from_html' | t: price: sale_price }}
- {% endif %}
-
From e493012b1b9130b27b30330d641d51acf645d277 Mon Sep 17 00:00:00 2001
From: Carson Shold
Date: Mon, 23 Feb 2015 12:05:35 -0500
Subject: [PATCH 2/3] Added product price fix to search results
---
snippets/product-grid-item.liquid | 2 +-
snippets/product-list-item.liquid | 2 +-
snippets/search-result-grid.liquid | 57 ++++++++++++++++++++++--------
snippets/search-result.liquid | 57 +++++++++++++++++++++---------
templates/search.liquid | 2 +-
5 files changed, 86 insertions(+), 34 deletions(-)
diff --git a/snippets/product-grid-item.liquid b/snippets/product-grid-item.liquid
index 8e5f9f0f3..f890a8946 100755
--- a/snippets/product-grid-item.liquid
+++ b/snippets/product-grid-item.liquid
@@ -33,7 +33,7 @@
Check if the product is sold out and set a variable to be used below.
{% endcomment %}
{% assign sold_out = true %}
-{% if product.available %}
+{% if product.available %}
{% assign sold_out = false %}
{% endif %}
diff --git a/snippets/product-list-item.liquid b/snippets/product-list-item.liquid
index 0b55e355f..0e6492b0c 100755
--- a/snippets/product-list-item.liquid
+++ b/snippets/product-list-item.liquid
@@ -18,7 +18,7 @@
Check if the product is sold out and set a variable to be used below.
{% endcomment %}
{% assign sold_out = true %}
-{% if product.available %}
+{% if product.available %}
{% assign sold_out = false %}
{% endif %}
diff --git a/snippets/search-result-grid.liquid b/snippets/search-result-grid.liquid
index ac57537fe..33b210a3c 100755
--- a/snippets/search-result-grid.liquid
+++ b/snippets/search-result-grid.liquid
@@ -18,6 +18,22 @@
{% assign grid_item_width = 'large--one-third medium--one-half' %}
{% endunless %}
+{% comment %}
+ Check if the product is on sale and set a variable to be used below.
+{% endcomment %}
+{% assign on_sale = false %}
+{% if item.compare_at_price > item.price %}
+ {% assign on_sale = true %}
+{% endif %}
+
+{% comment %}
+ Check if the product is sold out and set a variable to be used below.
+{% endcomment %}
+{% assign sold_out = true %}
+{% if item.available %}
+ {% assign sold_out = false %}
+{% endif %}
+
{% if item.featured_image %}
@@ -30,20 +46,31 @@
{{ item.title | link_to: item.url }}
-
- {% if item.compare_at_price > item.price %}
-
- {{ item.price | money }}
-
-
- {{ 'products.product.compare_at' | t }}
- {{ item.compare_at_price_max | money }}
-
- {% else %}
-
- {{ item.price | money }}
-
- {% endif %}
-
+ {% if item.price %}
+
+ {% comment %}
+ You can show a leading 'from' or 'up to' by checking 'product.price_varies'
+ if your variants have different prices.
+ {% endcomment %}
+ {% if on_sale %}
+ {% if item.price_varies %}
+ {% assign sale_price = item.price | money %}
+ {{ 'products.product.on_sale_from_html' | t: price: sale_price }}
+ {% else %}
+ {{ 'products.product.on_sale' | t }}
+ {{ item.price | money }}
+ {% endif %}
+ {% else %}
+ {% if item.price_varies %}{{ 'products.general.from' | t }}{% endif %}
+ {{ item.price | money }}
+ {% endif %}
+ {% if sold_out %}
+
{{ 'products.product.sold_out' | t }}
+ {% endif %}
+ {% if on_sale %}
+
{{ item.compare_at_price | money }}
+ {% endif %}
+
+ {% endif %}
diff --git a/snippets/search-result.liquid b/snippets/search-result.liquid
index 555e648af..0c1c9841f 100755
--- a/snippets/search-result.liquid
+++ b/snippets/search-result.liquid
@@ -14,6 +14,22 @@
{% endcomment %}
+{% comment %}
+ Check if the product is on sale and set a variable to be used below.
+{% endcomment %}
+{% assign on_sale = false %}
+{% if item.compare_at_price > item.price %}
+ {% assign on_sale = true %}
+{% endif %}
+
+{% comment %}
+ Check if the product is sold out and set a variable to be used below.
+{% endcomment %}
+{% assign sold_out = true %}
+{% if item.available %}
+ {% assign sold_out = false %}
+{% endif %}
+
{% if item.featured_image %}
@@ -33,22 +49,31 @@
{{ item.title | link_to: item.url }}
- {% comment %}
- To show the price, let's pull what was already done on the product page,
- but change product to item.
- {% endcomment %}
- {% if item.compare_at_price > item.price %}
-
- {{ item.price | money }}
-
-
- {{ 'products.product.compare_at' | t }}
- {{ item.compare_at_price_max | money }}
-
- {% else %}
-
- {{ item.price | money }}
-
+ {% if item.price %}
+
+ {% comment %}
+ You can show a leading 'from' or 'up to' by checking 'product.price_varies'
+ if your variants have different prices.
+ {% endcomment %}
+ {% if on_sale %}
+ {% if item.price_varies %}
+ {% assign sale_price = item.price | money %}
+ {{ 'products.product.on_sale_from_html' | t: price: sale_price }}
+ {% else %}
+ {{ 'products.product.on_sale' | t }}
+ {{ item.price | money }}
+ {% endif %}
+ {% else %}
+ {% if item.price_varies %}{{ 'products.general.from' | t }}{% endif %}
+ {{ item.price | money }}
+ {% endif %}
+ {% if sold_out %}
+
{{ 'products.product.sold_out' | t }}
+ {% endif %}
+ {% if on_sale %}
+
{{ item.compare_at_price | money }}
+ {% endif %}
+
{% endif %}
{% comment %}
diff --git a/templates/search.liquid b/templates/search.liquid
index 8e4246d88..3c24733ee 100755
--- a/templates/search.liquid
+++ b/templates/search.liquid
@@ -17,7 +17,7 @@
If you're only showing products with the method above, why not show them off in a grid instead?
Set grid_results to true and see your updated results page for the new layout.
{% endcomment %}
-{% assign grid_results = false %}
+{% assign grid_results = true %}
{% comment %}
Check to enforce respond.js
From 889035f93802f966dc2f42fd4e6d1e1196fcbfc2 Mon Sep 17 00:00:00 2001
From: Carson Shold
Date: Mon, 23 Feb 2015 12:06:01 -0500
Subject: [PATCH 3/3] Revert to list search results
---
templates/search.liquid | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/templates/search.liquid b/templates/search.liquid
index 3c24733ee..8e4246d88 100755
--- a/templates/search.liquid
+++ b/templates/search.liquid
@@ -17,7 +17,7 @@
If you're only showing products with the method above, why not show them off in a grid instead?
Set grid_results to true and see your updated results page for the new layout.
{% endcomment %}
-{% assign grid_results = true %}
+{% assign grid_results = false %}
{% comment %}
Check to enforce respond.js