Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Anthony 28 posts 147 karma points
    Mar 15, 2023 @ 16:13
    Anthony
    0

    Vendr Store - Problem adding Products when Vary by Culture is True

    Spotted an issue with Vendr when searching for products and adding to them to the cart in the Back-office.

    See under the back-office > commerce > cart > select\create cart > add a product pop-up window.

    When the Vendr Store picker property is located on a top level node (home) with "Allow vary by culture" set on\true the search fails. Turn it off and it works.

    It's because the code in the controller - umbraco/backoffice/vendr/vendrproduct/SearchProductSummaries - is looking for a "store" field but vary for culture changes the field name to append the culture, to something like "store_enGB" :

    public override PagedResult<IProductSummary> SearchProductSummaries(Guid storeId, string languageIsoCode, string searchTerm, long currentPage = 1L, long itemsPerPage = 50L)
    {
        if (_examineManager.TryGetIndex("InternalIndex", out var index))
        {
            ISearcher searcher = index.Searcher;
            List<string> list = (from x in searcher.CreateQuery().Field("store", storeId.ToString()).And()
                    .Field("__Published", "y")
                    .Execute()
                select x.Values["__Path"]).ToList();
    

    Not sure where to post bugs, but thought I'd post the issue here for others and general comment, as it was a devil to find.

  • Matt Brailsford 4125 posts 22222 karma points MVP 9x c-trib
    Mar 15, 2023 @ 16:58
    Matt Brailsford
    0

    Hi Anthony,

    The store picker isn't really intended to be varied by culture. The culture really just dictates the language the product data is displayed in, but it's assumed the same store would be used for a given language.

    Surely if you have different stores for different countries you'd potentially have different products, different stock levels, etc? So wouldn't those be better setup as multi site instance, rather than 1 to 1 translated 🤔

  • Anthony 28 posts 147 karma points
    Mar 15, 2023 @ 20:58
    Anthony
    0

    Yeah, I didn't turn it on deliberately! I only have one store. Not sure how or why it got set.

    I was just testing and couldn't figure out why the products weren't being picked up and thought it might be symptomatic of something more serious. Everything else was working fine.

    I'm not building a multi-lingual website, just multi-currency, but it did make me wonder how it should be done with Vendr.

    I suspect if you wanted 1 store, for a multi-lingual site - say if you distributed worldwide from a UK warehouse? - you could make it work with an intermediate node (not verified by culture) for the store picker.

    Anyway, thanks for feedback and pointers, much appreciated.

  • Matt Brailsford 4125 posts 22222 karma points MVP 9x c-trib
    Mar 16, 2023 @ 08:52
    Matt Brailsford
    0

    No problem 👍

Please Sign in or register to post replies

Write your reply to:

Draft