Copied to clipboard

Flag this post as spam?

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


  • Lewis Smith 208 posts 617 karma points c-trib
    Apr 25, 2018 @ 08:52
    Lewis Smith
    0

    he product doesn't have a store id associated with it - remember to add the Tea Commerce store picker to your Umbraco content tree

    Hi,

    I'm hitting an issue with TC!

    When viewing the basket its saying that i dont have a store ID associated with the product... The store ID is set at the highest node (in this case the homepage) This worked previous but has stopped working!

    The error im getting is: enter image description here

    Code:

    @using TeaCommerce.Api.Models
    @using TeaCommerce.Umbraco.Web
    @inherits UmbracoTemplatePage
    @{
        Layout = "MasterCartStep.cshtml";    
        IPublishedContent currentPage = Model.Content;
        IPublishedContent nextStep = currentPage.Children.FirstOrDefault();    
        long storeId = long.Parse(currentPage.GetPropertyValue<string>("store", true));    
        Order order = TC.GetCurrentOrder(storeId, false);
        if (order != null && order.OrderLines.Any()){
            if (Convert.ToInt32(order.SubtotalPrice.Value.Value) >= 1000)
            {
                var shipMethods = TC.GetShippingMethods(storeId).ToList();
                if (shipMethods.Count() > 0)
                {
                    TC.SetCurrentShippingMethod(storeId, shipMethods[0].Id);
                }
            }
            else
            {
                var shipMethods = TC.GetShippingMethods(storeId).ToList();
                if (shipMethods.Count() > 0)
                {
                    TC.SetCurrentShippingMethod(storeId, shipMethods[1].Id);
                }
            }
        }
    }
    

    I have tired unsetting the store in the store picker and then resetting, I have tried republishing all pages but both haven't worked.

    Could any point help me out? The website is supposed to be going live in 2 weeks and this is 100% going to prevent this happening!

    Thanks, Lewis

  • Paul Wright (suedeapple) 277 posts 704 karma points
    Apr 25, 2018 @ 09:13
    Paul Wright (suedeapple)
    0

    Have a look in your TC backoffice and ensure you have a default shipping method set, for the default country/region you have set.

  • Lewis Smith 208 posts 617 karma points c-trib
    Apr 25, 2018 @ 09:19
    Lewis Smith
    0

    I have gone into the country under Internationalization > Countires> United Kingdom (which is the only country set) and ensured that default shipping method and default payment method are set. The issue still persists...

  • Paul Wright (suedeapple) 277 posts 704 karma points
    Apr 25, 2018 @ 09:23
    Paul Wright (suedeapple)
    0

    Simplify back your code, and just have it spit out the current storeID value.

    You should then be able to workout where things are going wonky.

    If its returning the correct storeID, then you know for certain that bits OK, and the problem resides in something else.

    I seem to remember, you need to ensure that a default country/currency/shipping method, need to be set. Otherwise things can go a bit wonky.

  • Lewis Smith 208 posts 617 karma points c-trib
    Apr 25, 2018 @ 09:28
    Lewis Smith
    0

    The correct store id is being returned, I only have one store set so this is and always will be 1.

    enter image description here

    Here is how the defaults for the store look, all set correctly i believe!

  • Paul Wright (suedeapple) 277 posts 704 karma points
    Apr 25, 2018 @ 09:32
    Paul Wright (suedeapple)
    0

    Region code should be "GB" - but not that that should be causing much trouble

  • Lewis Smith 208 posts 617 karma points c-trib
    Apr 25, 2018 @ 09:41
    Lewis Smith
    0

    This has been updated. This was updated on the UAT version but not DEV. Thanks!

  • Paul Wright (suedeapple) 277 posts 704 karma points
    Apr 25, 2018 @ 09:35
    Paul Wright (suedeapple)
    0

    Check the "SETTINGS" node, and double check you have UK, as your default country, and that all the other shipping methods, and currencies, payment methods are available for your default Country.

  • Lewis Smith 208 posts 617 karma points c-trib
    Apr 25, 2018 @ 09:43
    Lewis Smith
    0

    All checked the default country is set to the United Kingdom and all the methods are available to the UK.

    Not working still though!

  • Tor Langlo 189 posts 532 karma points
    May 24, 2018 @ 16:03
    Tor Langlo
    0

    One issue I discovered today was that TC.GetPrice fails on product nodes which are not published. This is normally not a problem since you should never encounter unpublished product nodes on a live site, but in your local/dev environment, if you are previewing a node (any node), then the Umbraco navigation methods (e.g. Content.Children()) will include unpublished nodes. At that point you may run into the problem.

    My work around is to wrap TC.GetPrice in a helper method, and return null (instead of allowing it to throw an exception) if product.IsDraft is true.

  • Tor Langlo 189 posts 532 karma points
    May 24, 2018 @ 16:05
    Tor Langlo
    0

    I forgot to mention that the exception thrown by TC.GetPrice was the same as the one thrown by the TC.SetCurrentShippingMethod as shown by the OP.

  • Paul Wright (suedeapple) 277 posts 704 karma points
    Feb 01, 2020 @ 12:44
    Paul Wright (suedeapple)
    0

    Fell foul to this ole problem again.

    Ensure the TeaCommerce Store Picker, has a property alias of "store" (as per the demo website), and not "storeId"

    That seemed to fix it for me

Please Sign in or register to post replies

Write your reply to:

Draft