[fixes] place cart button via js
This commit is contained in:
parent
403ad48364
commit
3ade883fd9
@ -555,7 +555,7 @@
|
|||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 0,
|
"istable": 0,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2016-01-06 03:53:19.686537",
|
"modified": "2016-01-08 05:25:06.056398",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Payment Request",
|
"name": "Payment Request",
|
||||||
|
|||||||
@ -4,13 +4,14 @@
|
|||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import frappe
|
import frappe
|
||||||
|
from frappe import _
|
||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
from frappe.utils import flt, nowdate, get_url, cstr
|
from frappe.utils import flt, nowdate, get_url, cstr
|
||||||
from frappe import _
|
|
||||||
from erpnext.accounts.doctype.journal_entry.journal_entry import (get_payment_entry_against_invoice,
|
|
||||||
get_payment_entry_against_order)
|
|
||||||
from erpnext.accounts.party import get_party_account
|
from erpnext.accounts.party import get_party_account
|
||||||
from erpnext.accounts.utils import get_account_currency, get_balance_on
|
from erpnext.accounts.utils import get_account_currency, get_balance_on
|
||||||
|
from erpnext.accounts.doctype.journal_entry.journal_entry import (get_payment_entry_against_invoice,
|
||||||
|
get_payment_entry_against_order)
|
||||||
|
|
||||||
from itertools import chain
|
from itertools import chain
|
||||||
|
|
||||||
class PaymentRequest(Document):
|
class PaymentRequest(Document):
|
||||||
@ -113,7 +114,7 @@ class PaymentRequest(Document):
|
|||||||
|
|
||||||
def get_message(self):
|
def get_message(self):
|
||||||
"""return message with payment gateway link"""
|
"""return message with payment gateway link"""
|
||||||
return self.message + """ <a href="%s"> Click here to pay </a>"""%self.payment_url
|
return cstr(self.message) + """ <a href="%s"> Click here to pay </a>"""%self.payment_url
|
||||||
|
|
||||||
def set_failed(self):
|
def set_failed(self):
|
||||||
pass
|
pass
|
||||||
|
|||||||
@ -42,17 +42,28 @@ $.extend(shopping_cart, {
|
|||||||
|
|
||||||
set_cart_count: function() {
|
set_cart_count: function() {
|
||||||
var cart_count = getCookie("cart_count");
|
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 $cart = $('.cart-icon');
|
||||||
var $badge = $cart.find("#cart-count");
|
var $badge = $cart.find("#cart-count");
|
||||||
|
|
||||||
if(parseInt(cart_count) === 0) {
|
if(parseInt(cart_count) === 0 || cart_count === undefined) {
|
||||||
$cart.css("display", "none");
|
$cart.css("display", "none");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$cart.css("display", "inline");
|
$cart.css("display", "inline");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(cart_count) {
|
if(cart_count) {
|
||||||
$badge.html(cart_count);
|
$badge.html(cart_count);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user