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

feat(storefront): STRF-10309 Refactor Cornerstone for show_cart_action behavior #2304

Merged
merged 2 commits into from
Jan 17, 2023
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 @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added integrarion of storefront-account-payments lib [#2288][https://github.com/bigcommerce/cornerstone/pull/2288]
- Bump Stencil utils to 6.13.0 [#2300][https://github.com/bigcommerce/cornerstone/pull/2300]
- Removed non-working functionality from schema.json [#2301][https://github.com/bigcommerce/cornerstone/pull/2301]
- Refactored `hide_price_from_guests` logic around `show_cart_action` use [#2304](https://github.com/bigcommerce/cornerstone/pull/2304)

## 6.7.0 (11-03-2022)
- Fixed escaping on created store account confirm message. [#2265]https://github.com/bigcommerce/cornerstone/pull/2265
Expand Down
30 changes: 14 additions & 16 deletions templates/components/products/card.html
Original file line number Diff line number Diff line change
Expand Up @@ -92,23 +92,21 @@
{{lang 'products.compare'}} <input type="checkbox" name="products[]" value="{{id}}" id="compare-{{id}}" data-compare-id="{{id}}">
</label>
{{/if}}
{{#or customer (unless settings.hide_price_from_guests)}}
{{#if show_cart_action}}
{{#if has_options}}
<a href="{{url}}" data-event-type="product-click" class="button button--small card-figcaption-button" 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--small card-figcaption-button">{{lang 'products.pre_order'}}</a>
{{/if}}
{{#if add_to_cart_url }}
<a href="{{add_to_cart_url}}" data-event-type="product-click" data-button-type="add-cart" class="button button--small card-figcaption-button">{{lang 'products.add_to_cart'}}</a>
<span class="product-status-message aria-description--hidden">{{lang 'category.add_cart_announcement'}}</span>
{{/if}}
{{#if out_of_stock_message }}
<a href="{{url}}" data-event-type="product-click" class="button button--small card-figcaption-button" data-product-id="{{id}}">{{out_of_stock_message}}</a>
{{/if}}
{{#if show_cart_action}}
{{#if has_options}}
<a href="{{url}}" data-event-type="product-click" class="button button--small card-figcaption-button" data-product-id="{{id}}">{{lang 'products.choose_options'}}</a>
{{/if}}
{{/or}}
{{#if pre_order}}
<a href="{{pre_order_add_to_cart_url}}" data-event-type="product-click" class="button button--small card-figcaption-button">{{lang 'products.pre_order'}}</a>
{{/if}}
{{#if add_to_cart_url }}
<a href="{{add_to_cart_url}}" data-event-type="product-click" data-button-type="add-cart" class="button button--small card-figcaption-button">{{lang 'products.add_to_cart'}}</a>
<span class="product-status-message aria-description--hidden">{{lang 'category.add_cart_announcement'}}</span>
{{/if}}
{{#if out_of_stock_message }}
<a href="{{url}}" data-event-type="product-click" class="button button--small card-figcaption-button" data-product-id="{{id}}">{{out_of_stock_message}}</a>
{{/if}}
{{/if}}
</div>
</figcaption>
</figure>
Expand Down
28 changes: 14 additions & 14 deletions templates/components/products/list-item.html
Original file line number Diff line number Diff line change
Expand Up @@ -95,23 +95,23 @@ <h4 class="listItem-title">
{{#if price}}
<div class="listItem-price">{{> components/products/price price=price}}</div>
{{/if}}
{{#if show_cart_action}}
jordanarldt marked this conversation as resolved.
Show resolved Hide resolved
{{#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>
{{/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>
{{/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>
{{/if}}
{{/if}}
{{else}}
{{> components/common/login-for-pricing}}
{{/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>
{{/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>
{{/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>
{{/if}}
{{/if}}
{{#if show_compare}}
<label class="button button--small" for="compare-{{id}}">
{{lang "products.compare"}} <input type="checkbox" name="products[]" value="{{id}}" id="compare-{{id}}" data-compare-id="{{id}}">
Expand Down
36 changes: 17 additions & 19 deletions templates/pages/compare.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,26 +55,24 @@ <h3 class="card-title">
<th class="compareTable-heading"></th>
{{#each comparisons}}
<td class="compareTable-action">
{{#or ../customer (unless ../settings.hide_price_from_guests)}}
{{#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>
{{/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}}">
{{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}}">
{{lang 'products.add_to_cart'}}
</a>
{{/if}}
{{#if out_of_stock_message}}
<a href="{{url}}" class="button button--primary" data-product-id="{{id}}">{{out_of_stock_message}}</a>
{{/if}}
{{#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>
{{/if}}
{{/or}}
{{#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}}">
{{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}}">
{{lang 'products.add_to_cart'}}
</a>
{{/if}}
{{#if out_of_stock_message}}
<a href="{{url}}" class="button button--primary" data-product-id="{{id}}">{{out_of_stock_message}}</a>
{{/if}}
{{/if}}
</td>
{{/each}}
</tr>
Expand Down