Okay
  Public Ticket #2982676
Hide categories not working on ajax load when logged in as B2B
Closed

Comments

  •  6
    christian paton started the conversation

    Hi There

    OK so on the main shop page, hiding categories seems to work for me with B2C and not logged in, but when logged in as B2B and products are loaded with infinite scroll it doesn't seem to honour this?

    It does seem to work when you view specific categories however.

    cheers chris

  •   WebWizards replied privately
  •  6
    christian paton replied

    Hi Stefan, thanks for the quick response.

    I'm disabling visibility in the category page backend.

    Unfortunately that doesn't seem to help.

    Actually I have realised it isn't working for individual category pages either when B2B.

    cheers chris

  •  6
    christian paton replied

    I think have actually managed to come up with a work around using pre_get_posts as I noticed the same for the search results too, it seems very hacky though! I have taken out the hack on the staging site : 

    https://staging8.esmie.co.uk/shop/

  •  2,218
    WebWizards replied

    The plugin has a setting named "Product Visibility Cache" in B2BKing -> Settings -> Other. This setting also uses pre_get_posts and is designed to help with visibility in ajax search results and such. It's possible enabling this might resolve your issue.


    If that doesn't help, I'd be happy to look into this more directly to troubleshoot the issue and get this to work directly via b2bking. I still have the staging site login. But I'm not entirely sure how to test for the issue and I'm not sure where you applied your pre_get_posts code or if that's currently active.

    It would help if you can give me an example, what steps I can take to see the issue and what page I can see it on.

    Thank you,

  •   christian paton replied privately
  •  6
    christian paton replied

    I have also come across another very odd problem. For a certain category and certain products the B2B prices are leaking over to the B2C!? BUt if you look at the product by itself it seems fine...really weird. If you selcect quick add and choose a viable variation the price displayed sometimes has B2B  as well.

    https://staging8.esmie.co.uk/product-category/lampshades-bases/lampshades/

    https://staging8.esmie.co.uk/product/paper-lampshade-gold-peacocks/

    Also sometimes on some products on the B2B side in the archive it has only B2C prices. This can sometimes be fixed temporarily by updating the product but then it can come back again. Pretty baffling really.

    https://staging8.esmie.co.uk/product-category/notebooks/classic-journals/

  •  2,218
    WebWizards replied

    Hi Chris,

    Sorry for the delay in getting back to you on this, 

    1) The issues you're describing suggest that there's some caching in the site that's causing these problems. It seems that cached pages / queries / prices are showing instead of live data. 

    Usually caches get cleared when a product is updated / when a page is saved etc, so it makes sense that fixes it.

    I see that there's some Siteground Cache plugin in your site. Have you made any changes recently since your last message to this plugin's config?

    Quite frequently in my experience when I see this sort of issue it's because of some cache / object cache at the hosting level.


    2)

    Right now I tested with the examples you gave but I did not actually see the same issues. For example if I go to the Shop as a B2B user I do not see the Fabric guest books:

    8278752064.png

    I do see them as expected when checking as a logged out user:

    6113601236.png



    so this seems to be working correctly now in my tests.


    Similarly I am not seeing the price issue . As B2C the price is 175:

    1298624541.png

    Anyway, I am 99% sure this just meant you were seeing a cached page.



    The search is not really loading at all so I can't get to test it. When I check the console there's a 500 error there.

  •  6
    christian paton replied

    Hi Stefan, no worries.

    1) Yes that was my thought too, but the caching is switched off at a plugin level for the staging site, I have also tried switching it off generally on the site managment tools for siteground and purging the cache on both but it appears to make no difference.

    Updating a product does seems to temporarliy resolve this, but it also seems to come back again, which is bizarre to me?


    2) My apologies, I copied functions over from live and fogotten to switch off my pre_get_posts hack, you should be able to see it on the staging site now.

    Also the search should function so you can see the products there also.

    cheers chris

  •   WebWizards replied privately
  •  6
    christian paton replied

    Hi Stefan, I've been away the past week so just getting round to reading this now.

    1) OK yes I see this works when I am logged in as B2B and not admin so great.

    2) I see it does work in the live ajax search but if you hit return to display the search results on a page it doesn't seem to. The main search is using the default wordpress.

    https://staging8.esmie.co.uk/?s=2023

    3) This really is the most important issue though. Not only are products sometimes not showing B2B prices they also are not following the dynamic rules set up for minimum quantites and pack sizes. So as far as you are concerned this is to do with caching?


  •  2,218
    WebWizards replied

    Hi Chris,

    2) Regarding what happens when the return key is pressed: 

    This can be controlled in Ajax Search Lite -> General Options -> Behaviour -> Action when pressing the return key. I've now changed the value of that setting.

    3) I really don't think it could be anything else other than a caching issue. If there was a related bug within our plugin, we would have received many related tickets / reports of the problem, which is not the case.

    Similarly to the price, the minimum quantities / pack sizes directly have to do with the HTML of the page (the min="x" and step="x" values in the HTML), which can get cached by caching mechanisms. 

    Usually if it's a caching problem you will see the issue on the product page, but it will work fine on the cart page.

  •  6
    christian paton replied

    Hi Stefan

    2) I think we are getting distracted here perhaps. The ajax search lite is only installed for internal purposes to create a tool for my clients to serach for product ID's, it's wasn't actually being used for the main search, that was better wordpress search. So what concerns me is what happens when you see search results, it seems what ever plugin I use or don't use, the main search results page doesn't honour the B2B hidden categories and products etc. I have disabled both plugins so it is purely the default wordpress search : https://staging8.esmie.co.uk/?s=2023

    3) Hmm ok, I guess I'll need to ask siteground. Although contrary to what your are suggesting it works fine on single product pages, it's in any product archive that the issue arises.

    cheers chris

  •   WebWizards replied privately