Viewing 18 posts - 1 through 18 (of 18 total)
  • Author
    Posts
  • #659592

    I’ve seen similar threads on the subject, but they are all older…so I believe this issue has a new cause. That cause being the new version of WooCommerce. I know it has caused several little issues with Enfold. Just wanted to give notice of another little one. For the product grid, no matter what I set the sorting to it will only display the products in a random order. Even if I set it to allow the customer to sort, the sort bar doesn’t show and it sorts them randomly each time you load the page.

    #659818

    Hi Kahil,

    Could you provide us with a link to the site in question so that we can take a closer look please?

    Best regards,
    Rikard

    #659987

    At first I thought it was the custom code you guys gave in another thread to add “random” as a sorting option….so I removed it to make sure and it still happened. No matter what I do, I can only get it to randomly display products. Then I noticed that there were new options for product sorting in woocommerce itself. So I’m guessing it just amounts to a conflict there.

    #661101

    Hi,

    We checked the “Store” page and other category pages but the sorting options are not there. Did you disable it? Please enable it back so that we can inspect the issue.

    Best regards,
    Ismael

    #663099

    Sorry for the late reply…

    I don’t use the Woocommerce store page….it just slaps everything into one page and I prefer to separate them out by type/category, etc.

    On each page I am using the product grid that is part of Enfold. I have in Woocommerce the default sorting to be by name. Regardless of the option I set in the product grid section, the products are displayed in random order. Here is a link to one of the pages and I have set it to display the sorting drop downs. Still…nothing I select puts them in any order but random.

    #664412

    Hi,

    We created a page with the product grid, sorting option enabled, on our installation and the items are sortable. Please post the login details here so that we can check the settings.

    Best regards,
    Ismael

    #664806

    Info included in the private content for you.

    The only definite, common link I have found with this issue was that it only started after the last major WooCommerce update. So I chalked it up to being just an issue related to that and lil incompatibilities with the theme that your dev team is working on.

    I also don’t know if it is related, but there is an official plugin from WooCommerce I have (Measurement Price Calculator) that causes an issue when activated. It won’t let me add to the cart. Gives a common javascript error that isn’t specific about Qty, etc. So perhaps there is some sort of javascript issue somewhere that is the link to all these issues. I haven’t been able to track it down. I just know that it all didn’t happen until WooCommerce was updated. :/

    #665804

    Hi,

    you are using lots of plugins.Please deactivate all plugins but WooCommerce by WooThemes one by one to check which one is causing this issue and let us know if this solves the problem.
    In addition to that, please let us know if we are allowed to deactivate one or more of your plugins as well for testing purposes :)

    Best regards,
    Andy

    #665928

    Yeah….that’s the nature of using WooCommerce though right? lol… Rather than creating a robust main plugin, you have to install all kinds of supplemental plugins just to get small features. It’d be a LOT worse if I wasn’t using ACF Pro and a some hooks via functions.php. I’ll give the deactivate/activate thing ago….was just hoping to avoid doing so. :)

    I have most of the official WooCommerce plugins gathered over the years….several aren’t even installed. If you would prefer, I could setup a test site for you with them all activated so you guys can test away if that helps to make Enfold that much better.

    #665933

    That didn’t work…no matter what it always displayed them randomly. In all honesty, it isn’t really that big of a deal…more of an annoyance. I can’t seem to figure out the cause. :/

    #666161

    Hi,

    again: are we allowed to deactivate all your plugins for testing purposes?

    Best regards,
    Andy

    #666366

    Sure. Just please reactivate when done.

    #667524

    Hi,

    We found this code in the functions.php file. It overrides the sorting query:

    // adds an extra option for sorting product listings randomly
    add_filter( 'woocommerce_get_catalog_ordering_args', 'custom_woocommerce_get_catalog_ordering_args' );
    function custom_woocommerce_get_catalog_ordering_args( $args ) {
      $orderby_value = isset( $_GET['orderby'] ) ? woocommerce_clean( $_GET['orderby'] ) : apply_filters( 'woocommerce_default_catalog_orderby', get_option( 'woocommerce_default_catalog_orderby' ) );
    	if ( 'random_list' == $orderby_value ) {
    		$args['orderby'] = 'rand';
    		$args['order'] = '';
    		$args['meta_key'] = '';
    	}
    	return $args;
    }
    add_filter( 'woocommerce_default_catalog_orderby_options', 'custom_woocommerce_catalog_orderby' );
    add_filter( 'woocommerce_catalog_orderby', 'custom_woocommerce_catalog_orderby' );
    function custom_woocommerce_catalog_orderby( $sortby ) {
    	$sortby['random_list'] = 'Random';
    	return $sortby;
    }
    

    Best regards,
    Ismael

    #667525

    Lol… I know. I got it from you guys in another thread. Is supposed to only add it as an option. Been working for a while until this past big update of woocommerce. I’ll try hiding it again, but I tried that before and it didn’t resolve the problem. Will give it another go.

    #667887

    That part was removed entirely and no matter what option I choose from the Enfold drop down, it displays them randomly every time.

    #669215

    Hi,

    We also disabled this function:

    //add_filter('avia_product_slide_query', 'avia_product_slide_query_mod', 10, 2);
    function avia_product_slide_query_mod($params) {
    	$params['orderby'] = 'rand';
    	return $params;
    }

    You can apply this filter in a specific page. Use the is_page conditional function.

    Best regards,
    Ismael

    #669533

    Thank you. Didn’t think that would have caused the issue since I wasn’t using the slider. May want to have someone do a search in this forum for those code block and give everyone a heads up that they no longer work as intended….or figure out how to make it work with the newer versions of WooCommerce. :)

    #671423

    Hi,

    glad we could help. Let us know in a new ticket if you have some more questions related to the theme. We are happy to assist you.

    Best regards,
    Andy

Viewing 18 posts - 1 through 18 (of 18 total)
  • The topic ‘WooCommerce product sorting…’ is closed to new replies.