Viewing 19 posts - 1 through 19 (of 19 total)
  • Author
    Posts
  • #1347489

    Hi
    On my website here: https://diyjewellery.com/ I created pages to display my product filters (plugin Product Filter for WooCommerce by XforWooCommerce)
    Here’s a filtering page example: https://diyjewellery.com/ring-settings/

    Here’s my shortcode that I use to display the products results on that page:
    [products category ="settings-rings" limit="12" columns="4" paginate="true" prdctfltr="yes" ajax="yes" preset="ring-settings"]

    You can see that the pagination option does not show at the bottom of the page.

    I’ve been working for months with the filter plugin developer and we can ‘t this work. I found this similar issue submitted within this ticket: https://kriesi.at/support/topic/pagination-not-working-with-woocommerce-shortcodes/ and I tried the `add_action(‘after_setup_theme’, function() {
    add_action( ‘woocommerce_after_shop_loop’, ‘woocommerce_pagination’, 10 ); // add pagination back
    });` suggested but it did not help at all. I actually removed the WC default filtering options at the top of the page.

    Any insight on how to fix my issue would be greatly appreciated.

    Thanks
    Lyse

    #1347663

    Hey tremblayly,

    Thank you for the inquiry.

    Is it working correctly when you remove this code from the themes/enfold/config-woocommerce/config.php file?

    line 367:

    remove_action( 'woocommerce_pagination', 'woocommerce_catalog_ordering', 20 );
    remove_action( 'woocommerce_pagination', 'woocommerce_pagination', 10 );
    

    line 388:

    remove_action( 'woocommerce_after_shop_loop', 'woocommerce_pagination', 10 ); //remove woo pagination
    

    This should re-enable the default Woocommerce pagination in the product shortcode.

    Best regards,
    Ismael

    #1347723

    Hi Ismael,

    Can I add these actions as a code snippet or it must be done in the file itself. If in the file, then do I copy the file into my Child theme so it does not get overwritten during an update?
    Thanks
    Lyse

    #1347725

    Hi again Ismael,

    I assumed it would not work as a code snippet so tried to edit the file. So I tried the following:

    I copied the “themes/enfold/config-woocommerce/config.php” file into my Enfold Child theme keeping the same path. This did not fix the issue.
    I copied the updated config.php file into the ENFOLD theme and this also did not fix the issue.

    Thanks
    Lyse

    #1347880

    Hi,

    Thank you for the update.

    We may need to access the server in order to debug the issue further. Please post the the WP and FTP details in the private field.

    Best regards,
    Ismael3

    #1347898

    Hi Ismael

    #1347901

    Hi,

    We will also need FTP access because we have to edit the files. Please include the FTP details in the private field.

    Best regards,
    Ismael

    #1347902

    See below

    #1348476

    Hi,

    We were not able to access the file server but we managed to edit the file via the Appearance > Theme File Editor panel. We disabled this code in the themes/enfold/config-woocommerce/config.php file around line 388.

    // remove_action( 'woocommerce_after_shop_loop', 'woocommerce_pagination', 10 ); //remove woo pagination
    

    The default Woocommerce pagination is now displaying but it will require a few css adjustments.

    Best regards,
    Ismael

    #1348514

    Hi Ismael
    The pagination on the product category pages is already working, so the editing you’ve done messes that up and is not required there. The issue is when I use the shortcode on a “page” where I use filters, like this one: https://diyjewellery.com/ring-settings/
    Thanks
    Lyse

    #1348663

    Hi,

    In your initial post, you said that the pagination is not visible, so we suggested to edit the config.php file to bring the pagination back. Now, the pagination is visible in the page that you posted above, but it requires a bit of css adjustments as we mentioned previously. Please check the screenshot below.

    Screenshot: https://imgur.com/aNRfQ9g

    Best regards,
    Ismael

    #1348940

    Hi Ismael,

    I was sprecific in saying that I could not get WooCommerce pagination to work on pages I created. (It already works on the WC category pages).
    Example pages:

    etc.
    These are pages I created in order to add the product filters shown here: https://snipboard.io/a8tGDq.jpg

    So sorry for the confusion.
    Thanks
    Lyse

    #1349332

    Hi,

    You may need to revert the previous modifications in the config.php file and add something like this in the child theme’s functions.php file.

    add_action( 'after_setup_theme', function() {
        if( ! is_product_category() && is_page( array(1, 2, 3) ) ) {
            //add woo pagination back on custom pages
            add_action( 'woocommerce_after_shop_loop', 'woocommerce_pagination', 10 ); 
        }
    }, 10);
    

    This should enable the pagination back on custom pages. Make sure to update the page IDs in the is_page conditional function.

    Best regards,
    Ismael

    #1349426

    Hi Ismael,
    I removed the commented lines (367-369) in the WC config.php file. I’ve cleared all caches at the server level as well as cache pages (WP Rocket) and I still see the wrong pagination. Here’s what’s the config.php:
    //remove woo defaults
    remove_action( ‘woocommerce_sidebar’, ‘woocommerce_get_sidebar’, 10);
    remove_action( ‘woocommerce_before_main_content’, ‘woocommerce_output_content_wrapper’, 10);
    remove_action( ‘woocommerce_after_main_content’, ‘woocommerce_output_content_wrapper_end’, 10);
    remove_action( ‘woocommerce_after_shop_loop_item’, ‘woocommerce_template_loop_add_to_cart’, 10);
    remove_action( ‘woocommerce_before_main_content’, ‘woocommerce_breadcrumb’, 20, 0);
    remove_action( ‘woocommerce_pagination’, ‘woocommerce_pagination’, 10 );
    remove_action( ‘woocommerce_before_single_product’, array($woocommerce, ‘show_messages’), 10);

    Here’s what I have added to the Code Snippets plugin that includes all IDs of of the custom pages and it does not work:
    add_action( ‘after_setup_theme’, function() {
    if( ! is_product_category() && is_page( array(18795, 18804, 18807, 18801, 18798, 18791, 18793, 18788) ) ) {
    //add woo pagination back on custom pages
    add_action( ‘woocommerce_after_shop_loop’, ‘woocommerce_pagination’, 10 );
    }
    }, 10);

    Thanks
    Lyse

    #1349528

    Hi,

    Thank you for your patience.

    You should not remove the commented lines in the config.php file because it will re-enable the default Woocommerce pagination. Please get a fresh copy of the config.php file and override the current one. You can then add this css code to correct the style of the default pagination.

    nav.woocommerce-pagination ul li {
        display: inline;
    }
    

    Best regards,
    Ismael

    #1349705

    Hi Ismael,

    I have replace the the config.php file with the latest Enfold one leaving the comment lines:
    remove_action( ‘woocommerce_pagination’, ‘woocommerce_catalog_ordering’, 20 );
    // remove frollowing code to re-enable the default WC pagination in the product shortcode
    // remove_action( ‘woocommerce_pagination’, ‘woocommerce_pagination’, 10 );
    // remove_action( ‘woocommerce_before_single_product’, array($woocommerce, ‘show_messages’), 10);

    I have added the CSS in the Enfold General Settngs as follows so the page numbering looks like the WooCommerce styling:
    nav.woocommerce-pagination ul li {
    float: left;
    height: 35px;
    width: 35px;
    line-height: 35px;
    text-align: center;
    padding: 0px;
    border-radius: 100px;
    margin-right: -5px;
    box-shadow: 0px 0px 1px 0px rgba(0,0,0,0.2);
    font-weight: bold;
    background: #f8f8f8;
    display: inline;
    }

    1) On the product category pages, ie. https://diyjewellery.com/settings/settings-rings/ I get two paginations.
    2) On the custom pages, ie. https://diyjewellery.com/ring-settings/ I get on the added pagination but it does not work. If I go to page 2, it stays on page 1. Why do I get “…” after page 4? Pagination obviously does not work.

    Thank you for your patience while trying to make this work.

    #1349817

    Hi,

    We reverted the config.php file to its default state and adjusted the code in the functions.php file. The pagination is now displaying correctly in the custom pages and it is no longer duplicated in the category pages but the pagination only works when we removed the prdctfltr parameter from the products shortcode.

    This is the updated code in the functions.php file.

    add_action( 'wp', function() {
        if( ! is_product_category() ) {
            //add woo pagination back on custom pages
            if( is_page( array(18795, 18804, 18807, 18801, 18798, 18791, 18793, 18788, 21824) ) ) {
                add_action( 'woocommerce_after_shop_loop', 'woocommerce_pagination', 10 ); 
            }
        }
    }, 999);
    

    We created a test page without the prdctfltr parameter and as you will see, the pagination is working correctly when the parameter is removed. (see private field)

    Best regards,
    Ismael

    #1349891

    Hi Ismael,

    Thank you so much for all of your efforts. I’m happy with the results. I will will get back in touch with the product filter plugin developer to have them work on the issue now that I have the pagination working as expected.
    Lyse

    #1350058

    Hi,
    Glad Ismael could help, if you have any further questions please create a new thread and we will gladly try to help you. Thank you for using Enfold.

    Best regards,
    Mike

Viewing 19 posts - 1 through 19 (of 19 total)
  • The topic ‘Filtering products with WC shortcodes’ is closed to new replies.