Home › Forums › Basel support forum › How to change product navigation sorting and add endless loop?
How to change product navigation sorting and add endless loop?
- This topic has 3 replies, 2 voices, and was last updated 7 years ago by
Artem Temos.
-
AuthorPosts
-
February 15, 2018 at 8:55 am #39974
vinirossiParticipantI guess that the current product navigation sorting is by product post id. This is not what I want, instead I would like to have the product navigation sorting same as my sorting in shop view. Or at least that the sorting is by name.
Also I would like to have endless loop, which means that there will be always display 2 arrows.
Could you suppose a way to achieve this?
February 15, 2018 at 9:40 am #39985
Artem TemosKeymasterHi,
By default, the WooCommerce plugin doesn’t have products next/previous arrows functionality at all. To implement this feature we use standard WordPress PHP get_next_post and get_prev_post functions that can obtain adjacent posts from the database. Unfortunately, it takes products from the whole table and depends only on the shop page order. The system can’t know that you previously visited this product’s category page. Yes, it would be much better to show next/prev product from the same category. But how the system might know which one? The product can be from multiple categories. Then, from which category next product should be taken? Or for example, if I use filter by price or by color/size the order for products changes again. And naturally, that when you open some product from that page you must see products from the same color/size or from the same price filter interval. And there are a lot of such cases that make it impossible to make product arrows buttons work as expected.
We spent a lot of time investigating this issue but, unfortunately, there is no solution for this problem. You can check any other theme for WooCommerce and you will see the same issue.
Regards
February 15, 2018 at 1:50 pm #40049
vinirossiParticipantThank you for the detailed answer. Not that I can provide a fully consistent solution but maybe it could be interesting for you:
As I can see from this Stackexchange there are a lot of filter possibilities when working with
get_adjacent_post()
instead ofget_next_post()/get_prev_post()
.But yes the previous sorting to be passed to the single_product-page could be a serious problem. One solution could be saving the “current sorting-style” in a variable which will be pre-fetched to get_adjacent_post().
All in all I agree that it would not be worth the effort.
February 15, 2018 at 2:32 pm #40062
Artem TemosKeymasterYes, we tried all possible solution but it is not possible to make it work best for all cases. And we didn’t see working well products navigation on other WordPress sites as well.
-
AuthorPosts
Tagged: product navigation
- You must be logged in to create new topics. Login / Register