get_price() && $product->is_on_sale() ) {
// collect prices from $price html string
$prices = array_map( function( $item ) {
return array( $item, (float) preg_replace( "/[^0-9.]/", "", html_entity_decode( $item, ENT_QUOTES, 'UTF-8' ) ) );
}, explode( ' ', strip_tags( $price ) ) );
$price = isset( $prices[0][0] ) ? 'Original Price: ' . $prices[0][0] . '' : '';
$price .= isset( $prices[1][0] ) ? 'Sale Price: ' . $prices[1][0] . '' : '';
if ( $product->get_regular_price() ) {
// set saved amount with currency symbol placed as defined in options
$price .= 'You saved: ' . sprintf( get_woocommerce_price_format(), get_woocommerce_currency_symbol(), $prices[0][1] - $prices[1][1] ) . '';
}
}
return $price;
}, 10, 2 );
add_action ('check_woocommerce', 'alfw_woocommerce_not_install_notice');
/**
* @param $atts
*/
function alfw_slider_render_func($atts) {
global $wpdb, $lookbook_slider_effects;
if ( !in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
do_action( 'check_woocommerce');
return;
}
$upload_dir_info = wp_upload_dir();
$wp_root_path = get_home_path();
$site_url = get_site_url();
$plugin_folder_name = pathinfo(ALTIMA_LOOKBOOK_PLUGIN_DIR);
wp_enqueue_script('hotspots');
wp_enqueue_script('actual');
wp_enqueue_script('carousel');
wp_enqueue_script('flip');
wp_enqueue_script('scrolV');
wp_enqueue_script('shuffle');
wp_enqueue_script('tile');
wp_enqueue_script('additionalEffect');
wp_enqueue_script('swipe');
//$wpdb->show_errors();
extract($atts);
/**
* Get slider options
*/
$show_desc = get_option("wplb_free_show_desc_in_popup");
$show_addcart = get_option("wplb_free_show_addcart_in_popup");
$path_2_pic = get_option('wplb_free_hspt_icon', $site_url . '/wp-content/plugins/'.$plugin_folder_name['basename'].'/admin/images/hotspot-icon.png');
if (empty($path_2_pic)) {
$path_2_pic = $site_url . '/wp-content/plugins/'.$plugin_folder_name['basename'].'/admin/images/hotspot-icon.png';
}
$hot_point_icon = '';
$only_visible_element = 'AND `status`=1';
if (@$admin)
$only_visible_element = '';
$slider = $wpdb->get_results(
$wpdb->prepare(
"SELECT
slider.*
FROM
`" . $wpdb->prefix . SLIDER_TABLE . "` AS slider
WHERE
`slider`.`id` = %d $only_visible_element",
$slider_id
),
ARRAY_A
);
if (!empty($slider)) {
$slides = $wpdb->get_results(
$wpdb->prepare(
"SELECT
slide.*
FROM
`" . $wpdb->prefix . SLIDES_TABLE . "` AS slide
WHERE
slider_id = %d $only_visible_element
ORDER BY
order_flag",
$slider[0]['id']
),
ARRAY_A
);
}
if (empty($slides)){
echo __('No slides available in this slider!');
}else {
$effects = unserialize($slider[0]['slider_effect']);
$slider_count = count($slides);
//var_dump(json_decode($slides[0]['hotsposts']));
alfw_control_js($slider[0]['id']);
/**
* Work with sliders effect
*/
if (!empty($effects)){
$effects_string = '';
if (in_array('all', $effects)) {
unset($lookbook_slider_effects['all']);
unset($lookbook_slider_effects['none']);
$fx_names = array_keys($lookbook_slider_effects);
$fx_count = count($fx_names);
$sl_count = $slider_count;
for ($i = 0; $i < $sl_count; $i++) {
$slides[$i]['fx'] = 'data-cycle-fx="'.$fx_names[rand(2,$fx_count)].'"';
}
}elseif (in_array('none', $effects)) {
$effects_string = 'data-cycle-fx="none"';
}else {
$fx_count = count($effects)-1;
$sl_count = $slider_count;
for ($i=0; $i<$sl_count; $i++) {
$slides[$i]['fx'] = 'data-cycle-fx="'.$effects[rand(0,$fx_count)].'"';
}
}
}
echo '