Important Notice from AspDotNetStorefront
It is with dismay that we report that we have been forced, through the action of hackers, to shut off write-access to this forum. We are keen to leave the wealth of material available to you for research. We have opened a new forum from which our community of users can seek help, support and advice from us and from each other. To post a new question to our community, please visit: http://forums.vortx.com
Results 1 to 4 of 4

Thread: freeshippingthreshold

  1. #1
    chrismartz is offline Senior Member
    Join Date
    Apr 2010
    Posts
    339

    Default freeshippingthreshold

    I have some states that have one value for free shipping and other states that have another value. I tried to go in and create another appconfig for the other value and put an if statement that queried the address table to get the customer's state. When I try to do this, it always uses the default shipping threshold. Is this hard coded somewhere? I modified prices.cs and shoppingcart.cs to look at the new app config but it continues to use the value in freeshippingthreshold.

  2. #2
    ASPAlfred is offline Senior Member
    Join Date
    Nov 2007
    Posts
    2,244

    Default

    Make a global search with "FreeShippingThreshold" in the solution and see all the methods calls that appconfig, specifically AnalyzeCartForFreeShippingConditions() in ShoppingCart.cs class.

  3. #3
    chrismartz is offline Senior Member
    Join Date
    Apr 2010
    Posts
    339

    Default

    I have a mod in that function that I compiled and reloaded. Below is the code that I am using. Any suggestions?

    Code:
                m_FreeShippingThreshold = AppLogic.AppConfigUSDecimal("FreeShippingThreshold");
                using (SqlConnection conn = DB.dbConn())
                {
                    conn.Open();
                    using (IDataReader rs = DB.GetRS("SELECT '1' AS lowthreshold FROM Address A with (NOLOCK) inner join Customer C ON A.CustomerID=C.CustomerID WHERE c.CustomerID = " + ThisCustomer.CustomerID + " AND C.ShippingAddressID = A.AddressID AND A.State NOT IN('AZ','CA','ID','MT','NM','NV','OR','UT','WA','WY')", conn))
                    {
                        while (rs.Read())
                        {
                            if (DB.RSField(rs, "lowthreshold") != "1")
                            {
                                m_FreeShippingThreshold = AppLogic.AppConfigUSDecimal("FreeShippingThresholdWest");
                            }
                        }
                    }
                }
    Even when I manually set m_FreeShippingThreshold = AppLogic.AppConfigUSDecimal("FreeShippingThreshold West");, it still looks at FreeShippingThreshold.

  4. #4
    chrismartz is offline Senior Member
    Join Date
    Apr 2010
    Posts
    339

    Default

    I ended up using this, and it works now. I'm not sure why my other one didn't work.

    Code:
                    using (SqlConnection conn = DB.dbConn())
                    {
                        conn.Open();
                        using (IDataReader rs = DB.GetRS("SELECT state FROM Address A with (NOLOCK) inner join Customer C ON A.CustomerID=C.CustomerID WHERE c.CustomerID = " + ThisCustomer.CustomerID + " AND C.ShippingAddressID = A.AddressID", conn))
                        {
                            while (rs.Read()) 
                            {
                                string state = DB.RSField(rs, "state");
                                if (state == "AZ" || state == "CA" || state == "ID" || state == "MT" || state == "NM" || state == "NV" || state == "OR" || state == "UT" || state == "WA" || state == "WY")
                                {
                                    FreeShippingThreshold = AppLogic.AppConfigUSDecimal("FreeShippingThresholdWest");
                                }
                            }
                        }
                    }