Ejemplo n.º 1
0
        private void SetCart(out ClientCartContext cartContext)
        {
            cartContext = new ClientCartContext();
            cartContext.RequestParam         = CommonHelper.GetQueryString(Request.RawUrl);
            cartContext.IpAddress            = CommonHelper.IpAddress(HttpContext.Current);
            cartContext.OrderAttributeValues = new System.Collections.Generic.Dictionary <string, CSBusiness.Attributes.AttributeValue>();
            cartContext.OrderAttributeValues.Add("ref_url", new AttributeValue(ReferrerURL));
            cartContext.OrderAttributeValues.Add("landing_url", new AttributeValue(LandingPageURL));
            cartContext.OrderAttributeValues.Add("servername", new AttributeValue(ServerName));
            cartContext.VersionId = CSBasePage.GetVersion();

            if (cartContext.CartInfo == null)
            {
                cartContext.CartInfo = new CSBusiness.ShoppingManagement.Cart();
                cartContext.CartInfo.ShippingAddress = new CSBusiness.CustomerManagement.Address();
            }
        }
Ejemplo n.º 2
0
        protected ClientCartContext GetInitializedCart()
        {
            ClientCartContext cartContext = null;

            if (Session["ClientOrderData"] != null)
            {
                cartContext = (ClientCartContext)Session["ClientOrderData"];
            }
            if (cartContext != null && cartContext.OrderId > 0)
            {
                // This means order is already placed and user re-visited the home page again. So we should reset the data
                cartContext.ResetData();
                cartContext.OrderId = 0;
                SetCart(out cartContext);
            }
            else if (cartContext != null)
            {
                // This means that cart is set in root and redirected to some version. So if versionid is different then we should set the new landing page and new version.
                if (cartContext.VersionId != CSBasePage.GetVersion())
                {
                    if (cartContext.OrderAttributeValues != null && cartContext.OrderAttributeValues.ContainsKey("landing_url"))
                    {
                        cartContext.OrderAttributeValues.Remove("landing_url");
                        cartContext.OrderAttributeValues.Add("landing_url", new AttributeValue(LandingPageURL));
                    }
                    else
                    {
                        SetCart(out cartContext);
                    }
                    cartContext.VersionId = CSBasePage.GetVersion();
                }
            }
            else
            {
                SetCart(out cartContext);
            }

            Session["ClientOrderData"] = cartContext;
            return(cartContext);
        }
Ejemplo n.º 3
0
        private void WriteCSBaseJS()
        {
            bool          foundTnTVars = false;
            StringBuilder sbCSScript   = new StringBuilder();

            string completeVersionScript = Analytics.GetCompleteVersionIdJS(CSBasePage.GetVersionName(true, out foundTnTVars), foundTnTVars);

            // write base js
            sbCSScript.AppendLine(ScriptsResource.ConversionSystemsBase

                                  // T&T related values
                                  .Replace("<TNT_C_ID>", GetTrackingFieldPageId(TrackingField.TnTCampaignId))
                                  .Replace("<TNT_E_ID>", GetTrackingFieldPageId(TrackingField.TnTExperienceId))
                                  .Replace("<VERSION_COMBINE_FUNC>", completeVersionScript)

                                                                                                                                                          // mobile/tablet related values
                                  .Replace("<IS_MOBILE>", ClientDeviceType == DeviceType.Mobile ? true.ToString().ToLower() : false.ToString().ToLower()) // mobile flag
                                  .Replace("<IS_TABLET>", ClientDeviceType == DeviceType.Tablet ? true.ToString().ToLower() : false.ToString().ToLower()) // tablet flag
                                  );


            ClientScript.RegisterClientScriptBlock(this.GetType(), "ConversionSystemsBase", sbCSScript.ToString(), true);
        }