From 3ade883fd95f722435ee659b28ec99a6515e7282 Mon Sep 17 00:00:00 2001 From: Saurabh Date: Fri, 8 Jan 2016 17:20:58 +0530 Subject: [PATCH] [fixes] place cart button via js --- .../payment_request/payment_request.json | 2 +- .../doctype/payment_request/payment_request.py | 9 +++++---- erpnext/public/js/shopping_cart.js | 17 ++++++++++++++--- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/erpnext/accounts/doctype/payment_request/payment_request.json b/erpnext/accounts/doctype/payment_request/payment_request.json index 64d38b3c33..360ff90dda 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 e45525ce60..4df64b257b 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 @@ class PaymentRequest(Document): def get_message(self): """return message with payment gateway link""" - return self.message + """ Click here to pay """%self.payment_url + return cstr(self.message) + """ Click here to pay """%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 baa9c1647b..b667177157 100644 --- a/erpnext/public/js/shopping_cart.js +++ b/erpnext/public/js/shopping_cart.js @@ -42,17 +42,28 @@ $.extend(shopping_cart, { set_cart_count: function() { var cart_count = getCookie("cart_count"); + + if($(".cart-icon").length == 0) { + $('
\ + \ +
Cart\ + \ + \ +
\ +
').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 {