Display prices of a particular variation in filter

  • wpsolr
    Keymaster
    5 months, 1 week ago #30725

    Here is the procedure:

    1) Select type “Float” for “_price” on screen 2.2
    2) In your code use “_price_f” (“_f” for float): $document_for_update['_price_f'] = 2000;
    3) Save your product to reindex its price (or all your products if you want to see a single facet value (2000)

    prakashreddy.imduri
    Participant
    5 months, 1 week ago #30726

    Okay, I tried first 2 steps, It didnt worked. I didn’t understood the 3rd point, Save your product to re-index its price. Do I need to edit and save product ? or just by deleting and re indexing , this will be fixed?

    wpsolr
    Keymaster
    5 months, 1 week ago #30727

    If you edit and save, it will also index the new product’s price.
    If you want to reindex all prices, reindex all your products.

    prakashreddy.imduri
    Participant
    5 months, 1 week ago #30729

    I deleted and re-indexed all products and variation, still there is no change in price filter, its still showing all price ranges.

    wpsolr
    Keymaster
    5 months, 1 week ago #30730

    Add some debug traces in your code (echo ‘something’), to be sure it is called when you save a product. Also check your WP debug.log file.

    prakashreddy.imduri
    Participant
    5 months, 1 week ago #30732

    I echoed the code, I was getting this, I have now changed that to _price_f, its a old code
    Image image.png of
    Do, I need to turn on this _price in variations too ? I already enabled the _price in Products section
    Image image.png of

    wpsolr
    Keymaster
    5 months, 1 week ago #30733

    No, do not select variations post type on screen 2.2. Only products.

    prakashreddy.imduri
    Participant
    5 months, 1 week ago #30736

    I unchecked variations and reindexed, Still the filters are showing all ranges, Here is the code :
    Image image.png of

    wpsolr
    Keymaster
    5 months, 1 week ago #30738

    What does the WPSOLR query tell you (if not, install the WPSOLR query monitor add-on)?

    prakashreddy.imduri
    Participant
    5 months, 1 week ago #30739

    I checked for the default search page :
    Image image.png of
    Do you want me to check in some other page too ?

    wpsolr
    Keymaster
    5 months, 1 week ago #30741

    The query looks fine.
    Can you check in Kibana what your index’s “_price_f” value is?

    wpsolr
    Keymaster
    5 months, 1 week ago #30742

    If the index’s “_price_f” value is not updated, while your code is called (check with the print_r), try to replace the event WPSOLR_Events::WPSOLR_FILTER_SOLARIUM_DOCUMENT_BEFORE_UPDATE with WPSOLR_Events::WPSOLR_FILTER_SOLARIUM_DOCUMENT_FOR_UPDATE in your code.

    prakashreddy.imduri
    Participant
    5 months, 1 week ago #30743

    This is working – WPSOLR_FILTER_SOLARIUM_DOCUMENT_FOR_UPDATE.

    prakashreddy.imduri
    Participant
    5 months, 1 week ago #30745

    Thank you.

Viewing 14 posts - 16 through 29 (of 29 total)

You must be logged in to reply to this topic.