Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #1350783

    Hi there

    I have a shop build but am experiencing issues with prev/next when scrolling through the shop. I have various category pages and when an item is selected for purchase/viewing the next/previous scroll through brings up items outside of the category of the item selected. I saw on a previous post that items are set in date form, but can this be set as category instead?

    I hope you can help as my client is not happy about this issue.

    Thanks, Silvio

    #1350985

    Hey Silvio,

    Thank you for the inquiry.

    You can try this code in the functions.php file to limit the post or product navigation to the same category, but it might not work as expected if the products belong to multiple categories. It works best if the products have a single category.

    function avf_post_nav_settings_mod($settings)
    {
    	if($settings['type'] == 'product')
    	{
    		$settings['taxonomy'] = "product_cat";
    		$settings['same_category'] = true;
    	}
    
        return $settings;
    }
    add_filter( 'avf_post_nav_settings', 'avf_post_nav_settings_mod', 10, 2); 
    

    Best regards,
    Ismael

    #1351640

    Hi this has no affect at all…

    #1351895

    Hi,

    Thank you for the update.

    Did you replace the navigation, or use a different plugin? Looks like you are now using a custom navigation in the product pages with this markup.

    
    <div class="tpnpb_prev_next_buttons tpnpb_prev_next_buttons_top tpnpb_prev_next_buttons_desktop tpnpb_prev_next_buttons_display"><a href="https://site.plesk.page/product/rare-silver-mounted-thai-or-burmese-lance/" rel="next">← Previous</a><a href="https://elated-tereshkova.149-255-60-157.plesk.page/product/rare-sulawesi-shield/" rel="prev">Next →</a></div>
    

    The filter above should work on the default post navigation with limitations that we mentioned previously.

    Best regards,
    Ismael

    #1351924

    Don’t know if this is totaly different to ismaels snippet – but can you try:

    function enfold_customization_postnav($settings){
      if('product' == $settings['type'] )  { 
        $settings['same_category'] = true;
        $settings['is_fullwidth'] = false;
        $settings['skip_output'] = false;
      }
      return $settings;
    }
    add_filter('avf_post_nav_settings','enfold_customization_postnav', 10, 1);

    And think of caching and merging etc. to refresh.

    #1351927

    Thanks Guenni007 – this has made a slight difference, but wrong categories still appear..

    #1352033

    I think the problem is not that Ismael’s snippet does not work. I have tested Ismael’s snippet – and it works here on my test installation.
    But the problem occurs when you have multiple “product categories” for a product.
    See e.g. the shop demo there are “men” and “women” products – but they both have : “casual” as another category.
    ( here again ismaels snippet)

    function avf_post_nav_settings_mod($settings){
      if($settings['type'] == 'product'){
        $settings['taxonomy'] = "product_cat";
        $settings['same_category'] = true;
      }
      return $settings;
    }
    add_filter( 'avf_post_nav_settings', 'avf_post_nav_settings_mod', 10, 2); 

    If now a men’s product is called, which is also sorted with casual, then it can be that also women’s products are displayed.
    I removed all product categories from men products. By that you only have men product post navigation.

    #1352075

    Hi,

    I have now removed any products with 2 categories and I still have total chaos whilst using prev/next in the shop, I even get out of stock items even though out of stock is selected in the product grid, it’s a mess…in some cases it only shows 3 or 4 items out of many 10’s whilst using the prev/next…

    Silvio

    #1352251

    Hi,

    For out of stock products, you may need to adjust the Out of stock visibility option and tick the Hide out of stock items from the catalog checkbox in the Woocommerce > Settings > Products > Inventory panel.

    // https://rudrastyh.com/woocommerce/hide-out-of-stock-products.html

    Best regards,
    Ismael

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