File: /home/dermova/public_html/india/wp-content/themes/ri-colias/woocommerce/loop/sale-flash.php
<?php
/**
* Product loop sale flash
*
* @author WooThemes
* @package WooCommerce/Templates
* @version 1.6.4
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
global $post, $product;
$labels = '';
if ($product->is_on_sale()) {
$percentage = 0;
if ($product->regular_price)
$percentage = - round( ( ( $product->regular_price - $product->sale_price ) / $product->regular_price ) * 100 );
if ($percentage)
$sales_html = '<div class="onsale">'. $percentage .'%</div>';
else
$sales_html = apply_filters('woocommerce_sale_flash', '<div class="onsale">'.__( 'Sale','woocommerce' ).'</div>', $post, $product);
$labels .= $sales_html;
}
echo '<div class="labels">';
echo $labels;
$availability = $product->get_availability();
if ( $availability['availability'] == esc_html__( 'Out of stock', 'woocommerce' )) {
echo apply_filters( 'woocommerce_stock_html', '<div class="stock ' . esc_attr( $availability['class'] ) . '">' . esc_html( $availability['availability'] ) . '</div>', $availability['availability'] );
} else {
echo '<div data-link="' . get_permalink( wc_get_page_id( 'cart' ) ) . '" class="viewcart viewcart-'.$product->id.'" title="' . esc_html__('View Cart', 'woocommerce') . '"></div>';
}
echo '</div>';