Home Forums WoodMart support forum Hotspot – problem

Hotspot – problem

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #129654

    apodis
    Participant

    Hello. I have a problem with hotspot. Using hotspots with products there is a problem with displaying short description. If short description is a text – everything is ok (products with text description: https://nowa.iwalk.pl/portfolio/kolekcja-iwalk-2018/). But when short description is a table (using table, td, tr, th), everything brakes down (4th product is with table short description: https://nowa.iwalk.pl/portfolio/kolekcja-iwalk-2019/). Please help us. Thank you.

    #129662

    Bogdan Donovan
    Keymaster

    Hi,

    Seems that this issue is caused by unclosed HTML tag in one of your product description. Please check it.

    Regards

    #129778

    apodis
    Participant

    Hello,
    according to Your messages from emails and forum:

    1.„Seems that this issue is caused by unclosed HTML tag in one of your
    product description. Please check it.”

    All HTML tags in product descriptions are closed. Here is table short description, which is not working in hotspot:

    <table>
    <tbody>
    <tr>
    <th>Pojemność</th>
    <td>2.400 mAh</td>
    </tr>
    <tr>
    <th>Wbudowane złącza</th>
    <td>Lightning</td>
    </tr>
    <tr>
    <th>Wbudowane porty</th>
    <td>micro USB</td>
    </tr>
    <tr>
    <th>Dodatkowe funkcje</th>
    <td>Doskonała ochrona dla iPhone 6s/6</td>
    </tr>
    <tr>
    <th>Certyfikaty</th>
    <td>Apple MFi, MIL-STD 810G-516.6, CE, KC, FCC, RoHS</td>
    </tr>
    </tbody>
    </table>

    The issue happens only with short description which is table like this, in every product with table description. Products with text description works fine.

    2. “Please deactivate all the plugins not related to the theme provide the
    site admin access to the private area.”

    There are only few plugins not related to the theme like:
    – WooCommerce
    – Yoast
    – Advanced Custom Fields PRO
    – All-in-One WP Migration
    – Loco Translate
    – W3 Total Cache

    3. “You have provided one and the same URL twice please check and provide
    the product URL and URL with the image hotspot.”
    https://nowa.iwalk.pl/portfolio/kolekcja-iwalk-2018/ – all hotspots with text description are working good
    https://nowa.iwalk.pl/portfolio/kolekcja-iwalk-2019/ – 3 hotspots with text description and 1 with table description. The page is not working. If You will switch on develop mode in Your browser and switch opacity from 0 to 1 in .vc_row[data-vc-full-width].vc_hidden class, You will see what happens.
    https://nowa.iwalk.pl/produkt/obudowa-chameleon-immortal-i6-2400mah-czarny/ – this product is added to hotspot and is not working. We have tried to add different products with short description as a table and every one are not working.

    #129811

    Hello,

    Please provide your site admin access to the private area we shall check

    Best Regards

    #129817

    apodis
    Participant

    I’m sending the necessary informations.

    #129852

    Artem Temos
    Keymaster

    Try to add the following PHP code snippet to the child theme functions.php file

    	function woodmart_hotspot_shortcode( $atts, $content ) {
    		$output = $classes = $content_classes = $product = $image = '';
    		extract( shortcode_atts( array(
    			'hotspot' => '',
    			'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 = '<div class="hotspot-product hotspot-content' . esc_attr( $content_classes ) . '">';
    				$output .= '<div class="hotspot-content-image"><a href="' . esc_url( get_permalink( $product->get_ID() ) ) . '">' . $product->get_image() . '</a></div>';
    				$output .= '<h4 class="hotspot-content-title"><a href="' . esc_url( get_permalink( $product->get_ID() ) ) . '">' . esc_html( $product->get_title() ) . '</a></h4>';
    				$output .= wc_get_rating_html( $average, $rating_count );
    				$output .= '<div class="price">' . $product->get_price_html() . '</div>';
    				$output .= '<div class="hotspot-content-text reset-mb-10">' . do_shortcode( $product->get_short_description() ) . '</div>';
    				$output .= '<a href="' . esc_url( $args['url'] ) . '" class="' . esc_attr( $args['class'] ) . '" ' . $args['attributes'] . '>' . esc_html( $args['text'] ) . '</a>';
    			$output .= '</div>';
    		}
    
    		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' => 'woodmart-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 = '<div class="hotspot-text hotspot-content' . esc_attr( $content_classes ) . '">';
    				if ( isset( $image['thumbnail'] ) ) $output .= '<div class="hotspot-content-image">' . wp_kses( $image['thumbnail'], $image_allowed_tags ). '</div>';
    				if ( $title ) $output .= '<h4 class="hotspot-content-title">' . esc_html( $title ) . '</h4>';
    				if ( $content ) $output .= '<div class="hotspot-content-text reset-mb-10">' . $content . '</div>';
    				if ( $link_text && $link ) $output .= '<a class="btn btn-color-primary btn-size-small" ' . $attributes . '>' . esc_html( $link_text ) . '</a>';
    			$output .= '</div>';
    		}
    
    		if ( ! $output ) return;
    		echo '<div class="woodmart-image-hotspot' . esc_attr( $classes ) . '" style="left: ' . esc_attr( $left ) . '%; top: ' . esc_attr( $top ) . '%;">';
    			echo '<span class="hotspot-sonar"></span>';
    			echo '<div class="hotspot-btn"></div>';
    			echo apply_filters( 'woodmart_hotspot_content', $output );
    		echo '</div>';
    
    	}

    Regards

    #129876

    apodis
    Participant

    Thank you very much! Everything is works fine 🙂

    #129895

    You are welcome! If you have any questions please feel free to contact us.

    Best Regards

Viewing 8 posts - 1 through 8 (of 8 total)

The topic ‘Hotspot – problem’ is closed to new replies.