Forums Forums Search Search Results for 'woocommerce'

Viewing 10 results - 161 through 170 (of 1,497 total)
  • Author
    Search Results
  • #256497

    Anonymous
    Inactive

    Thank you Trevor in advance for your help ~

    I’m having some trouble setting this up. My goal is to have a filterable archive and filterable search. For example, 1] if user is on category=groceries (archive-product.php), they can filter groceries results and 2] if user searches “coffee” in search box on the homepage they can filter search.php results.

    I use custom loops on my archive-product.php and search.php, both using WP_Query.

    Based on your documentation – custom search results I should:

    1] Attach Search & Filter to a query
    But how to add this to my loops?

    $args = array('post_type' => 'post');
    $args['search_filter_id'] = 123;
    $query = new WP_Query($args);

    2] Enter the results URL where the query/results will be found
    I’m confused about what to enter here in order for archive and search filters to work.

    Here is my relevant search.php code:

    <?php
    $s=get_search_query();
    $args = array(
                    's' =>$s
                );
        // The Query
    $the_query = new WP_Query( $args );
    if ( $the_query->have_posts() ) {
            echo "The search results:";
            while ( $the_query->have_posts() ) {
               $the_query->the_post();
                     ?>
                        <ul>
                            <?php
    the_post_thumbnail( 'thumbnail');
    the_title();
    wp_reset_postdata(); // Remember to reset
    ?>				
    </ul>

    Here is my archive-product.php:

    <?php
    /**
     * The Template for displaying product archives, including the main shop page which is a post type archive
     *
     * This template can be overridden by copying it to yourtheme/woocommerce/archive-product.php.
     *
     * HOWEVER, on occasion WooCommerce will need to update template files and you
     * (the theme developer) will need to copy the new files to your theme to
     * maintain compatibility. We try to do this as little as possible, but it does
     * happen. When this occurs the version of the template file will be bumped and
     * the readme will list any important changes.
     *
     * @see https://docs.woocommerce.com/document/template-structure/
     * @package WooCommerce/Templates
     * @version 3.4.0
     */
    
    defined( 'ABSPATH' ) || exit;
    
    get_header( 'shop' );
    get_sidebar();
    
    /**
     * Hook: woocommerce_before_main_content.
     *
     * @hooked woocommerce_output_content_wrapper - 10 (outputs opening divs for the content)
     * @hooked woocommerce_breadcrumb - 20
     * @hooked WC_Structured_Data::generate_website_data() - 30
     */
    do_action( 'woocommerce_before_main_content' );
    
    ?>
    <header class="woocommerce-products-header">
    	<?php if ( apply_filters( 'woocommerce_show_page_title', true ) ) : ?>
    		<h1 class="woocommerce-products-header__title page-title"><?php woocommerce_page_title(); ?></h1>
    	<?php endif; ?>
    
    	<?php
    	/**
    	 * Hook: woocommerce_archive_description.
    	 *
    	 * @hooked woocommerce_taxonomy_archive_description - 10
    	 * @hooked woocommerce_product_archive_description - 10
    	 */
    	do_action( 'woocommerce_archive_description' );
    	?>
    </header>
    <?php
    
    if ( woocommerce_product_loop() ) {
    
    	/**
    	 * Hook: woocommerce_before_shop_loop.
    	 *
    	 * @hooked woocommerce_output_all_notices - 10
    	 * @hooked woocommerce_result_count - 20
    	 * @hooked woocommerce_catalog_ordering - 30
    	 */
    	do_action( 'woocommerce_before_shop_loop' ); ?>
    
    	<ul class="wpf-search-container products">
    	<li class="product">
    	<?php
    
    // Get The queried object ( a WP_Term or a WP_Post Object)
    $term = get_queried_object();
    
    // To be sure that is a WP_Term Object to avoid errors
    if( is_a($term, 'WP_Term') ) :
    
    // Setup your custom query
    
    $loop = new WP_Query( array(
        'post_type'      => 'product',
    	['search_filter_id'] => 123;
        'posts_per_page' => -1,
        'post_status'    => 'publish',
        'tax_query'      => array( array(
            'taxonomy' => 'product_cat', // The taxonomy name
            'field'    => 'term_id', // Type of field ('term_id', 'slug', 'name' or 'term_taxonomy_id')
            'terms'    => $term->term_id, // can be an integer, a string or an array
        ) ),
    ) );
    
    if ( $loop->have_posts() ) :
    while ( $loop->have_posts() ) : $loop->the_post();
    the_post_thumbnail( 'thumbnail');
    the_title();
    endwhile;
    wp_reset_postdata(); // Remember to reset
    endif; endif;
    ?>
    		</li>
    </ul>
    <?php
    
    	/**
    	 * Hook: woocommerce_after_shop_loop.
    	 *
    	 * @hooked woocommerce_pagination - 10
    	 */
    	do_action( 'woocommerce_after_shop_loop' );
    } else {
    	/**
    	 * Hook: woocommerce_no_products_found.
    	 *
    	 * @hooked wc_no_products_found - 10
    	 */
    	do_action( 'woocommerce_no_products_found' );
    }
    
    /**
     * Hook: woocommerce_after_main_content.
     *
     * @hooked woocommerce_output_content_wrapper_end - 10 (outputs closing divs for the content)
     */
    do_action( 'woocommerce_after_main_content' );
    
    /**
     * Hook: woocommerce_sidebar.
     *
     * @hooked woocommerce_get_sidebar - 10
     */
    do_action( 'woocommerce_sidebar' );
    ?>
    
    <?php get_footer(); ?>

    Anonymous
    Inactive

    Bonjour
    J’ai crée un formulaire qui utilise des champs ACF pour filtrer les produits sur mon site https://devsitemotoshop.losmosevents.com. Je n’obtiens aucun résultat de recherche. J’ai choisi l’option “Divi Shop Module”. L’ensemble des produits n’apparait même pas dans le divi shop module meme sans lancer le formulaire.

    Environnement : Woocommerce, Divi, ACF

    URL de la page du formulaire et des résultats de la recherche:
    https://devsitemotoshop.losmosevents.com/boutique-sf-divi/

    Merci pour votre aide

    Hello
    I have created a form that uses ACF fields to filter the products on my site https://devsitemotoshop.losmosevents.com . I am not getting any search results. I chose the “Divi Shop Module” option. All the products do not even appear in the divi shop module even without launching the form.

    Environment: Woocommerce, Divi, ACF

    Form page and search results page URL:
    https://devsitemotoshop.losmosevents.com/boutique-sf-divi/

    Thanks for your help

    #256390

    Anonymous
    Inactive

    I have installed your search engine and it has canceled the store page.
    When I install the plugin, if I go to categories (menu) it tells me that there are none.

    #256385

    Trevor
    Participant

    You can set the plugin to use any template you want if the Display Results method is set to ‘As an Archive’. By default it is set to use search.php.

    An alternative method (of which WooCommerce is a variant of) is the Post Type Archive method, which uses whatever archive template is appropriate for the single Post Type you are searching (or, in the case of WooCommerce you can search both Products AND Variations), either the Post Archives template or the Taxonomy Archives template.


    Anonymous
    Inactive

    I am having difficulty getting the widget to show and of my woo product tags or categories. The widget appears but does not show any of the options. i am set to ‘WooCommerce Shop’ and have defined the categories/tags I wish to display?

    #255294

    Trevor
    Participant

    For a WooCommerce form, the Ajax Container will almost always need to be .products, and this is so for your site.

    I have looked in to the database and there are two dates that are stored very wrongly. That MIGHT be the issue.

    The alternative might need to be to create a second date field, where you can use the WordPress autosave function to take the date that the plugin stores, and re-format that and save it into this second field in the correct format. This post should give you some ideas on that (this example save only the year, but the idea is the same):

    https://support.searchandfilter.com/forums/topic/datefilter/page/3/#post-238869

    #255242

    In reply to: SKUs not showing


    Trevor
    Participant

    Are you wanting to search for these in the text search box?

    Our plugin does not directly allow you to do text searches of individual Post Meta (custom fields) and Taxonomy (Category, Tags and Taxonomies) data/terms. The Search & Filter Pro Text Search field uses the standard WordPress search, so looks only in the Post Title and Content. To help you control this better, on the form’s Advanced settings tab you will see 2 settings for Relevanssi.

    The documentation for this is here:

    https://www.designsandcode.com/documentation/search-filter-pro/3rd-party/relevanssi/

    You would need to install and activate the free Relevanssi plugin as well.

    Then set Relevanssi up and build its index (make sure it is indexing the desired post types, custom fields AND any taxonomy that you want to search).

    A note about WooCommerce SKUs and Relevanssi:

    If you disable Search & Filter (but with Relevanssi installed and setup), and try to search the WC shop with an SKU, you will see this does not work.

    So this is a problem with Relevanssi + WooCommerce (fortunately S&F is not caught in the middle of this!)

    However, there appears to be a solution to this in the Relevanssi docs:

    https://www.relevanssi.com/knowledge-base/indexing-product-variation-skus-main-product/

    I have previously tried this on my test site and then it all seemed to work OK, after I rebuilt the Relevanssi index.


    Anonymous
    Inactive

    Hi,

    I use post meta field as a price filter for WooCommerce products on its category archive page.

    However, after the second submission, the form redirects the user to the normal shop page instead of product category archive. I tried to switch result loading method to AJAX but it did not solve the problem.

    Please let me know if I have set something wrong?

    #254190

    Trevor
    Participant

    That form should work from any page on the site. Depending on how it is set up, it should go to the desired results page. For WooCommerce, that is often the shop itself, or a Product Category page.

    #254013

    Anonymous
    Inactive

    Hi! We have a few search forms setup and are embedding them in a top nav dropdown (megamenu). Each search form is for a specific WooCommerce product attribute. We have the four forms displayed side by side and when someone clicks the “All …attribute…” link on any of them, nothing happens (in most cases). The only time they do work is if you are viewing a shop page which is already filtered by that same attribute. Any ideas on how to resolve? You can see the issue on this site under the “Shop Hops” dropdown in the top nav. https://www.hophavoc.com

Viewing 10 results - 161 through 170 (of 1,497 total)