Inicio › Toolset Professional Support › [Resuelto] Pagination Issue with WooCommerce Views Handling subcategories
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
Etiquetado: Views plugin
This topic contains 18 respuestas, has 3 mensajes.
Last updated by grantD hace 6 años, 6 meses.
Assigned support staff: emerson.
I am revising an issue I'm having with woocommerce views using a conditional view to display subcategories and products.
How we set up the View: https://toolset.com/forums/topic/woocommerce-category-archive-doesnt-work-with-both-products-and-sub-categories/
The issue: https://toolset.com/forums/topic/pagination-issue-with-woocommerce-views-handling-subcategories/
Example URL: hidden link
(See "Showing 1–12 of 29 results" & 3 pages of pagination despite there only being 3 subcategories to display)
HTTPAUTH Details
User: bdsmshop
Pass: Development!
In my last thread I was given the following code snippet to try to try and force the removal of the pagination controls on the affected pages:
add_action( 'wpv-before-display-taxonomy', 'force_pagination_removal', 10, 2 ); function force_pagination_removal( $term, $view_id ) { if ( $view_id == 13825 ) { //execute the removal of woocommerce's pagination } }
This snippet had no effect on the page display.
Hello,
I need to request temporary access (wp-admin and FTP) to your site in order to be offering better help. You will find the needed fields for this below the comment area when you log in to leave your next reply. The information you will enter is private which means only you and I can see and have access to it.
I'll need also the htaccess credentials.
HTTP Auth Details were included clearly in the opening post. Here they are again:
HTTPAUTH Details
User: bdsmshop
Pass: Development!
I've done some tests but I couldn't fix that online. Could you prepare a package with Duplicator and share with me?
Did you make the package from your production server? I'm asking because I can't render that page product-category/fifty-shades-of-grey/.
Images are not needed, indeed.
Package was created directly from the same production server/site you were given access to.
The duplicator plugin is installed and active if you wish to try and create a new package.
Sure, I'll try that. Thanks.
I've tried many things but I couldn't fix that. The thing that I've figured out is that it's using the main query like you can see in the attached image.
Is more involved with WooCommerce like Yuri just said in the other thread but anyway I'll consult our WooCommerce specialist to give some thoughts on this. My apologies the delay on this.
Ok, I think I have good news. We fixed a similar issue in Views 1.11, the pagination was not looking to the right query (taxonomy) one. We would like to know if it will fix your issue. I've sent a development version of Views by email, please apply this in a development environment and let me know how it goes.
Hi Adriano,
I've put the Views 1.11 onto the site and the pagination issue still remains:
See example URL from original post: hidden link
Please try the following below and share credentials again in case this doesn't work:
1. Open the View with ID of 13825
2. Open JS output and add the following below:
jQuery( document ).ready( function( $ ) { $('.woocommerce-result-count').remove(); });
This code will remove unnecessary and inaccurate WooCommerce pagination.
Now in the' Loop output' code, just below '[wpv-items-found]' shortcode, add our our own pagination text:
Showing [wpv-items-count] of [wpv-found-count] product subcategories found.
So if View outputs 3 subcategories. It will display something like "Showing 3 of 3 product subcategories found". Client can revise the text or even add additional CSS styling if he needs to.
Overall result: WooCommerce Views pagination text will be removed and we display our own pagination text.
Access to the site has not changed. Have just tested the original credentials provided and both the HTTPAUTH login and wp-types wordpress user details work fine. Please try again.
As for your proposed solution please see it in effect here:
hidden link
Firstly, it only addresses half of the problem, there are still pagination controls at the bottom of the page for 3 pages despite there only being 3 results on a single page of results.
Secondly, putting the code after [wpv-items-found] means it's rendered after the breadcrumbs (that are rendered from the parent view)
All right, we will continue investigating this. Thank you for your understanding.
Dear Grant,
Thanks for the feedback on the login access. Adriano escalated this ticket to me. I review the remaining issues and the following are the solutions 🙂
Problem #1: "Secondly, putting the code after [wpv-items-found] means it's rendered after the breadcrumbs (that are rendered from the parent view)":
Solution: Customize Product SubCategory View: Copy Yoast breadcrumb shortcode to this View and put it after the correct pagination text. This is the updated loop output code:
[wpv-layout-start] <p>Showing [wpv-items-count] of [wpv-found-count] product subcategories found.</p> <div class="breadcrumbs">[yoast-breadcrumbs]</div> [wpv-items-found] <!-- wpv-loop-start --> <wpv-loop> <li class="item"><a href="[wpv-taxonomy-url]" class="product-link"> <div class="bg product-title">[wpv-taxonomy-title]</div> <div class="img-box cat-img"> <img height="200" class="attachment-shop_catalog wp-post-image" src='[wpv-woo-productcategory-images size="shop_single" output="raw"]'> </div> </a> </li> </wpv-loop> [wpv-pager-current-page style="drop_down"][wpv-pager-num-page] <!-- wpv-loop-end --> [/wpv-items-found] [wpv-no-items-found] <strong>[wpml-string context="wpv-views"]No items found[/wpml-string]</strong> [/wpv-no-items-found] [wpv-layout-end]
Then in the parent View as you have described. Transfer Yoast breadcrumb shortcode below the conditional line so it won't rendered again on the Customize Product SubCategory View.
Products, Product Categories View code:
[wpv-layout-start] [wpv-if evaluate="woo_has_product_subcategory() = 0"] <div class="breadcrumbs">[yoast-breadcrumbs]</div> [wpv-items-found] <!-- wpv-loop-start --> [wpv-add-to-cart-message] <ul class="products"> <wpv-loop> <li class="item"><a href="[wpv-post-url]" class="product-link"> <div class="bg product-title">[wpv-post-title output="sanitize"]</div> <div class="img-box"><img height="200" class="attachment-shop_catalog wp-post-image" src="[wpv-woo-product-image size='shop_catalog' output='raw' gallery_on_listings='no']"></div> </a> [wpv-woo-product-price] <div class="add_to_cart"> [wpv-woo-buy-or-select add_to_cart_text="Buy Now" link_to_product_text="Select Options" show_quantity_in_button="yes" show_variation_options="no"] </div> </li> </wpv-loop> </ul> <!-- wpv-loop-end --> [/wpv-items-found] [wpv-no-items-found] <strong>[wpml-string context="wpv-views"]No posts found[/wpml-string]</strong> [/wpv-no-items-found] [/wpv-if] [wpv-if evaluate="woo_has_product_subcategory() = 1"] [wpv-view name="Customize Product SubCategory"] [/wpv-if] [wpv-layout-end]
Problem #2: "There are still pagination controls at the bottom of the page for 3 pages despite there only being 3 results on a single page of results."
Solution:
In Customize Product SubCategory View -> JS editor, update the JS to remove the remaining paginations:
jQuery( document ).ready( function( $ ) { $('.woocommerce-result-count').remove(); $('.woocommerce-pagination').remove(); $('.woocommerce-ordering').remove(); });
OVERALL RESULT:
->No more unnecessary pagination controls in product subcategory views.
->Correct pagination text from Views is rendered before the breadcrumbs
I have updated your test site with the above solutions. Please review and let me know how it goes 🙂 Thanks.
Cheers,
Emerson