- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
function addRibbonsDesktop(){
var $original = $('.oct_2016_best_value');
function percentOff(price, msrp){
var amtsaved = msrp - price;
return Math.round(( amtsaved/msrp )*100);
}
var $24product = RSI({lvl:'24',family:'totale'})[0];
var $12product = RSI({lvl:'12',family:'totale'})[0];
var $6product = RSI({lvl:'06',family:'totale'})[0];
$24product.pctoff = percentOff(parseFloat($24product.price, 10), parseFloat($24product.msrp, 10));
$12product.pctoff = percentOff(parseFloat($12product.price, 10), parseFloat($12product.msrp, 10));
$6product.pctoff = percentOff(parseFloat($6product.price, 10), parseFloat($6product.msrp, 10));
var cla = $('.oct_2016_best_value').clone();
cla.empty();
var clb = $('.oct_2016_best_value').clone();
clb.empty();
$original.css({'font-family': 'GothamBook', 'font-size': '12px'});
//debugger;
var $twelve = $original.closest('.js_oct_2016_product').prev('.js_oct_2016_product');
$twelve.prepend(cla);
var $six = $twelve.prev('.js_oct_2016_product');
$six.prepend(clb);
($24product.pctoff > 0) && $original.prepend('<strong style="font-family: GothamBold; display: block; text-transform: uppercase; font-size: 16px;">Save '+ $24product.pctoff +'%</strong>');
($12product.pctoff > 0) && cla.prepend('<strong style="font-family: GothamBold; display: block; text-transform: uppercase; font-size: 16px;">Save '+ $12product.pctoff +'%</strong>');
($6product.pctoff > 0) && clb.prepend('<strong style="font-family: GothamBold; display: block; text-transform: uppercase; font-size: 16px;">Save '+ $6product.pctoff +'%</strong>');
}