Created
June 6, 2017 07:55
-
-
Save tvlgiao/16dcf0de60196c2f31859b3f64689d75 to your computer and use it in GitHub Desktop.
[BigCommerce] Add new category layout to show sub-category images on category page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/templates/components/emthemes-modez/sections/section-categories-grid.html b/templates/components/emthemes-modez/sections/section-categories-grid.html | |
index 67a6e2a..61b12f9 100644 | |
--- a/templates/components/emthemes-modez/sections/section-categories-grid.html | |
+++ b/templates/components/emthemes-modez/sections/section-categories-grid.html | |
@@ -20,10 +20,15 @@ Arguments: | |
{{/if}} | |
<div class="emthemesModez-categoriesGrid-body"> | |
<h4 class="emthemesModez-categoriesGrid-name"> | |
- {{name}} | |
+ <a href="{{url}}">{{name}}</a> | |
</h4> | |
<div class="emthemesModez-categoriesGrid-productsCount"> | |
+ {{#if product_count '>' 0}} | |
+ {{lang 'emthemesmodez.categories_grid.products_count' count=product_count}} | |
+ {{/if}} | |
+ {{#or (if count '>' 0) (if count '===' 0)}} | |
{{lang 'emthemesmodez.categories_grid.products_count' count=count}} | |
+ {{/or}} | |
</div> | |
</div> | |
</article> | |
diff --git a/templates/pages/category.html b/templates/pages/category.html | |
index fd4adff..bcf997d 100644 | |
--- a/templates/pages/category.html | |
+++ b/templates/pages/category.html | |
@@ -19,9 +19,11 @@ category: | |
{{> components/common/breadcrumbs breadcrumbs=breadcrumbs}} | |
<div class="page"> | |
+ {{#if category.products}} | |
<aside class="page-sidebar" id="faceted-search-container"> | |
{{> components/category/sidebar}} | |
</aside> | |
+ {{/if}} | |
<main class="page-content" id="product-listing-container"> | |
{{#if category.image}} | |
@@ -42,7 +44,11 @@ category: | |
{{#if category.products}} | |
{{> components/category/product-listing}} | |
{{else}} | |
- <p>{{lang 'categories.no_products'}}</p> | |
+ {{#if category.subcategories}} | |
+ {{> components/emthemes-modez/sections/section-categories-grid categories=category.subcategories}} | |
+ {{else}} | |
+ <p>{{lang 'categories.no_products'}}</p> | |
+ {{/if}} | |
{{/if}} | |
</main> | |
</div> | |
diff --git a/templates/pages/custom/category/one-column-subcategories.html b/templates/pages/custom/category/one-column-subcategories.html | |
new file mode 100644 | |
index 0000000..390d4c2 | |
--- /dev/null | |
+++ b/templates/pages/custom/category/one-column-subcategories.html | |
@@ -0,0 +1,42 @@ | |
+--- | |
+category: | |
+ shop_by_price: true | |
+ products: | |
+ limit: {{theme_settings.categorypage_products_per_page}} | |
+--- | |
+{{inject "categoryProductsPerPage" theme_settings.categorypage_products_per_page}} | |
+{{#partial "head"}} | |
+ {{#if pagination.category.previous}} | |
+ <link rel="prev" href="{{pagination.category.previous}}"> | |
+ {{/if}} | |
+ {{#if pagination.category.next}} | |
+ <link rel="next" href="{{pagination.category.next}}"> | |
+ {{/if}} | |
+{{/partial}} | |
+ | |
+{{#partial "page"}} | |
+ | |
+{{> components/common/breadcrumbs breadcrumbs=breadcrumbs}} | |
+ | |
+<div class="page"> | |
+ <main class="page-content" id="product-listing-container"> | |
+ {{#if category.image}} | |
+ <img class="emthemesModez-categoryPage-mainImage" src="{{getImage category.image 'zoom_size'}}"> | |
+ {{/if}} | |
+ <h1 class="page-heading">{{category.name}}</h1> | |
+ | |
+ {{{category.description}}} | |
+ {{{snippet 'categories'}}} | |
+ | |
+ {{> components/emthemes-modez/sections/section-categories-grid categories=category.subcategories}} | |
+ | |
+ {{#if category.products}} | |
+ {{> components/category/product-listing}} | |
+ {{else}} | |
+ <p>{{lang 'categories.no_products'}}</p> | |
+ {{/if}} | |
+ </main> | |
+</div> | |
+ | |
+{{/partial}} | |
+{{> layout/base}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment