Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (StoreSettings != null)
            {
                try
                {
                    string templatePath = CssTools.GetTemplatePath(this, StoreSettings.PortalTemplates);
                    CssTools.AddCss(Page, templatePath, StoreSettings.StyleSheet);

                    // Read module settings and define cart properties
                    Core.Cart.MiniCartSettings cartSettings = new ModuleSettings(ModuleId, TabId).MiniCart;
                    cartControl.ShowThumbnail       = cartSettings.ShowThumbnail;
                    cartControl.ThumbnailWidth      = cartSettings.ThumbnailWidth;
                    cartControl.GIFBgColor          = cartSettings.GIFBgColor;
                    cartControl.EnableImageCaching  = cartSettings.EnableImageCaching;
                    cartControl.CacheImageDuration  = cartSettings.CacheImageDuration;
                    cartControl.ProductColumn       = cartSettings.ProductColumn.ToLower();
                    cartControl.LinkToDetail        = cartSettings.LinkToDetail;
                    cartControl.IncludeVAT          = cartSettings.IncludeVAT;
                    cartControl.TemplatePath        = templatePath;
                    cartControl.ModuleConfiguration = ModuleConfiguration;
                    cartControl.StoreSettings       = StoreSettings;
                    cartControl.EditComplete       += cartControl_EditComplete;

                    _itemsCount = CurrentCart.GetItems(PortalId, StoreSettings.SecureCookie).Count;
                    if (_itemsCount == 0)
                    {
                        phlViewCart.Visible = false;
                    }
                }
                catch (Exception ex)
                {
                    Exceptions.ProcessModuleLoadException(this, ex);
                }
            }
            else
            {
                if (UserInfo.IsSuperUser)
                {
                    string ErrorSettings        = Localization.GetString("ErrorSettings", LocalResourceFile);
                    string ErrorSettingsHeading = Localization.GetString("ErrorSettingsHeading", LocalResourceFile);
                    UI.Skins.Skin.AddModuleMessage(this, ErrorSettingsHeading, ErrorSettings, UI.Skins.Controls.ModuleMessage.ModuleMessageType.YellowWarning);
                }
                divControls.Visible = false;
            }
        }
Esempio n. 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (StoreSettings != null)
            {
                string templatePath = CssTools.GetTemplatePath(this, StoreSettings.PortalTemplates);
                CssTools.AddCss(Page, templatePath, StoreSettings.StyleSheet);
                divControls.Visible = true;

                if (IsLogged == false)
                {
                    lblSpacer2.Visible   = false;
                    btnProfile.Visible   = false;
                    lblSpacer3.Visible   = false;
                    btnOrders.Visible    = false;
                    lblSpacer4.Visible   = false;
                    btnDownloads.Visible = false;
                }
                else
                {
                    if (StoreSettings.AllowVirtualProducts == false)
                    {
                        lblSpacer4.Visible   = false;
                        btnDownloads.Visible = false;
                    }
                }
            }
            else
            {
                if (UserInfo.IsSuperUser)
                {
                    string errorSettings        = Localization.GetString("ErrorSettings", LocalResourceFile);
                    string errorSettingsHeading = Localization.GetString("ErrorSettingsHeading", LocalResourceFile);
                    UI.Skins.Skin.AddModuleMessage(this, errorSettingsHeading, errorSettings, UI.Skins.Controls.ModuleMessage.ModuleMessageType.YellowWarning);
                }
                divControls.Visible = false;
            }
        }
Esempio n. 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (StoreSettings == null)
            {
                string templatePath = CssTools.GetTemplatePath(this, false);
                CssTools.AddCss(Page, templatePath, "Template.css");
            }
            else
            {
                string templatePath = CssTools.GetTemplatePath(this, StoreSettings.PortalTemplates);
                CssTools.AddCss(Page, templatePath, StoreSettings.StyleSheet);
            }

            CheckUserRoles();

            _adminNav = new AdminNavigation(Request.QueryString);
            if (_adminNav.PageID == Null.NullString)
            {
                // Define the default control
                _adminNav = new AdminNavigation();
                if (_canManageStore)
                {
                    _adminNav.PageID = "StoreAdmin";
                }
                else if (_canManageOrders)
                {
                    _adminNav.PageID = "CustomerAdmin";
                }
                else if (_canManageCatalog)
                {
                    _adminNav.PageID = "CategoryAdmin";
                }
            }
            else
            {
                switch (_adminNav.PageID.ToLower())
                {
                case "storeadmin":
                    if (!_canManageStore)
                    {
                        _adminNav.PageID = "";
                    }
                    break;

                case "customeradmin":
                    if (!_canManageOrders)
                    {
                        _adminNav.PageID = "";
                    }
                    break;

                case "categoryadmin":
                case "productadmin":
                case "reviewadmin":
                case "couponadmin":
                    if (!_canManageCatalog)
                    {
                        _adminNav.PageID = "";
                    }
                    break;

                default:
                    _adminNav.PageID = "";
                    break;
                }
            }

            LoadAdminControl();
        }
Esempio n. 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (StoreSettings != null)
            {
                try
                {
                    // Load utility objects
                    _nav = new CatalogNavigation(Request.QueryString)
                    {
                        ProductID = Null.NullInteger    //Product should not be displayed!
                    };
                    if (_nav.CategoryID == 0)
                    {
                        _nav.CategoryID = Null.NullInteger;
                    }

                    // Get selected category and parent categories (if any)
                    _selectedCategoryID = _nav.CategoryID;
                    if (_selectedCategoryID != Null.NullInteger && _settings.CategoryMenu.DisplayMode == "T")
                    {
                        CategoryInfo category = _categoryController.GetCategory(PortalId, _selectedCategoryID);
                        _parentCategories.Add(category);
                        if (category.CategoryID != category.ParentCategoryID)
                        {
                            while (category.ParentCategoryID != Null.NullInteger)
                            {
                                category = _categoryController.GetCategory(PortalId, category.ParentCategoryID);
                                _parentCategories.Add(category);
                                foreach (CategoryInfo cat in _parentCategories)
                                {
                                    if (cat.CategoryID == category.CategoryID)
                                    {
                                        //Cyclical categories found
                                        break;
                                    }
                                }
                            }
                        }
                    }

                    if (_parentCategories.Count > 0)
                    {
                        _parentCategories.Reverse();
                    }

                    string templatePath = CssTools.GetTemplatePath(this, StoreSettings.PortalTemplates);
                    CssTools.AddCss(Page, templatePath, StoreSettings.StyleSheet);

                    if (_settings.CategoryMenu.DisplayMode == "T")
                    {
                        // Databind to list of categories
                        List <CategoryInfo> categoryList = _categoryController.GetCategories(PortalId, false, -2);
                        MyList.RepeatColumns = _settings.CategoryMenu.ColumnCount;
                        MyList.DataSource    = categoryList;
                        MyList.DataBind();
                    }
                    else
                    {
                        Control ulMenu = CreateULMenu(-2, 0);
                        if (ulMenu != null)
                        {
                            divStoreMenu.Controls.Add(ulMenu);
                        }
                    }
                }
                catch (Exception ex)
                {
                    if (ex.InnerException != null)
                    {
                        Exceptions.ProcessModuleLoadException(this, ex.InnerException);
                    }
                    else
                    {
                        Exceptions.ProcessModuleLoadException(this, ex);
                    }
                }
            }
            else
            {
                if (UserInfo.IsSuperUser)
                {
                    string errorSettings        = Localization.GetString("ErrorSettings", LocalResourceFile);
                    string errorSettingsHeading = Localization.GetString("ErrorSettingsHeading", LocalResourceFile);
                    UI.Skins.Skin.AddModuleMessage(this, errorSettingsHeading, errorSettings, UI.Skins.Controls.ModuleMessage.ModuleMessageType.YellowWarning);
                }
                else
                {
                    MyList.Visible = false;
                }
            }
        }