Support Forums

Support Forums Forums Search & Filter Pro Woocommerce action works but corrupts filter

This topic is: resolved

Tagged: 

Viewing 10 posts - 1 through 10 (of 10 total)
  • passion4social
    #254439

    Hello again,

    we are developing a website, and we are calling results from woocommerce products. All data from posts can be seen on the results page.

    However, suddenly, the search and filter fields disappeared. We thought at first it was ACF plugin that we installed, and it was not. It took hours to find out the problem. It is the WooCommerce plugin.

    Then we tried to use the default result page. It worked fine!

    So we ended up to cut pieces of the code to understand what was wrong. Finally we found a woocoomerce public action:

    <?php do_action(‘woocommerce_single_product_summary’); ?>

    This is somehow conflicting with the filter, as the content is loaded.

    Would you have any idea how go around it?

    here is the results.php code:

    <?php
    /**
    * Search & Filter Pro
    *
    * Sample Results Template
    *
    * @package Search_Filter
    * @author Ross Morsali
    * @link https://searchandfilter.com
    * @copyright 2018 Search & Filter
    *
    * Note: these templates are not full page templates, rather
    * just an encaspulation of the your results loop which should
    * be inserted in to other pages by using a shortcode – think
    * of it as a template part
    *
    * This template is an absolute base example showing you what
    * you can do, for more customisation see the WordPress docs
    * and using template tags –
    *
    * http://codex.wordpress.org/Template_Tags
    *
    */

    // If this file is called directly, abort.
    if ( ! defined( ‘ABSPATH’ ) ) {
    exit;
    }

    if ( $query->have_posts() )
    {
    ?>

    Found <?php echo $query->found_posts; ?> Results<br />
    Page <?php echo $query->query[‘paged’]; ?> of <?php echo $query->max_num_pages; ?><br />

    <div class=”pagination”>

    <div class=”nav-previous”><?php next_posts_link( ‘Older posts’, $query->max_num_pages ); ?></div>
    <div class=”nav-next”><?php previous_posts_link( ‘Newer posts’ ); ?></div>
    <?php
    /* example code for using the wp_pagenavi plugin */
    if (function_exists(‘wp_pagenavi’))
    {
    echo “<br />”;
    wp_pagenavi( array( ‘query’ => $query ) );
    }
    ?>
    </div>

    <?php

    while ($query->have_posts())
    {
    $query->the_post();

    ?>

    <?php
    /**
    * This is a reference from WooCommerce to load simple product data
    * Hook: woocommerce_single_product_summary.
    *
    * @hooked woocommerce_template_single_title – 5
    * @hooked woocommerce_template_single_rating – 10
    * @hooked woocommerce_template_single_price – 10
    * @hooked woocommerce_template_single_excerpt – 20
    * @hooked woocommerce_template_single_add_to_cart – 30
    * @hooked woocommerce_template_single_meta – 40
    * @hooked woocommerce_template_single_sharing – 50
    * @hooked WC_Structured_Data::generate_product_data() – 60

    do_action( ‘woocommerce_single_product_summary’ );
    remove_action( ‘woocommerce_single_product_summary’, ‘woocommerce_template_single_title’, 5 );
    remove_action( ‘woocommerce_single_product_summary’, ‘woocommerce_template_single_rating’, 10 );
    remove_action( ‘woocommerce_single_product_summary’, ‘woocommerce_template_single_price’, 10 );
    remove_action( ‘woocommerce_single_product_summary’, ‘woocommerce_template_single_excerpt’, 20 );
    remove_action( ‘woocommerce_single_product_summary’, ‘woocommerce_template_single_meta’, 40 );
    remove_action( ‘woocommerce_single_product_summary’, ‘woocommerce_template_single_sharing’, 50 );

    */
    ?>

    <div class=”course”>
    <div class=”course-main”>
    <div class=”course-image”><?php the_post_thumbnail(“small”); ?></div>
    <?php $price = get_post_meta(get_the_ID(), ‘_price’, true); ?>
    <div class=”course-price”><?php echo ‘<p class=”price”>£’ . number_format($price, 0, ‘.’, ‘.’) ; ?></div>
    <div class=”course-title”><?php the_title(); ?></div>
    <div class=”course-plus”>
    <div class=”purchase-button-bg”></div>
    <div class=”more-info-button-bg”></div>
    </div>

    </div>

    </div>
    <div class=”course-buttons”>
    <div class=”course-purchase”>
    <div class=”topics”>
    <span type=”button” onclick=”PurchaseFront()”>Purchase</span>
    <div class=”course-add content-inner”><div class=”course-summary”><?php do_action(‘woocommerce_single_product_summary’); ?></div></div>
    </div>
    </div>
    <div class=”course-more-info”>
    <div class=”topics”>
    <span type=”button” onclick=”MoreInfoFront()”>More Info +</span>
    <div class=”course-full-content content-inner”>
    <div class=”tab”>
    <input type=”button” value=”Description” title=”course-description-tab” onclick=”openService(event, ‘course-description-<?php echo get_the_ID();?>’)” class=”tab-layout tablinks” />
    <input type=”button” value=”Audience” title=”course-audience-tab” onclick=”openService(event, ‘course-audience-<?php echo get_the_ID();?>’)” class=”tab-layout tablinks” />
    <input type=”button” value=”Outcomes” title=”course-outcomes-tab” onclick=”openService(event, ‘course-outcomes-<?php echo get_the_ID();?>’)” class=”tab-layout tablinks” />
    <input type=”button” value=”Prerequisites” title=”course-prerequisites-tab” onclick=”openService(event, ‘course-prerequisites-<?php echo get_the_ID();?>’)” class=”tab-layout tablinks” />
    <input type=”button” value=”Licences” title=”course-licences-tab” onclick=”openService(event, ‘course-licences-<?php echo get_the_ID();?>’)” class=”tab-layout tablinks” />
    <input type=”button” value=”Certification” title=”course-certification-tab” onclick=”openService(event, ‘course-certification-<?php echo get_the_ID();?>’)” class=”tab-layout tablinks” />
    </div>
    <div id=”course-description-<?php echo get_the_ID()?>” class=”tabcontent” style=”display: block;”><?php echo the_content(get_the_ID(), ”, true); ?></div>
    <div id=”course-audience-<?php echo get_the_ID()?>” class=”tabcontent” style=”display: block;”><?php echo get_post_meta(get_the_ID(), ‘audience-shop’, true); ?></div>
    <div id=”course-outcomes-<?php echo get_the_ID()?>” class=”tabcontent” style=”display: block;”><?php echo get_post_meta(get_the_ID(), ‘outcomes-shop’, true); ?></div>
    <div id=”course-prerequisites-<?php echo get_the_ID()?>” class=”tabcontent” style=”display: block;”><?php echo get_post_meta(get_the_ID(), ‘prerequisites-shop’, true); ?></div>
    <div id=”course-licences-<?php echo get_the_ID()?>” class=”tabcontent” style=”display: block;”><?php echo get_post_meta(get_the_ID(), ‘licences-shop’, true); ?></div>
    <div id=”course-certification-<?php echo get_the_ID()?>” class=”tabcontent” style=”display: block;”><?php echo get_post_meta(get_the_ID(), ‘certification-shop’, true); ?></div>
    </div>
    </div>
    </div>
    </div>

    <hr />
    <?php
    }
    ?>
    Page <?php echo $query->query[‘paged’]; ?> of <?php echo $query->max_num_pages; ?><br />

    <div class=”pagination”>

    <div class=”nav-previous”><?php next_posts_link( ‘Older posts’, $query->max_num_pages ); ?></div>
    <div class=”nav-next”><?php previous_posts_link( ‘Newer posts’ ); ?></div>
    <?php
    /* example code for using the wp_pagenavi plugin */
    if (function_exists(‘wp_pagenavi’))
    {
    echo “<br />”;
    wp_pagenavi( array( ‘query’ => $query ) );
    }
    ?>
    </div>
    <?php
    }
    else
    {
    echo “No Results Found”;
    }
    ?>

    passion4social
    #254440
    This reply has been marked as private.
    Trevor Moderator
    #254457
    This reply has been marked as private.
    passion4social
    #254596
    This reply has been marked as private.
    Trevor Moderator
    #254606
    This reply has been marked as private.
    passion4social
    #254607
    This reply has been marked as private.
    Trevor Moderator
    #254609
    This reply has been marked as private.
    passion4social
    #254610
    This reply has been marked as private.
    Trevor Moderator
    #254612
    This reply has been marked as private.
    passion4social
    #254766
    This reply has been marked as private.
Viewing 10 posts - 1 through 10 (of 10 total)

The topic ‘Woocommerce action works but corrupts filter’ is closed to new replies.