Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (StoreSettings != null)
            {
                try
                {
                    if (!string.IsNullOrEmpty(StoreSettings.CurrencySymbol))
                    {
                        _localFormat.CurrencySymbol = StoreSettings.CurrencySymbol;
                    }

                    _imageUpdate = _templatePath + "images/" + Localization.GetString("ImageUpdate", LocalResourceFile);
                    _imageDelete = _templatePath + "images/" + Localization.GetString("ImageDelete", LocalResourceFile);

                    ITaxProvider taxProvider = StoreController.GetTaxProvider(StoreSettings.TaxName);
                    ITaxInfo     taxInfo     = taxProvider.GetDefautTaxRates(PortalId);
                    _defaultTaxRate = taxInfo.DefaultTaxRate;
                    _showTax        = taxInfo.ShowTax;

                    if (_linkToDetail)
                    {
                        _linkTitle = Localization.GetString("lnkTitle", LocalResourceFile);
                        if (StoreSettings.SEOFeature)
                        {
                            _productControler = new ProductController();
                        }
                    }

                    if (IsPostBack == false)
                    {
                        UpdateCartGrid();
                    }
                }
                catch (Exception ex)
                {
                    Exceptions.ProcessModuleLoadException(this, ex);
                }
            }
        }
Exemplo n.º 2
0
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            int       portalId  = PortalSettings.PortalId;
            StoreInfo storeInfo = StoreController.GetStoreInfo(portalId);

            if (storeInfo != null)
            {
                NumberFormatInfo localFormat = (NumberFormatInfo)NumberFormatInfo.CurrentInfo.Clone();
                string           text;

                phControls.Visible = true;
                lblStoreMicroCartItemsTitle.CssClass = _itemsTitleCssClass;
                lblStoreMicroCartTotalTitle.CssClass = _totalTitleCssClass;
                lblStoreMicroCartItems.CssClass      = _itemsCssClass;
                lblStoreMicroCartTotal.CssClass      = _totalCssClass;

                string resource = TemplateSourceDirectory + "/App_LocalResources/MicroCart.ascx.resx";
                lblStoreMicroCartItemsTitle.Text = Localization.GetString("CartItemsTitle.Text", resource);
                lblStoreMicroCartTotalTitle.Text = Localization.GetString("CartTotalTitle.Text", resource);

                try
                {
                    CartInfo cartInfo = CurrentCart.GetInfo(portalId, storeInfo.SecureCookie);

                    if (!string.IsNullOrEmpty(storeInfo.CurrencySymbol))
                    {
                        localFormat.CurrencySymbol = storeInfo.CurrencySymbol;
                    }

                    ITaxProvider taxProvider    = StoreController.GetTaxProvider(storeInfo.TaxName);
                    ITaxInfo     taxInfo        = taxProvider.GetDefautTaxRates(portalId);
                    bool         showTax        = taxInfo.ShowTax;
                    decimal      defaultTaxRate = taxInfo.DefaultTaxRate;

                    text = Localization.GetString("CartItems.Text", resource);

                    if (cartInfo != null && cartInfo.Items > 0)
                    {
                        lblStoreMicroCartItems.Text = string.Format(text, cartInfo.Items);
                        decimal cartTotal = cartInfo.Total;
                        if (showTax && _includeVAT && cartInfo.Total > 0)
                        {
                            cartTotal = (cartTotal + (cartTotal * (defaultTaxRate / 100)));
                        }
                        lblStoreMicroCartTotal.Text = cartTotal.ToString("C", localFormat);
                    }
                    else
                    {
                        lblStoreMicroCartItems.Text = string.Format(text, 0);
                        lblStoreMicroCartTotal.Text = (0D).ToString("C", localFormat);
                    }
                }
                catch
                {
                    text = Localization.GetString("Error.Text", resource);
                    lblStoreMicroCartItems.Text      = text;
                    lblStoreMicroCartTotalTitle.Text = text;
                }
            }
            else
            {
                phControls.Visible = false;
            }
        }
Exemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            _catalogNav = new CatalogNavigation(Request.QueryString);
            _imagesPath = _templatePath + "Images/";

            if (!string.IsNullOrEmpty(StoreSettings.CurrencySymbol))
            {
                _localFormat.CurrencySymbol = StoreSettings.CurrencySymbol;
            }

            ITaxProvider taxProvider = StoreController.GetTaxProvider(StoreSettings.TaxName);
            ITaxInfo     taxInfo     = taxProvider.GetDefautTaxRates(PortalId);

            _defaultTaxRate = taxInfo.DefaultTaxRate;
            _showTax        = taxInfo.ShowTax;

            _product = (DataSource as ProductInfo);
            if (_product != null)
            {
                _category = _categoryControler.GetCategory(PortalId, _product.CategoryID);
                if (StoreSettings.SEOFeature)
                {
                    _catalogNav.Category = _category.SEOName;
                    if (InList == false)
                    {
                        BasePage.Title       = SEO(Localization.GetString("DetailsSEOTitle", LocalResourceFile), MetaTags.Title);
                        BasePage.Description = SEO(Localization.GetString("DetailsSEODescription", LocalResourceFile), MetaTags.Description);
                        BasePage.KeyWords    = SEO(Localization.GetString("DetailsSEOKeywords", LocalResourceFile), MetaTags.Keywords);
                        CatalogNavigation canonical = new CatalogNavigation
                        {
                            CategoryID = _product.CategoryID,
                            ProductID  = _product.ProductID
                        };
                        string domain = Request.Url.GetLeftPart(UriPartial.Authority);
                        string url    = canonical.GetNavigationUrl();
                        if (url.StartsWith(domain, true, CultureInfo.CurrentCulture) == false)
                        {
                            url = domain + url;
                        }
                        HeaderHelper.AddCanonicalLink(Page, url);
                    }
                }
                plhDetails.Controls.Add(TemplateController.ParseTemplate(MapPath(_templatePath), _template, Localization.GetString("TemplateError", LocalSharedResourceFile), IsLogged, new ProcessTokenDelegate(ProcessToken)));
            }

            // Clear error message
            divError.Visible = false;

            // Show review panel ?
            if (ShowReviews && !InList)
            {
                int reviewID = _catalogNav.ReviewID;
                // Show review list or edit?
                if (reviewID != Null.NullInteger)
                {
                    if (reviewID > 0 && !CanManageReviews())
                    {
                        _catalogNav.ReviewID = Null.NullInteger;
                        Response.Redirect(_catalogNav.GetNavigationUrl());
                    }
                    else
                    {
                        LoadReviewEditControl();
                    }
                }
                else
                {
                    LoadReviewListControl();
                }
                pnlReviews.Visible = true;
            }
            else
            {
                pnlReviews.Visible = false;
            }

            // Show Return link?
            if (InList == false)
            {
                if (_catalogNav.SearchID == Null.NullInteger)
                {
                    if (_catalogNav.CategoryID == Null.NullInteger)
                    {
                        lnkReturn.Text = Localization.GetString("lnkReturnToCatalog", LocalResourceFile);
                    }
                    else
                    {
                        lnkReturn.Text = Localization.GetString("lnkReturn", LocalResourceFile);
                    }
                }
                else
                {
                    lnkReturn.Text = Localization.GetString("lnkReturnToSearch", LocalResourceFile);
                }
                lnkReturn.NavigateUrl = GetReturnUrl(ReturnPage);
                pnlReturn.Visible     = true;
            }
            else
            {
                pnlReturn.Visible = false;
            }
        }