added logic to both functions
added check for quantity in cart and jQuery message.