sooroos Posted August 5, 2013 Share Posted August 5, 2013 (edited) Hi guys The minimum purchase total required in my shop is 10€. I would like to have in the cart block the total price automatically colorized in red if total<10€ and in green if total >= 10€, so that the customer can see if the order can be validated in order to do this i have tried to add the following function in ajax-cart.js at about line 676. but since it is written by myself it will never work, because its the 1st time when i am doing this function colorize(){ if ($('.ajax_cart_total') < 10) { $('.ajax_cart_total').style.color = 'red'; } else { $('.ajax_cart_total').style.color = 'green'; } } Edited August 5, 2013 by sooroos (see edit history) Link to comment Share on other sites More sharing options...
NemoPS Posted August 5, 2013 Share Posted August 5, 2013 Hi there! $('.ajax_cart_total') can never be compared to a number as it's a jQuery object. Try using the following instead parseInt($('.ajax_cart_total') .text()) Link to comment Share on other sites More sharing options...
sooroos Posted August 5, 2013 Author Share Posted August 5, 2013 (edited) thx for the tip nemo in the end i did it the solution is: if (parseFloat(jsonData.total) < 10) { $('#cart_block #cart_block_total').css({color: 'red'}); } else { $('#cart_block #cart_block_total').css({color: 'green'}); } Edited August 5, 2013 by sooroos (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts