What is the best way to change button color in a product based on the stock status?
I have successfully done it with javascript by "reading" the innerHTML and if it is i.e out-of-stock, i make the button background green, else blue...
But if there are 5 statuses and 3 translations this results in a big and "ugly" if clause.
My problem is that the store is multilanguage and i am wondering how could i do it without reading innerHTML with js but only read the status value (from model or controller...)?
The previous "dummy" solution is this:
$(document).ready(function() {
var stck = $('#stocktxt').html();
if(stck.indexOf("5-") != -1){
$("#button-cart").css("background-color","#f59525");
}
});