Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to display custom fields under "Additional Information" tab on PDP #1480

Merged
merged 1 commit into from
Apr 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
- Remove deprecated "snippet" locations [#1479](https://github.com/bigcommerce/cornerstone/pull/1479)
- Fix dropdown cart not showing discounts [#1481](https://github.com/bigcommerce/cornerstone/pull/1481)
- Fix mobile banner text displaying with underline on mobile. [#1482](https://github.com/bigcommerce/cornerstone/pull/1482)
- Add option to display custom fields under "Specifications" tab on PDP [#1480](https://github.com/bigcommerce/cornerstone/pull/1480)

## 3.4.1 (2019-04-11)
- Sanitize faceted search item's title [#1426](https://github.com/bigcommerce/cornerstone/pull/1426)
Expand Down
4 changes: 4 additions & 0 deletions assets/scss/components/foundation/tabs/_tabs.scss
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@
@include breakpoint("medium") {
padding: spacing("half") spacing("single");
}

@include breakpoint("large") {
padding: remCalc(11px) remCalc(18px);
}
}

.tab-content {
Expand Down
2 changes: 2 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
"show_accept_visa": false,
"show_product_details_tabs": true,
"show_product_reviews_tabs": false,
"show_custom_fields_tabs": false,
"show_product_weight": true,
"show_product_dimensions": false,
"product_list_display_mode": "grid",
Expand Down Expand Up @@ -304,6 +305,7 @@
"pdp-sale-price-label": "Now:",
"pdp-non-sale-price-label": "Was:",
"pdp-retail-price-label": "MSRP:",
"pdp-custom-fields-tab-label": "Additional Information",
"paymentbuttons-paypal-layout": "horizontal",
"paymentbuttons-paypal-color": "gold",
"paymentbuttons-paypal-shape": "pill",
Expand Down
14 changes: 14 additions & 0 deletions schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1285,6 +1285,20 @@
"force_reload": true,
"id": "show_product_details_tabs"
},
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bigcommerce/merc-team

"type": "checkbox",
"label": "Product custom fields in tabs",
"force_reload": true,
"id": "show_custom_fields_tabs"
},
{
"type": "text",
"label": "Product custom fields tab label",
"force_reload": true,
"reference": "show_custom_fields_tabs",
"reference_default": false,
"id": "pdp-custom-fields-tab-label"
},
{
"type": "checkbox",
"label": "Show product weight",
Expand Down
15 changes: 15 additions & 0 deletions templates/components/products/description-tabs.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
<a class="tab-title" href="#tab-warranty">{{lang 'products.warranty'}}</a>
</li>
{{/if}}
{{#all product.custom_fields theme_settings.show_custom_fields_tabs}}
<li class="tab">
<a class="tab-title" href="#tab-{{dashcase (lowercase (sanitize theme_settings.pdp-custom-fields-tab-label))}}">{{sanitize theme_settings.pdp-custom-fields-tab-label}}</a>
</li>
{{/all}}
{{#all settings.show_product_reviews theme_settings.show_product_reviews_tabs product.reviews.total}}
<li class="tab">
<a class="tab-title productView-reviewTabLink" href="#tab-reviews">{{lang 'products.reviews.header' total=product.reviews.total}}</a>
Expand All @@ -22,6 +27,16 @@
{{{product.warranty}}}
</div>
{{/if}}
{{#all product.custom_fields theme_settings.show_custom_fields_tabs}}
<div class="tab-content" id="tab-{{dashcase (lowercase (sanitize theme_settings.pdp-custom-fields-tab-label))}}">
<dl class="productView-info">
{{#each product.custom_fields}}
<dt class="productView-info-name">{{name}}:</dt>
<dd class="productView-info-value">{{{value}}}</dd>
{{/each}}
</dl>
</div>
{{/all}}
{{#all settings.show_product_reviews theme_settings.show_product_reviews_tabs}}
<div class="tab-content" id="tab-reviews">
{{> components/products/reviews reviews=product.reviews product=product urls=urls}}
Expand Down
10 changes: 6 additions & 4 deletions templates/components/products/product-view.html
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,12 @@ <h2 class="productView-brand"{{#if schema}} itemprop="brand" itemscope itemtype=
</div>
{{/if}}

{{#each product.custom_fields}}
<dt class="productView-info-name">{{name}}:</dt>
<dd class="productView-info-value">{{{value}}}</dd>
{{/each}}
{{#if theme_settings.show_custom_fields_tabs '!==' true}}
{{#each product.custom_fields}}
<dt class="productView-info-name">{{name}}:</dt>
<dd class="productView-info-value">{{{value}}}</dd>
{{/each}}
{{/if}}
</dl>
</div>
</section>
Expand Down