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

STENCIL-3383 Do not show add to cart on disabled products. #1063

Merged
merged 3 commits into from
Aug 14, 2017
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 @@ -7,6 +7,7 @@
- Change the 403 page message to be more friendly [#1057](https://github.com/bigcommerce/cornerstone/pull/1057) & [#1059](https://github.com/bigcommerce/cornerstone/pull/1059)
- Add bulk discount rates to product cards [#1058](https://github.com/bigcommerce/cornerstone/pull/1058)
- Add higher z-index to display text over burst image [#1066](https://github.com/bigcommerce/cornerstone/pull/1066)
- Do not show add to cart on disabled products, add pre-order button, update pre-order url to add product to cart & fix login for pricing on product cards. [#1063](https://github.com/bigcommerce/cornerstone/pull/1063)

## 1.9.1 (2017-07-25)
- Move some hard-coded validation messages to language file [#1040](https://github.com/bigcommerce/cornerstone/pull/1040)
Expand Down
1 change: 1 addition & 0 deletions assets/scss/layouts/products/_productList.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

.productList {
@include u-listBullets("none");
margin: spacing("half");

.product {
// scss-lint:disable NestingDepth
Expand Down
2 changes: 1 addition & 1 deletion templates/components/products/card.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<a href="{{url}}" class="button button--small card-figcaption-button" data-product-id="{{id}}">{{lang 'products.choose_options'}}</a>
{{/if}}
{{#if pre_order}}
<a href="{{url}}" class="button button--small card-figcaption-button">{{lang 'products.pre_order'}}</a>
<a href="{{pre_order_add_to_cart_url}}" class="button button--small card-figcaption-button">{{lang 'products.pre_order'}}</a>
Copy link
Contributor

Choose a reason for hiding this comment

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

is this a new field?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes it will be a new fields which will only be passed for pre-order. On product details page it is a form so it is not required on those pages. But on pages where it is a card it is necessary bcoz earlier it was taking users to product detail pages. It is a similar url construct to add to cart.

{{/if}}
{{#if add_to_cart_url }}
<a href="{{add_to_cart_url}}" class="button button--small card-figcaption-button">{{lang 'products.add_to_cart'}}</a>
Expand Down
29 changes: 18 additions & 11 deletions templates/components/products/list-item.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,27 @@ <h4 class="listItem-title">
{{/if}}
</div>
<div class="listItem-actions">
{{#if price}}
<div class="listItem-price">{{> components/products/price price=price}}</div>
{{/if}}
{{#unless hide_add_to_cart}}
{{#if has_options}}
<a href="{{url}}" class="button button--primary" data-product-id="{{id}}">{{lang "products.choose_options"}}</a>
{{else}}
{{#or customer (if theme_settings.restrict_to_login '!==' true)}}
{{#if price}}
<div class="listItem-price">{{> components/products/price price=price}}</div>
{{/if}}
{{#if show_cart_action}}
{{#if has_options}}
<a href="{{url}}" 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}}" class="button button--primary">{{lang 'products.pre_order'}}</a>
{{/if}}
{{#if add_to_cart_url }}
<a href="{{add_to_cart_url}}" class="button button--primary">{{lang 'products.add_to_cart'}}</a>
{{/if}}
{{#if out_of_stock_message }}
<span href="{{url}}" class="button button--primary">{{out_of_stock_message}}</span>
{{else}}
<a href="{{add_to_cart_url}}" class="button button--primary">{{lang "products.add_to_cart"}}</a>
<a href="{{url}}" class="button button--small" data-product-id="{{id}}">{{out_of_stock_message}}</a>
{{/if}}
{{/if}}
{{/unless}}
{{else}}
{{> components/common/login-for-pricing}}
{{/or}}
{{#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
2 changes: 1 addition & 1 deletion templates/components/products/list.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<ul class="productList">
{{#each products}}
<li class="product">
{{>components/products/list-item show_compare=../show_compare show_rating=../settings.show_product_rating theme_settings=../theme_settings}}
{{>components/products/list-item show_compare=../show_compare show_rating=../settings.show_product_rating theme_settings=../theme_settings customer=../customer}}
</li>
{{/each}}
</ul>