Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #1083713

    Please bear with me – I’ve spent several days troubleshooting this (been through WC support and followed the path here) so would really appreciate some guidance to even if you are unable to deal with it fully.

    It seems Enfold is behaving differently to core Woocommerce when it comes to sorting variable products by price. I understand this was a relatively recent WC change so maybe Enfold is still catching up or maybe you don’t know about it yet – but either way it’s causing me big problems.

    Environment: WP / Enfold / WC all patched no addtional code or plugins.

    I have a mix of simple and variable products (for sale / for rent). Sale variations are priced high (eg £1000) rental variations are 10% of the sale price (eg £100).

    Issue:

    When sorting price ascending the filtering takes place on the lowest variation price (as is the case with native WC sortby).

    When sorting price descending Enfold seems to be filtering on the lowest variation price again (WC natively filters on the highest variation price when sorting price descending).

    As a result simple products are mixed in with variable products in the wrong order when sorting by price.

    Solution required:

    Always sort on the highest variable price (whether ascending or descending) – simple as that.

    Example:

    Demo URL in private content.

    Thanks.

    #1085207

    Hey M1000000,
    Sorry for the late reply, thanks for the detailed report and the staging site, but the link to the problem was a different domain and a 404.
    So I took a look at your shop page and see that sorting by price whether ascending or descending the lowest price is taken by Enfold.
    But as I started to dig into this deeper I found that none of your variables have variable pricing, on the front end they show two prices but on the back end there is only one price and no variables.
    Probably something to do with how it was imported. So I tried testing on my localhost, but didn’t find a solution within the theme files.
    I asked the dev team if they can offer a solution.
    Thank you for your patience.

    Best regards,
    Mike

    #1085235

    Hi Mike
    You are right – the import stripped all the attributes and variables – sorry about that, must have been a late night!
    Can you confirm you are able to replicate the issue I describe or shall I upload a new vbersion with the correct data for testing?
    Thanks, M

    #1085783

    Hi,
    I was able to reproduce on my localhost, but if you could add the variables to your staging site it would be a big help for the dev team when they take a look, that way they can just work on a solution.
    Thanks :)

    Best regards,
    Mike

    #1087266

    Hi,
    Hey good news, the dev team has a solution for this now that they would like you to test, you will need to replace 8 files via FTP.
    I have attached a zip file in the Private Content area that I created fo your with the files in the correct folder paths, plus there is a text file listing the paths and dev notes. Please make backups of your files before replacing them should you need to roll back.
    Please let us know if this helps.

    Notes:

    Needs WC 3.5.7 !!
    extended sorting options for shop page and ALB elements
    added select box for ASC/DESC to 2 ALB elements
    sorting by price works for variable products now (lowest – highest)
    better integration in WC sorting logic
    adjusted description where to find default settings for catalog sorting
    for backwards comp. config-356.php (new file woo-loader.php)

    Best regards,
    Mike

    #1088062

    Hi Mike – testing this now and I’m afraid it doesn’t work for me.
    I have updated the demo site with products – please take a look I hope this will clarify things.

    Fistly would like to be sure that it’s clear I’m talking about the shop page – not masonry or any other elements when it comes to the sort issue I have.

    Secondly it’s worth noting that in my scenario I am ignoriong the lowest variant price – it is irrelevant (it’s actually display:none in the final version of this site) – the only sorting I want to do is on the highest variable price.

    If you look at the demo now you will see 7 products each with the attribute “Test Attributes | Att 1 | Att 2”.

    Att 1 is the high variant price | Att 2 is the low variant price.

    You will note that the defaultr sort lists the products from 7 down to 1 as expected.

    For reference I need sorting by price asc / desc to producte exactly the same result as sorting bny name.

    With default Enfold (4.5.5)

    Price descending should be the same order – from £7000 down to £1000. But it isn’t because the sort is being performed on the lowest variant price (Att 2) which is random.

    Similarly price ascending is being sorted on the lowest variable price and ignores the high variable price.

    I have created a theme – Enfold test – which includes the modified files provided. HOPWEVER – I note that your accomanying text doc lists “/enfold/config-woocommerce/config.php” and that this file has not actually been provided. woocommerce-mod-css-dynamic.php has but is not listed in your test file.

    In any case – switching to this revised theme makes no difference at all to the price sorting on the shop page I’m afraid.

    #1088063

    Thanks, M

    #1088078

    Hi,
    Thanks for your feedback, so I’m it looks like I made an error, woocommerce-mod-css-dynamic.php was not meant to be in there, but when I went back to get the correct files there were more of them now, so I created a new package, linked below.
    You see I have to copy them one at a time manually and I’m placing them in a directory structure to help when you upload them.
    Anyways I know that you only care about the woo files, but I don’t know if any of the other files are needed or not so I included them.
    So now that I got the config.php and there was an added functions.php, perhaps it will work this time? Hope so :)

    Best regards,
    Mike

    #1088224

    Hi Mike,

    Have updated the demo.

    Result is that price sorting now uses the high variable to sort descending – which is good for me, but is using the low variable to sort ascending – which isn’t.

    I suspect this is closer to te WC default however does not fix my prob – I need to sort by high variable on both descending and ascending.

    Best, M

    #1088519

    Hi,
    That is good news in a way, but I will report back that it is not what you are looking for.

    Best regards,
    Mike

    #1088654

    Hi,

    Always sort on the highest variable price (whether ascending or descending) – simple as that.

    As theme we have to follow the default behaviour of WooCommerce.

    Your request is actually customization.

    What you can try is the following in WooCommerce core (replace min with max):

    woocommerce\includes\class-wc-query.php line 527:

    
    				SELECT post_id, min( meta_value+0 ) price
    

    Replace with:

    
    				SELECT post_id, max( meta_value+0 ) price
    

    and

    line 537 (only the beginning of the line):

    
    			$args['join'] .= " INNER JOIN ( SELECT post_id, min( meta_value+0 ) price
    

    Replace with:

    
    			$args['join'] .= " INNER JOIN ( SELECT post_id, max( meta_value+0 ) price
    

    Best regards,
    Günter

    #1090098

    That works just fine – many thanks.

    Can I assume the WC fix (not the mod) will make it into a release sometime soon?

    Cheers, M

    #1090395

    Hi,
    Glad Günter was able to help, and yes the fix will be in the update, shall we close this then?

    Best regards,
    Mike

    #1090439

    Thanks Mike & Günter – yes please close.

    #1090452

    Hi,
    Glad we were able to help, we will close this now. Thank you for using Enfold.

    For your information, you can take a look at Enfold documentation here
    For any other questions or issues, feel free to start new threads under Enfold sub forum and we will gladly try to help you :)

    Best regards,
    Mike

Viewing 15 posts - 1 through 15 (of 15 total)
  • The topic ‘woocommerce shop – sorting by price breaks with simple and variable products’ is closed to new replies.