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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
<?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, $flatsome_opt, $wc_cpdf;
?>
<?php if($wc_cpdf->get_value(get_the_ID(), '_bubble_new')) { ?> <div class="callout <?php if($product->is_on_sale()) echo 'has-sale'; ?> <?php echo $flatsome_opt['bubble_style']; ?>"> <div class="inner success-bg"> <div class="inner-text "><?php _e('New','flatsome'); ?></div> </div> </div><!-- end callout --> <?php } ?>
<?php if ($product->is_on_sale() && !$flatsome_opt['sale_bubble_percentage'] ) : ?> <div class="callout <?php echo $flatsome_opt['bubble_style']; ?>"> <div class="inner"> <div class="inner-text"><?php echo apply_filters('woocommerce_sale_flash',__( 'Sale!', 'woocommerce' ), $post, $product); ?></div> </div> </div><!-- end callout -->
<?php elseif ($product->is_on_sale() && $flatsome_opt['sale_bubble_percentage'] && $product->product_type == 'variable') : ?> <div class="callout <?php echo $flatsome_opt['bubble_style']; ?>"> <div class="inner"> <div class="inner-text"> <?php $price = ''; $available_variations = $product->get_available_variations(); $maximumper = 0; for ($i = 0; $i < count($available_variations); ++$i) { $variation_id=$available_variations[$i]['variation_id']; $variable_product1= new WC_Product_Variation( $variation_id ); $regular_price = $variable_product1 ->regular_price; $sales_price = $variable_product1 ->sale_price; $percentage= round((( ( $regular_price - $sales_price ) / $regular_price ) * 100),1) ; if ($percentage > $maximumper) { $maximumper = $percentage; } } echo '-'.$price . sprintf( __('%s', 'woocommerce' ), $maximumper . '%' ); ?> </div> </div> </div><!-- end callout -->
<?php elseif($product->is_on_sale() && $flatsome_opt['sale_bubble_percentage'] && $product->product_type == 'simple') : ?> <div class="callout <?php echo $flatsome_opt['bubble_style']; ?>"> <div class="inner"> <div class="inner-text"><?php $price = ''; $percentage = round( ( ( $product->regular_price - $product->sale_price ) / $product->regular_price ) * 100 ); echo '-'.$price . sprintf( __('%s', 'woocommerce' ), $percentage . '%' ); ?></div> </div> </div><!-- end callout --> <?php endif; ?>
|