OCUK This Week Only Savings % Script

Associate
Joined
24 Jul 2013
Posts
17
Location
Gloucestershire
Had some spare time on my hands, so made the following script that will show the % savings on the This Week Only page.

If you are running Google Chrome, press F12 and go to Console, paste in the following script and hit Enter:

Code:
$prices = $('td tr:has(span.oldprice)');
$prices.each( function() {
    $priceCell = $(this).find('td:has(span.oldprice)');
    var oldPrice = parseFloat($priceCell.find('span.oldprice').text().replace(/£/, ''));
    var newPrice = parseFloat($priceCell.find('span.price').text().replace(/£/, ''));
    var percentSaving = Math.round(100 - (100 / oldPrice * newPrice));
    $priceCell.append($(document.createElement('div')).css('font-size', '16pt').css('color', 'red').text(percentSaving + '%'));
});

You will now see under the price of each item, the percentage saved compared to the original price.

Enjoy!
 
Back
Top Bottom