Skip to content

Commit

Permalink
Added tooltip when product is already added in cart #7727
Browse files Browse the repository at this point in the history
  • Loading branch information
Gautam Panday committed May 14, 2015
1 parent 7cff64c commit 77b3d65
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
6 changes: 6 additions & 0 deletions templates/webshop/base.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -466,8 +466,14 @@
$.each(lines, function(index, line) {
$(".product-" + line.product.id + "-buy-now-btn")
.attr('disabled', 'disabled');
var disable_check=$('.product-buy-now').prop('disabled');
$('.tooltip-bottom').tooltip('disable');
if(disable_check){
$('.tooltip-bottom').tooltip('enable');
}
});
}
function updatedCart(){
$.post("{{ url_for('nereid.website.user_status') }}", function(data){
var template = $("#cart-html-append").html();
Expand Down
17 changes: 9 additions & 8 deletions templates/webshop/product.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,15 @@
{% if product.salable %}
<div class="col-md-12 col-sm-12 col-xs-12 buy-now">
<form action="{{ url_for("nereid.cart.add_to_cart") }}" method="post" id="product-buy-now" class="add-to-cart" autocomplete="off" data-ga-event-label="Add To Cart" data-ga-product-name="{{ product.name }}" data-ga-product-category="{{ product.category and product.category.name or None }}" data-ga-product-price="{{ product.sale_price()|currencyformat(request.nereid_currency.code) }}">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
<input type="hidden" name="quantity" value="1"/>
<input type="hidden" name="size" id="size-id"/>
<input type="hidden" name="product" value="{{ product.id }}"/>
<input type="hidden" name="action" value="add"/>
<button class="btn btn-primary btn-buynow btn-block btn-lg product-buy-now product-{{ product.id }}-buy-now-btn" type="button" {% if not product.can_buy_from_eshop() %}disabled{% endif %}
quantity="1" id="buy-now-btn">Add to Cart</button>

<div class="tooltip-bottom" data-placement="bottom" title="This product is already added to the cart">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
<input type="hidden" name="quantity" value="1"/>
<input type="hidden" name="size" id="size-id"/>
<input type="hidden" name="product" value="{{ product.id }}"/>
<input type="hidden" name="action" value="add"/>
<button class="btn btn-primary btn-buynow btn-block btn-lg product-buy-now product-{{ product.id }}-buy-now-btn" type="button"{% if not product.can_buy_from_eshop() %}disabled{% endif %}
quantity="1" id="buy-now-btn">Add to Cart</button>
</div>
</form>
</div>
{% if product.type == 'goods' %}
Expand Down

0 comments on commit 77b3d65

Please sign in to comment.