'',
'img_size' => 'full',
'action' => 'hover',
'icon' => 'default',
'woodmart_color_scheme' => 'dark',
'el_class' => '',
'css' => '',
), $atts) );
$classes .= ' hotspot-action-' . $action;
$classes .= ' hotspot-icon-' . $icon;
$classes .= ' color-scheme-' . $woodmart_color_scheme;
$classes .= ( $el_class ) ? ' ' . $el_class : '';
if ( function_exists( 'vc_shortcode_custom_css_class' ) ) {
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
}
wp_enqueue_script( 'imagesloaded' );
woodmart_enqueue_js_script( 'hotspot-element' );
woodmart_enqueue_js_script( 'product-more-description' );
woodmart_enqueue_inline_style( 'image-hotspot' );
ob_start();
?>
$img, 'thumb_size' => $img_size, 'class' => 'wd-image-hotspot-img' ) )['thumbnail'];
}
echo do_shortcode( $content );
?>
'',
'hotspot_type' => 'product',
'hotspot_dropdown_side' => 'left',
'product_id' => '',
'title' => '',
'link_text' => '',
'link' => '',
'img' => '',
'img_size' => 'full',
'el_class' => '',
), $atts) );
$classes .= ' hotspot-type-' . $hotspot_type;
$classes .= ( $el_class ) ? ' ' . $el_class : '';
$content_classes .= ' hotspot-dropdown-' . $hotspot_dropdown_side;
$position = explode( '||', $hotspot );
$left = ( isset( $position[0] ) && $position[0] ) ? $position[0] : '50';
$top = ( isset( $position[1] ) && $position[1] ) ? $position[1] : '50';
if ( $product_id && woodmart_woocommerce_installed() ) $product = wc_get_product( $product_id );
if ( $hotspot_type == 'product' && $product ) {
$rating_count = $product->get_rating_count();
$average = $product->get_average_rating();
$args = array(
'class' => implode( ' ', array_filter( array(
'button',
'product_type_' . $product->get_type(),
$product->is_purchasable() && $product->is_in_stock() ? 'add_to_cart_button' : '',
$product->supports( 'ajax_add_to_cart' ) ? 'ajax_add_to_cart' : '',
) ) ),
'attributes' => wc_implode_html_attributes( array(
'data-product_id' => $product->get_id(),
'rel' => 'nofollow',
) ),
'url' => $product->add_to_cart_url(),
'text' => $product->add_to_cart_text(),
);
$output = '';
$output .= '
';
$output .= '
';
if ( wc_review_ratings_enabled() ) {
$output .= wc_get_rating_html( $average, $rating_count );
}
$output .= '
' . $product->get_price_html() . '
';
$output .= '
' . do_shortcode( $product->get_short_description() ) . '
';
$output .= '
' . esc_html( $args['text'] ) . '';
$output .= '
';
}
if ( $hotspot_type == 'text' && ( $title || $content || $link_text || isset( $image['thumbnail'] ) ) ) {
if ( $link ) $attributes = woodmart_get_link_attributes( $link );
if ( function_exists( 'wpb_getImageBySize' ) ) {
$image = wpb_getImageBySize( array( 'attach_id' => $img, 'thumb_size' => $img_size, 'class' => 'wd-image-hotspot-img' ) );
}
$image_allowed_tags = array( 'img' => array( 'width' => true, 'height' => true, 'src' => true, 'alt' => true, 'data-wood-src' => true, 'data-srcset' => true, 'class' => true ) );
$output = '';
if ( isset( $image['thumbnail'] ) ) $output .= '
' . wp_kses( $image['thumbnail'], $image_allowed_tags ). '
';
if ( $title ) $output .= '
' . esc_html( $title ) . '
';
if ( $content ) $output .= '
' . $content . '
';
if ( $link_text && $link ) $output .= '
' . esc_html( $link_text ) . '';
$output .= '
';
}
if ( ! $output ) return;
echo 'You need to upload an image for the parent element first.
',
);
echo json_encode($response);
die();
}
$response = array(
'status' => 'success',
'html' => '