private function getSalePercentage($product) 
    {
        $specialPrice = $product->getSpecialPrice();
        $originalPrice = $product->getPrice();
        $specialfromdate = $product->getSpecialFromDate();
        $specialtodate = $product->getSpecialToDate();
        $today = time();
        $salePercent = 0;
        $productLabel = '';

        if (!$specialPrice)
            $specialPrice = $originalPrice;
        if ($specialPrice < $originalPrice) {
            if((is_null($specialfromdate) && is_null($specialtodate)) 
                || ($today >= strtotime($specialfromdate) && is_null($specialtodate)) 
                || ($today <= strtotime($specialtodate) && is_null($specialfromdate)) 
                || ($today >= strtotime($specialfromdate) && $today <= strtotime($specialtodate)))
            {
                $salePercent = 100-round(($specialPrice/$originalPrice)*100);
            }
        }

        return $salePercent;
    }