Are you asking how to run the above code after the promo price appears? If so, and assuming that code works, it would probably be best to have the above code as a function, ex:
Code:
function check4freeshipping(){
$('#results-table .redprice, #pp-wrap #big-price span').each(function(){
var $this = jQuery(this);
var number=$this.html();
number=number.substring(1);
number=parseFloat(number);
if(number > 50){$this.parents('div.grid3wrapper, div.list3wrapper, #pp-wrap').addClass('over50');}
if(number > 99){$this.parents('div.grid3wrapper, div.list3wrapper, #pp-wrap').addClass('over99');}
if(number < 99){$this.parents('div.grid3wrapper, div.list3wrapper, #pp-wrap').addClass('under99').removeClass('freeshipping');}
});
}
Then, whenever the prices are set, run the check4freeshipping function.
All that remains to be determined is, when are the prices set? If it's - say on load of the page, you could do:
Code:
jQuery(window).load(check4freeshipping);
If it's at some other time and is synchronous, you could just do it right after the price is set, ex:
Code:
//code here that sets the prices
check4freeshipping();
If you want more help, please include a link to the page on your site that contains the problematic code so we can check it out.
Bookmarks