Skip to content

Commit

Permalink
chore: DATA-11172 Populate data tags despite of data_tag_enabled setting
Browse files Browse the repository at this point in the history
  • Loading branch information
bc-rmalyavc authored and BC-krasnoshapka committed Jun 30, 2023
1 parent 16bd54e commit 576d5a3
Show file tree
Hide file tree
Showing 16 changed files with 57 additions and 103 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added style configs to payment buttons [#2361](https://github.com/bigcommerce/cornerstone/pull/2361)
- Bump Stencil utils to 6.15.1 [#2365][https://github.com/bigcommerce/cornerstone/pull/2365]
- Added ACH payment method section to My Account -> Payment Methods page [#2362](https://github.com/bigcommerce/cornerstone/pull/2362)
- Remove data_tag_enabled check from everywhere [#2369][https://github.com/bigcommerce/cornerstone/pull/2369]

## 6.11.0 (05-24-2023)
- Reverted fix for sold-out badge appearance [#2354](https://github.com/bigcommerce/cornerstone/pull/2354)
Expand Down
2 changes: 1 addition & 1 deletion templates/components/brand/product-listing.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

{{> components/products/filter sort=pagination.brand.sort}}

<div {{#if settings.data_tag_enabled}} data-list-name="Brand: {{brand.name}}" {{/if}}>
<div data-list-name="Brand: {{brand.name}}">
{{#if theme_settings.product_list_display_mode '===' 'grid'}}
{{> components/products/grid products=brand.products show_compare=brand.show_compare theme_settings=theme_settings event="list"}}
{{else}}
Expand Down
14 changes: 3 additions & 11 deletions templates/components/category/product-listing.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,11 @@
{{#if category.products}}
{{> components/products/filter sort=pagination.category.sort}}

<div {{#if settings.data_tag_enabled}} data-list-name="Category: {{category.name}}" {{/if}}>
<div data-list-name="Category: {{category.name}}">
{{#if theme_settings.product_list_display_mode '===' 'grid'}}
{{#if settings.data_tag_enabled}}
{{> components/products/grid products=category.products show_compare=category.show_compare theme_settings=theme_settings event="list" }}
{{else}}
{{> components/products/grid products=category.products show_compare=category.show_compare theme_settings=theme_settings}}
{{/if}}
{{> components/products/grid products=category.products show_compare=category.show_compare theme_settings=theme_settings event="list" }}
{{else}}
{{#if settings.data_tag_enabled}}
{{> components/products/list products=category.products show_compare=category.show_compare theme_settings=theme_settings event="list" }}
{{else}}
{{> components/products/list products=category.products show_compare=category.show_compare theme_settings=theme_settings}}
{{/if}}
{{> components/products/list products=category.products show_compare=category.show_compare theme_settings=theme_settings event="list" }}
{{/if}}
</div>

Expand Down
23 changes: 7 additions & 16 deletions templates/components/common/footer.html
Original file line number Diff line number Diff line change
@@ -1,22 +1,13 @@
{{#if banners.bottom}}
{{#if settings.data_tag_enabled}}
<div class="banners" data-banner-location="bottom">
{{#each (limit banners.bottom_metadata 1)}}
<div class="banner" data-event-type="promotion" data-entity-id="{{this.id}}" data-name="{{this.banner-name}}" data-position="{{this.location}}" data-name="{{this.banner-name}}">
<div data-event-type="promotion-click">
{{{this.content}}}
</div>
<div class="banners" data-banner-location="bottom">
{{#each (limit banners.bottom_metadata 1)}}
<div class="banner" data-event-type="promotion" data-entity-id="{{this.id}}" data-name="{{this.banner-name}}" data-position="{{this.location}}" data-name="{{this.banner-name}}">
<div data-event-type="promotion-click">
{{{this.content}}}
</div>
{{/each}}
</div>
{{else}}
<div class="banners" data-banner-location="bottom">
<div class="banner">
{{{limit banners.bottom 1}}}
</div>
</div>
{{/if}}

{{/each}}
</div>
{{/if}}
<footer class="footer" role="contentinfo">
<h2 class="footer-title-sr-only">{{lang 'footer.title'}}</h2>
Expand Down
57 changes: 26 additions & 31 deletions templates/components/products/card.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,30 @@
class="card
{{#if alternate}} card--alternate{{/if}}"
data-test="card-{{id}}"
{{#if settings.data_tag_enabled}}
data-event-type="{{event}}"
data-entity-id="{{id}}"
data-position="{{position}}"
data-name="{{name}}"
data-product-category="
{{#each category}}
{{#if @last}}
{{this}}
{{else}}
{{this}},
{{/if}}
{{/each}}"
data-product-brand="{{brand.name}}"
data-product-price="
{{#or customer (unless settings.hide_price_from_guests)}}
{{#if price.with_tax}}
{{price.with_tax.value}}
{{else}}
{{price.without_tax.value}}
{{/if}}
data-event-type="{{event}}"
data-entity-id="{{id}}"
data-position="{{position}}"
data-name="{{name}}"
data-product-category="
{{#each category}}
{{#if @last}}
{{this}}
{{else}}
{{lang 'common.login_for_pricing'}}
{{/or}}"
{{/if}}>
{{this}},
{{/if}}
{{/each}}"
data-product-brand="{{brand.name}}"
data-product-price="
{{#or customer (unless settings.hide_price_from_guests)}}
{{#if price.with_tax}}
{{price.with_tax.value}}
{{else}}
{{price.without_tax.value}}
{{/if}}
{{else}}
{{lang 'common.login_for_pricing'}}
{{/or}}"
>
<figure class="card-figure">
{{#if stock_level '===' 0}}
{{#if theme_settings.pdp_sold_out_label '===' ''}}
Expand Down Expand Up @@ -63,7 +62,7 @@
<a href="{{url}}"
class="card-figure__link"
aria-label="{{> components/products/product-info}}"
{{#if settings.data_tag_enabled}} data-event-type="product-click" {{/if}}
data-event-type="product-click"
>
<div class="card-img-container">
{{> components/common/responsive-img
Expand All @@ -80,11 +79,7 @@
<div class="card-figcaption-body">
{{#unless hide_product_quick_view}}
{{#if theme_settings.show_product_quick_view}}
{{#if settings.data_tag_enabled}}
<button type="button" class="button button--small card-figcaption-button quickview" data-event-type="product-click" data-product-id="{{id}}">{{lang 'products.quick_view'}}</button>
{{else}}
<button type="button" class="button button--small card-figcaption-button quickview" data-product-id="{{id}}">{{lang 'products.quick_view'}}</button>
{{/if}}
<button type="button" class="button button--small card-figcaption-button quickview" data-event-type="product-click" data-product-id="{{id}}">{{lang 'products.quick_view'}}</button>
{{/if}}
{{/unless}}
{{#if show_compare}}
Expand Down Expand Up @@ -124,7 +119,7 @@
<h3 class="card-title">
<a aria-label="{{> components/products/product-info}}"
href="{{url}}"
{{#if settings.data_tag_enabled}} data-event-type="product-click" {{/if}}
data-event-type="product-click"
>
{{name}}
</a>
Expand Down
2 changes: 1 addition & 1 deletion templates/components/products/description.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{#if product.description}}
<p class="productView-title">{{lang 'products.description'}}</p>
<div class="productView-description" {{#if settings.data_tag_enabled}} data-event-type="product" {{/if}}>
<div class="productView-description" data-event-type="product">
{{{product.description}}}
</div>
{{/if}}
Expand Down
2 changes: 1 addition & 1 deletion templates/components/products/featured.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<h2 class="page-heading">{{lang 'products.featured' }}</h2>

<ul class="productGrid productGrid--maxCol{{ columns }}" data-product-type="featured" {{#if settings.data_tag_enabled}} data-list-name="Featured Products" {{/if}}>
<ul class="productGrid productGrid--maxCol{{ columns }}" data-product-type="featured" data-list-name="Featured Products">
{{#each products}}
<li class="product">
{{>components/products/card settings=../settings theme_settings=../theme_settings customer=../customer event="list" position=(add @index 1)}}
Expand Down
16 changes: 4 additions & 12 deletions templates/components/products/list-item.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{{#if settings.data_tag_enabled}}
<article class="listItem" data-event-type="{{event}}" data-entity-id="{{id}}" data-position="{{position}}" data-name="{{name}}" data-product-category="{{#each category}}{{#if @last}}{{this}}{{else}}{{this}}, {{/if}}{{/each}}" data-product-brand="{{brand.name}}" data-product-price="
<article class="listItem" data-event-type="{{event}}" data-entity-id="{{id}}" data-position="{{position}}" data-name="{{name}}" data-product-category="{{#each category}}{{#if @last}}{{this}}{{else}}{{this}}, {{/if}}{{/each}}" data-product-brand="{{brand.name}}" data-product-price="
{{#or customer (unless settings.hide_price_from_guests)}}
{{#if price.with_tax}}
{{price.with_tax.value}}
Expand All @@ -9,16 +8,11 @@
{{else}}
{{lang 'common.login_for_pricing'}}
{{/or}}">
{{else}}
<article class="listItem">
{{/if}}
<figure class="listItem-figure">
<a href="{{url}}"
class="listItem-figure__link"
aria-label="{{> components/products/product-info}}"
{{#if settings.data_tag_enabled}}
data-event-type="product-click"
{{/if}}
>
{{#if stock_level '===' 0}}
{{#if theme_settings.pdp_sold_out_label '===' ''}}
Expand Down Expand Up @@ -62,7 +56,7 @@
{{#unless hide_product_quick_view}}
{{#if theme_settings.show_product_quick_view}}
<div class="listItem-figureBody">
<button type="button" {{#if settings.data_tag_enabled}} data-event-type="product-click" {{/if}} class="button button--small listItem-button quickview" data-product-id="{{id}}">{{lang 'products.quick_view'}}</button>
<button type="button" data-event-type="product-click" class="button button--small listItem-button quickview" data-product-id="{{id}}">{{lang 'products.quick_view'}}</button>
</div>
{{/if}}
{{/unless}}
Expand All @@ -79,9 +73,7 @@
<h4 class="listItem-title">
<a href="{{url}}"
aria-label="{{> components/products/product-info}}"
{{#if settings.data_tag_enabled}}
data-event-type="product-click"
{{/if}}
>
{{name}}
</a>
Expand All @@ -100,13 +92,13 @@ <h4 class="listItem-title">
{{/or}}
{{#if show_cart_action}}
{{#if has_options}}
<a href="{{url}}" {{#if settings.data_tag_enabled}} data-event-type="product-click" {{/if}} class="button button--small" data-product-id="{{id}}">{{lang 'products.choose_options'}}</a>
<a href="{{url}}" data-event-type="product-click" class="button button--small" data-product-id="{{id}}">{{lang 'products.choose_options'}}</a>
{{/if}}
{{#if pre_order}}
<a href="{{pre_order_add_to_cart_url}}" data-event-type="product-click" class="button button--primary">{{lang 'products.pre_order'}}</a>
{{/if}}
{{#if add_to_cart_url }}
<a href="{{add_to_cart_url}}" {{#if settings.data_tag_enabled}} data-event-type="product-click" {{/if}} class="button button--primary">{{lang 'products.add_to_cart'}}</a>
<a href="{{add_to_cart_url}}" data-event-type="product-click" class="button button--primary">{{lang 'products.add_to_cart'}}</a>
{{/if}}
{{#if out_of_stock_message }}
<a href="{{url}}" data-event-type="product-click" class="button button--small" data-product-id="{{id}}">{{out_of_stock_message}}</a>
Expand Down
6 changes: 1 addition & 5 deletions templates/components/products/new.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
<h2 class="page-heading">{{lang 'products.new' }}</h2>
{{#if settings.data_tag_enabled}}
{{> components/products/carousel products=products list="New Products"}}
{{else}}
{{> components/products/carousel products=products}}
{{/if}}
{{> components/products/carousel products=products list="New Products"}}
3 changes: 1 addition & 2 deletions templates/components/products/product-view.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{{inject 'outOfStockDefaultMessage' (lang 'products.out_of_stock_default_message')}}

<div class="productView"
{{#if settings.data_tag_enabled}}
data-event-type="product"
data-entity-id="{{product.id}}"
data-name="{{product.title}}"
Expand All @@ -20,7 +19,7 @@
{{else}}
{{lang 'common.login_for_pricing'}}
{{/or}}"
data-product-variant="single-product-option"{{/if}}>
data-product-variant="single-product-option">

{{#each product.reviews.messages}}
{{#if error}}
Expand Down
2 changes: 1 addition & 1 deletion templates/components/products/related.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<h4>{{lang 'products.related_products' }}</h4>
<ul class="product-list" {{#if settings.data_tag_enabled}} data-list-name="Related Products" {{/if}}>
<ul class="product-list" data-list-name="Related Products">
{{#each this}}
<li class="product-card">
{{>components/products/card settings=../settings theme_settings=../theme_settings event="list" position=(add @index 1)}}
Expand Down
6 changes: 1 addition & 5 deletions templates/components/products/tabs.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,7 @@
<div class="tabs-contents">
{{#if product.related_products}}
<div role="tabpanel" aria-hidden="false" class="tab-content has-jsContent is-active" id="tab-related">
{{#if settings.data_tag_enabled}}
{{> components/products/carousel products=product.related_products columns=6 list="Related Products"}}
{{else}}
{{> components/products/carousel products=product.related_products columns=6}}
{{/if}}
{{> components/products/carousel products=product.related_products columns=6 list="Related Products"}}
</div>
{{/if}}

Expand Down
2 changes: 1 addition & 1 deletion templates/components/products/top.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<h2 class="page-heading">{{lang 'products.top' }}</h2>

<ul class="productGrid productGrid--maxCol{{ columns }}" data-product-type="top_sellers" {{#if settings.data_tag_enabled}} data-list-name="Most Popular Products" {{/if}}>
<ul class="productGrid productGrid--maxCol{{ columns }}" data-product-type="top_sellers" data-list-name="Most Popular Products">
{{#each products}}
<li class="product">
{{>components/products/card settings=../settings theme_settings=../theme_settings customer=../customer event="list" position=(add @index 1)}}
Expand Down
14 changes: 3 additions & 11 deletions templates/components/search/product-listing.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,11 @@
{{#if product_results.products.length}}
{{> components/products/filter sort=pagination.product_results.sort}}
{{/if}}
<div {{#if settings.data_tag_enabled}} data-list-name="Search Results" {{/if}}>
<div data-list-name="Search Results">
{{#if theme_settings.product_list_display_mode '===' 'grid'}}
{{#if settings.data_tag_enabled}}
{{> components/products/grid products=product_results.products show_compare=product_results.show_compare event="list" theme_settings=theme_settings}}
{{else}}
{{> components/products/grid products=product_results.products show_compare=product_results.show_compare theme_settings=theme_settings}}
{{/if}}
{{> components/products/grid products=product_results.products show_compare=product_results.show_compare event="list" theme_settings=theme_settings}}
{{else}}
{{#if settings.data_tag_enabled}}
{{> components/products/list products=product_results.products show_compare=product_results.show_compare event="list" theme_settings=theme_settings}}
{{else}}
{{> components/products/list products=product_results.products show_compare=product_results.show_compare theme_settings=theme_settings}}
{{/if}}
{{> components/products/list products=product_results.products show_compare=product_results.show_compare event="list" theme_settings=theme_settings}}
{{/if}}
</div>

Expand Down
2 changes: 1 addition & 1 deletion templates/components/search/quick-results.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{#if product_results.products}}
{{> components/common/modal/modal-close-btn additional_attr='data-drop-down-close'}}
<ul class="productGrid" {{#if settings.data_tag_enabled}} data-list-name="Quick Search Results" {{/if}}>
<ul class="productGrid" data-list-name="Quick Search Results">
{{#each product_results.products}}
<li class="product">
{{> components/products/card
Expand Down
8 changes: 4 additions & 4 deletions templates/pages/compare.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ <h1 class="page-heading">{{lang 'compare.header' products=comparisons.length}}</
<th class="compareTable-product">
<article class="card">
<figure class="card-figure">
<a class="card-figure__link" aria-label="{{name}}" href="{{url}}" {{#if settings.data_tag_enabled}} data-event-type="product-click" {{/if}}>
<a class="card-figure__link" aria-label="{{name}}" href="{{url}}" data-event-type="product-click">
<div class="card-img-container">
{{> components/common/responsive-img
image=image
Expand Down Expand Up @@ -57,15 +57,15 @@ <h3 class="card-title">
<td class="compareTable-action">
{{#if show_cart_action}}
{{#if has_options}}
<a href="{{url}}" {{#if settings.data_tag_enabled}} data-event-type="product-click" {{/if}} class="button button--primary" data-product-id="{{id}}">{{lang 'products.choose_options'}}</a>
<a href="{{url}}" data-event-type="product-click" class="button button--primary" data-product-id="{{id}}">{{lang 'products.choose_options'}}</a>
{{/if}}
{{#if pre_order}}
<a href="{{url}}" {{#if settings.data_tag_enabled}} data-event-type="product-click" {{/if}} class="button button--primary" data-product-id="{{id}}">
<a href="{{url}}" data-event-type="product-click" class="button button--primary" data-product-id="{{id}}">
{{lang 'products.pre_order'}}
</a>
{{/if}}
{{#if add_to_cart_url}}
<a href="{{add_to_cart_url}}" {{#if settings.data_tag_enabled}} data-event-type="product-click" {{/if}} class="button button--primary" data-product-id="{{id}}">
<a href="{{add_to_cart_url}}" data-event-type="product-click" class="button button--primary" data-product-id="{{id}}">
{{lang 'products.add_to_cart'}}
</a>
{{/if}}
Expand Down

0 comments on commit 576d5a3

Please sign in to comment.