mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-22 06:29:20 +00:00
[fixes] place cart button via js
This commit is contained in:
@@ -42,17 +42,28 @@ $.extend(shopping_cart, {
|
||||
|
||||
set_cart_count: function() {
|
||||
var cart_count = getCookie("cart_count");
|
||||
|
||||
if($(".cart-icon").length == 0) {
|
||||
$('<div class="cart-icon" style="float:right;padding-top:10px;">\
|
||||
<a href="/cart" class="text-muted small">\
|
||||
<div class="btn btn-primary cart"> Cart\
|
||||
<span id="cart-count" class="label" style="padding-left:5px;margin-left:5px;\
|
||||
margin-right:-5px;background-color: #2905E2;">\
|
||||
</span>\
|
||||
</div>\
|
||||
</a></div>').appendTo($('.hidden-xs'))
|
||||
}
|
||||
|
||||
var $cart = $('.cart-icon');
|
||||
var $badge = $cart.find("#cart-count");
|
||||
|
||||
if(parseInt(cart_count) === 0) {
|
||||
if(parseInt(cart_count) === 0 || cart_count === undefined) {
|
||||
$cart.css("display", "none");
|
||||
}
|
||||
else {
|
||||
$cart.css("display", "inline");
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(cart_count) {
|
||||
$badge.html(cart_count);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user