[fixes] place cart button via js
diff --git a/erpnext/accounts/doctype/payment_request/payment_request.json b/erpnext/accounts/doctype/payment_request/payment_request.json
index 64d38b3..360ff90 100644
--- a/erpnext/accounts/doctype/payment_request/payment_request.json
+++ b/erpnext/accounts/doctype/payment_request/payment_request.json
@@ -555,7 +555,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
- "modified": "2016-01-06 03:53:19.686537",
+ "modified": "2016-01-08 05:25:06.056398",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Payment Request",
diff --git a/erpnext/accounts/doctype/payment_request/payment_request.py b/erpnext/accounts/doctype/payment_request/payment_request.py
index e45525c..4df64b2 100644
--- a/erpnext/accounts/doctype/payment_request/payment_request.py
+++ b/erpnext/accounts/doctype/payment_request/payment_request.py
@@ -4,13 +4,14 @@
from __future__ import unicode_literals
import frappe
+from frappe import _
from frappe.model.document import Document
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.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
class PaymentRequest(Document):
@@ -113,7 +114,7 @@
def get_message(self):
"""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):
pass
diff --git a/erpnext/public/js/shopping_cart.js b/erpnext/public/js/shopping_cart.js
index baa9c16..b667177 100644
--- a/erpnext/public/js/shopping_cart.js
+++ b/erpnext/public/js/shopping_cart.js
@@ -42,17 +42,28 @@
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 {