Home Forums WoodMart support forum Quick view HTML BLOCK issue

Quick view HTML BLOCK issue

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #85884

    xjabla
    Participant

    Hi,

    I have add a custom code to the single product page, in general just a html block as mentioned below:

    add_action(‘woocommerce_single_product_summary’, ‘justwood_enhance’, 18);
    function justwood_enhance(){
    if (get_field(‘product-from’)==’eu’){
    echo do_shortcode(‘[html_block id="13939"]‘);
    }
    }

    It is working nicely for single product but when I click on quickview button, there is a visual composer code still visible, it seems that shortcode is not performed sucesfully.

    Can you check it please and help us to solve this issue somehow?

    Thanks a lot

    With regards

    Petr

    Attachments:
    You must be logged in to view attached files.
    #85902

    Artem Temos
    Keymaster

    Hi,

    Try to replace this line

    echo do_shortcode(‘[html_block id="13939"]‘);

    with this code

    echo woodmart_get_html_block(13939);

    Regards

    #85919

    xjabla
    Participant

    Thank for your help. I have tried to use your syntax and unfortunately it is the same. Working nicely in normal single page but issue is still there when QuickView is used.

    Thanks for your understanding

    #85923

    Artem Temos
    Keymaster

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

    function woodmart_html_block_shortcode($atts) {
    
    	if( class_exists('WPBMap') )
    		WPBMap::addAllMappedShortcodes();
    	
    	extract(shortcode_atts(array(
    		'id' => 0
    	), $atts));
    
    	return woodmart_get_html_block($id);
    }
    add_shortcode( 'html_block', 'woodmart_html_block_shortcode' );
    #85927

    xjabla
    Participant

    Thanks for your snippet.

    Did it work in your end? Because in our end the issue is still persisting.. 🙁

    Thanks

    #85929

    Artem Temos
    Keymaster

    Please, send us your FTP access so we can check what is wrong.

    #85932

    xjabla
    Participant

    Here are the FTP credentials

    #85935

    Artem Temos
    Keymaster

    Add the following code as well

    
    function woodmart_quick_view($id = false) {
    
      if( class_exists('WPBMap') )
        WPBMap::addAllMappedShortcodes();
      if( isset($_GET['id']) ) {
        $id = (int) $_GET['id'];
      }
      if( ! $id || ! woodmart_woocommerce_installed() ) {
        return;
      }
    
      global $post, $product;
    
      $args = array( 'post__in' => array($id), 'post_type' => 'product' );
    
      $quick_posts = get_posts( $args );
    
      $quick_view_variable = woodmart_get_opt( 'quick_view_variable' );
      $quick_view_layout = ( woodmart_get_opt( 'quick_view_layout' ) ) ? woodmart_get_opt( 'quick_view_layout' ) : 'horizontal';
    
      foreach( $quick_posts as $post ) :
        setup_postdata($post);
        $product = wc_get_product($post);
            remove_action( 'woocommerce_single_product_summary', 'woodmart_before_compare_button', 33 );
        remove_action( 'woocommerce_single_product_summary', 'woodmart_after_compare_button', 37 );
        
        //Remove before and after add to cart button text
        remove_action( 'woocommerce_single_product_summary', 'woodmart_before_add_to_cart_area', 25 );
        remove_action( 'woocommerce_single_product_summary', 'woodmart_after_add_to_cart_area', 31 );
        
            remove_action( 'woocommerce_before_single_product', 'wc_print_notices', 10 );
    
            // Add brand image
            add_action( 'woocommerce_single_product_summary', 'woodmart_product_brand', 8 );
    
            // Disable add to cart button for catalog mode
        if( woodmart_get_opt( 'catalog_mode' ) ) {
          remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
        } elseif( ! $quick_view_variable ) {
          // If no needs to show variations
          remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
          add_action( 'woocommerce_single_product_summary', 'woocommerce_template_loop_add_to_cart', 30 );
        }
    
        if( woodmart_get_opt( 'product_share' ) ) add_action( 'woocommerce_single_product_summary', 'woodmart_product_share_buttons', 45 );
        get_template_part('woocommerce/content', 'quick-view-' . $quick_view_layout );
      endforeach; 
    
      wp_reset_postdata(); 
    
      die();
    }
    
    add_action( 'wp_ajax_woodmart_quick_view', 'woodmart_quick_view' );
    add_action( 'wp_ajax_nopriv_woodmart_quick_view', 'woodmart_quick_view' );
    #85940

    xjabla
    Participant

    Thank you very much, this solution is working now.

    Have a nice day!

    #85943

    xjabla
    Participant

    Sorry I have forgotten to ask how to remove SOLD BY xxx (comes from YITH MULTIVENDOR PLUGIN) from woodmart quick view? because in the single shop page there it is deactivated but if I check the product via QuickView the SOLD BY info is there:

    https://snag.gy/N9e25o.jpg

    Thanks

    #85951

    Artem Temos
    Keymaster

    Try to add the following code snippet to the Custom CSS area in Theme Settings

    .popup-quick-view .by-vendor-name {
        display: none;
    }
    #85975

    xjabla
    Participant

    Thank for help, I totally forget to use CSS which is pretty easy 😀 Now you can close this topic.

    Thanks

    #85982

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

    Best Regards

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

The topic ‘Quick view HTML BLOCK issue’ is closed to new replies.