Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #860657

    Hello experts,
    while a sorting of products in the shop itself is not a problem, the sorting is not used on single product pages next and previous buttons to jump to the next product.
    Does anybody have an idea how to tell these buttons to also use the given product sorting ??

    Your help is highly appreciated !!
    Thank you very much in advance !!

    Best regards
    Ralf

    #860689

    Hey Ralf,

    Please add following code to Functions.php file in Appearance > Editor

    add_filter('avia_post_nav_settings','avia_same_category_filter', 10, 1);
    function avia_same_category_filter($settings)
    {
    $settings['same_category'] = true;
    return $settings;
    }

    Regards,
    Yigit

    #860884

    Thank you Yigit,
    I tried – unfortunatelly these buttons are now gone completely.
    I have no idea what is wrong here.

    Best regards,
    Ralf

    #862100

    Hi,

    Are your posts on the same category?
    And make sure it is not the last post or not the first post.

    Best regards,
    Basilis

    #862344

    Hi Basils,
    thank you for coming back to me.
    These are not posts but woocommerce products and they are in the same category. So it should work somehow …

    Kind regards.

    #862432

    Hi,
    I found this post: https://kriesi.at/support/topic/nextprev-arrows-for-products/

    where this code is mentioned:

    add_filter('avia_post_nav_settings', 'avia_post_nav_settings_mod');
    function avia_post_nav_settings_mod($settings)
    {
      if(is_singular('product')) {
        $settings['taxonomy'] = 'product_cat';
      }
    	$settings['same_category'] = true;
    	return $settings;
    }

    This works almost fine, changing the sorting of the products to a much better order.
    Now it should only take my personal sorting instead of “product_cat”.

    Does anybody know which configuration I have to use for that?

    Thanks a lot.

    #863161

    Hi,

    Now it should only take my personal sorting instead of “product_cat”

    I’m sorry but that’s not possible because the navigation is based on the “get_previous_post” and “get_next_post” so it’s quite limited. It can only fetch items based on category and taxonomy.

    // https://codex.wordpress.org/Function_Reference/get_previous_post

    Best regards,
    Ismael

    #863290

    OK,
    thanks Ismael.
    This thread can be closed.

    Thanks again for all your great support and help !!

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.