protected void BindSubCategories()
        {
            IList <Category>       allCategories       = CategoryDataSource.LoadForParent(this._categoryId, true);
            List <SubCategoryData> populatedCategories = new List <SubCategoryData>();

            foreach (Category category in allCategories)
            {
                // SEARCH ALL CATEGORIES
                int totalProducts = ProductDataSource.AdvancedSearchCount(_keywords, category.Id, _manufacturerId, true, true, true, 0, 0, false, PageHelper.GetShopByChoices());
                if (totalProducts > 0)
                {
                    populatedCategories.Add(new SubCategoryData(category.Id, category.Name, category.NavigateUrl, totalProducts));
                }
            }
            if (populatedCategories.Count > 0)
            {
                SubCategoryPanel.Visible       = true;
                SubCategoryRepeater.DataSource = populatedCategories;
                SubCategoryRepeater.DataBind();
            }
            else
            {
                SubCategoryPanel.Visible = false;
            }
        }
Beispiel #2
0
        public virtual ActionResult List(CategoryDataSource datasource = null)
        {
            datasource.Data = Mapper.Map <List <CategoryViewModel> >(_categoriesRepository.GetList());
            datasource.Initialize();

            return(View(datasource));
        }
Beispiel #3
0
        private IList <BreadCrumbItem> GetChildItems(BreadCrumbItem item)
        {
            List <BreadCrumbItem> childItems = new List <BreadCrumbItem>();

            if (item.Title == "Catalog")
            {
                childItems.Add(new BreadCrumbItem("Categories", this.Page.ResolveUrl("~/admin/catalog/browse.aspx"), "root"));
                Category category = CategoryDataSource.Load(AbleCommerce.Code.PageHelper.GetCategoryId());
                if (category != null)
                {
                    string editUrl = this.Page.ResolveUrl("~/admin/catalog/browse.aspx?CategoryId=");
                    IList <CatalogPathNode> path = CatalogDataSource.GetPath(category.Id, false);
                    foreach (CatalogPathNode pathNode in path)
                    {
                        childItems.Add(new BreadCrumbItem(pathNode.Name, editUrl + pathNode.CatalogNodeId, "parent"));
                    }
                }

                /*
                 * Product product = ProductDataSource.Load(AbleCommerce.Code.PageHelper.GetProductId());
                 * if (product != null)
                 * {
                 *  string editUrl = "~/admin/products/editproduct.aspx?";
                 *  if (category != null) editUrl += "CategoryId=" + category.Id + "&";
                 *  editUrl += "ProductId=" + product.Id;
                 *  editUrl = this.Page.ResolveUrl(editUrl);
                 *  childItems.Add(new BreadCrumbItem(product.Name, editUrl, "parent"));
                 * }
                 */
            }
            return(childItems);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            _CategoryCount = CategoryDataSource.CountAll();
            StoreSettingsManager settings = AbleContext.Current.Store.Settings;
            bool displayCategorySearch    = settings.CategorySearchDisplayLimit > 0 && _CategoryCount >= settings.CategorySearchDisplayLimit;


            if (!Page.IsPostBack && !displayCategorySearch)
            {
                InitializeCategoryTree();
                SelectCategoryLabel.Visible = true;
                EnterCategoryLabel.Visible  = false;
            }
            else if (displayCategorySearch)
            {
                // DISPLAY AUTO COMPLETE FOR CATEGORY SEARCH OPTION
                string js = PageHelper.GetAutoCompleteScript(Page.ResolveClientUrl("~/CategorySuggest.ashx"), CategoryAutoComplete, HiddenSelectedCategoryId, "Key", "Value");

                ScriptManager.RegisterStartupScript(SearchAjax, this.GetType(), "CATEGORY_SUGGEST", js, true);
                CategoryAutoComplete.Visible = true;
                CategoryList.Visible         = false;
                SelectCategoryLabel.Visible  = false;
                EnterCategoryLabel.Visible   = true;
            }
            AbleCommerce.Code.PageHelper.SetDefaultButton(Keywords, SearchButton.ClientID);
            AbleCommerce.Code.PageHelper.SetDefaultButton(LowPrice, SearchButton.ClientID);
            AbleCommerce.Code.PageHelper.SetDefaultButton(HighPrice, SearchButton.ClientID);

            int minLength = AbleContext.Current.Store.Settings.MinimumSearchLength;

            KeywordValidator.MinimumLength = minLength;
            KeywordValidator.ErrorMessage  = String.Format(KeywordValidator.ErrorMessage, minLength);
        }
        protected void CGrid_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "DeleteItem")
            {
                if (CGrid.DataSourceID == "ProductsDs")
                {
                    int     productId = AlwaysConvert.ToInt(e.CommandArgument);
                    Product product   = ProductDataSource.Load(productId);
                    if (product != null)
                    {
                        product.Delete();
                    }
                }
                else if (CGrid.DataSourceID == "LinkDs")
                {
                    int  linkId = AlwaysConvert.ToInt(e.CommandArgument);
                    Link link   = LinkDataSource.Load(linkId);
                    if (link != null)
                    {
                        link.Delete();
                    }
                }
                else if (CGrid.DataSourceID == "CategoryDs")
                {
                    int      cId = AlwaysConvert.ToInt(e.CommandArgument);
                    Category cat = CategoryDataSource.Load(cId);
                    if (cat != null)
                    {
                        cat.Delete();
                    }
                }

                CGrid.DataBind();
            }
        }
        protected String GetCatsList(object product)
        {
            Product       p      = (Product)product;
            StringBuilder output = new StringBuilder();

            foreach (int categoryId in p.Categories)
            {
                Category category = CategoryDataSource.Load(categoryId);
                if (category != null)
                {
                    output.Append("<a href=\"" + Page.ResolveUrl(category.NavigateUrl) + "\" >" + category.Name + "</a>, ");
                }
            }

            // REMOVE LAST COMMA
            String retValue = output.ToString();

            if (!String.IsNullOrEmpty(retValue))
            {
                return(retValue.Substring(0, retValue.Length - 2));
            }
            else
            {
                return(retValue);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            _ProductId = AbleCommerce.Code.PageHelper.GetProductId();
            _Product   = ProductDataSource.Load(_ProductId);
            _settings  = AbleContext.Current.Store.Settings;
            _user      = AbleContext.Current.User;
            if (_Product != null)
            {
                ProductName.Text = _Product.Name;

                CategoryBreadCrumbs1.Visible = DisplayBreadCrumbs;

                //if (_Product.Manufacturer != null)
                //{
                //    Manufacturer manufacturer = _Product.Manufacturer;
                //    ManufacturerDetails.Controls.Add(new LiteralControl("Other products by "));
                //    ManufacturerDetails.Controls.Add(new LiteralControl(string.Format("<a href='{0}?m={1}' itemprop='manufacturer'>{2}</a><br />", Page.ResolveUrl("~/Search.aspx"), manufacturer.Id, manufacturer.Name)));
                //}

                // update moreitems tab text with category name
                int      categoryId = PageHelper.GetCategoryId();
                Category category   = CategoryDataSource.Load(categoryId);
                if (category != null)
                {
                    MoreItemsTabText.Text = string.Format(MoreItemsTabText.Text, category.Name);
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            int      _CategoryId = AbleCommerce.Code.PageHelper.GetCategoryId();
            Category _Category   = CategoryDataSource.Load(_CategoryId);

            if (_Category != null)
            {
                //GET FEATURED PRODUCTS IN CATEGORY
                IList <Product> featured = ProductDataSource.GetFeaturedProducts(_CategoryId, true, IncludeOutOfStockItems, _MaxItems, 0);
                //MAKE SURE WE HAVE SOMETHING TO SHOW
                if (featured.Count > 0)
                {
                    //SET CAPTION
                    phCaption.Text = this.Caption;
                    //BIND THE PRODUCTS
                    ProductList.RepeatColumns = this.Columns;
                    ProductList.DataSource    = featured;
                    ProductList.DataBind();
                }
                else
                {
                    //THERE ARE NOT ANY ITEMS TO DISPLAY
                    phContent.Visible = false;
                }
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     _CategoryId   = AbleCommerce.Code.PageHelper.GetCategoryId();
     _Category     = CategoryDataSource.Load(_CategoryId);
     _CatalogNodes = CatalogDataSource.LoadForCategory(_CategoryId, false);
     if (_CatalogNodes != null && _CatalogNodes.Count > 0)
     {
         if (_Category == null)
         {
             Caption.Text += " Sort Items in Root Category";
         }
         else
         {
             Caption.Text += " Sort Items in " + _Category.Name;
         }
         if (!Page.IsPostBack)
         {
             BindCatalogNodesList();
         }
     }
     else
     {
         Response.Redirect("Browse.aspx");
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            int categoryCount             = CategoryDataSource.CountAll();
            StoreSettingsManager settings = AbleContext.Current.Store.Settings;

            _DisplayCategorySearch = settings.CategorySearchDisplayLimit > 0 && categoryCount >= settings.CategorySearchDisplayLimit;

            if (!Page.IsPostBack)
            {
                InitializeCategoryTree();
                LoadSearchFilter();
            }

            if (_DisplayCategorySearch)
            {
                // DISPLAY AUTO COMPLETE FOR CATEGORY SEARCH OPTION
                string js = PageHelper.GetAutoCompleteScript("../../CategorySuggest.ashx", CategoryAutoComplete, HiddenSelectedCategoryId, "Key", "Value");
                js += PageHelper.GetAutoCompleteScript("../../CategorySuggest.ashx", NewProductCategory, HiddenNewProductCategoryId, "Key", "Value");

                ScriptManager.RegisterStartupScript(PageAjax, this.GetType(), "CATEGORY_SUGGEST", js, true);
                CategoryAutoComplete.Visible = true;
                CategoriesList.Visible       = false;

                CategoryDropDown.Visible   = false;
                NewProductCategory.Visible = true;
            }
        }
 protected void Page_Init(object sender, System.EventArgs e)
 {
     Trace.Write(this.GetType().ToString(), "Load Begin");
     _category = CategoryDataSource.Load(this.CategoryId);
     //EXIT PROCESSING IF CATEGORY IS INVALID OR MARKED PRIVATE
     if (!IsValidCategory())
     {
         SearchResultsAjaxPanel.Visible = false;
     }
     else
     {
         if (_category != null)
         {
             //REGISTER THE PAGEVISIT
             AbleCommerce.Code.PageVisitHelper.RegisterPageVisit(_category.Id, CatalogNodeType.Category, _category.Name);
         }
         if (!Page.IsPostBack)
         {
             //INITIALIZE SEARCH CRITERIA ON FIRST VISIT
             HiddenPageIndex.Value = Request.QueryString["p"];
             string tempSort = Request.QueryString["s"];
             if (!string.IsNullOrEmpty(tempSort))
             {
                 ListItem item = SortResults.Items.OfType <ListItem>().SingleOrDefault(x => string.Compare(x.Value, tempSort, StringComparison.InvariantCultureIgnoreCase) == 0);
                 if (item != null)
                 {
                     item.Selected = true;
                 }
             }
         }
         Trace.Write(this.GetType().ToString(), "Load Complete");
     }
 }
Beispiel #12
0
 protected void SendEmailButton_Click(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         if ((!trCaptchaImage.Visible) || CaptchaImage.Authenticate(CaptchaInput.Text))
         {
             int     productId = AbleCommerce.Code.PageHelper.GetProductId();
             Product product   = ProductDataSource.Load(productId);
             if (product != null)
             {
                 int           categoryId = AbleCommerce.Code.PageHelper.GetCategoryId();
                 Category      category   = CategoryDataSource.Load(categoryId);
                 EmailTemplate template   = EmailTemplateDataSource.Load(AbleContext.Current.Store.Settings.ProductTellAFriendEmailTemplateId);
                 if (template != null)
                 {
                     //STRIP HTML
                     Name.Text        = StringHelper.StripHtml(Name.Text);
                     FromEmail.Text   = StringHelper.StripHtml(FromEmail.Text);
                     FriendEmail.Text = StringHelper.StripHtml(FriendEmail.Text);
                     // ADD PARAMETERS
                     template.Parameters["store"]     = AbleContext.Current.Store;
                     template.Parameters["product"]   = product;
                     template.Parameters["category"]  = category;
                     template.Parameters["fromEmail"] = FromEmail.Text;
                     template.Parameters["fromName"]  = Name.Text;
                     template.FromAddress             = FromEmail.Text;
                     template.ToAddress = FriendEmail.Text;
                     template.Send();
                     FriendEmail.Text           = string.Empty;
                     SentMessage.Visible        = true;
                     CaptchaInput.Text          = "";
                     CaptchaImage.ChallengeText = StringHelper.RandomNumber(6);
                 }
                 else
                 {
                     FailureMessage.Text    = "Email template could not be loaded.";
                     FailureMessage.Visible = true;
                 }
             }
             else
             {
                 FailureMessage.Text    = "Product could not be identified.";
                 FailureMessage.Visible = true;
             }
         }
         else
         {
             //CAPTCHA IS VISIBLE AND DID NOT AUTHENTICATE
             CustomValidator invalidInput = new CustomValidator();
             invalidInput.ValidationGroup = "TellAFriend";
             invalidInput.Text            = "*";
             invalidInput.ErrorMessage    = "You did not input the verification number correctly.";
             invalidInput.IsValid         = false;
             phCaptchaValidators.Controls.Add(invalidInput);
             CaptchaInput.Text          = "";
             CaptchaImage.ChallengeText = StringHelper.RandomNumber(6);
         }
     }
 }
Beispiel #13
0
 protected bool HasChildCategories(Category cat)
 {
     if (cat == null)
     {
         return(false);
     }
     return(CategoryDataSource.CountForParent(cat.Id, true) > 0);
 }
        protected void Page_Init(object sender, EventArgs e)
        {
            _IconPath = AbleCommerce.Code.PageHelper.GetAdminThemeIconPath(this.Page);

            int categoryCount             = CategoryDataSource.CountAll();
            StoreSettingsManager settings = AbleContext.Current.Store.Settings;

            _DisplayCategorySearch = settings.CategorySearchDisplayLimit > 0 && categoryCount >= settings.CategorySearchDisplayLimit;
        }
        protected void Page_Init(object sender, EventArgs e)
        {
            //INITIALIZE VARIABLES
            _CategoryId = AbleCommerce.Code.PageHelper.GetCategoryId();
            _Category   = CategoryDataSource.Load(_CategoryId);
            _ProductId  = AlwaysConvert.ToInt(Request.QueryString["ProductId"]);
            _Product    = ProductDataSource.Load(_ProductId);
            if (_Product == null)
            {
                Response.Redirect(AbleCommerce.Code.NavigationHelper.GetAdminUrl("Catalog/Browse.aspx?CategoryId=" + _CategoryId.ToString()));
            }
            _KitComponentId = AlwaysConvert.ToInt(Request.QueryString["KitComponentId"]);
            _KitComponent   = KitComponentDataSource.Load(_KitComponentId);
            if (_KitComponent == null)
            {
                Response.Redirect("EditKit.aspx?CategoryId=" + _CategoryId.ToString() + "&ProductId=" + _ProductId.ToString());
            }
            CancelLink.NavigateUrl += "?CategoryId=" + _CategoryId.ToString() + "&ProductId=" + _ProductId.ToString();
            Caption.Text            = string.Format(Caption.Text, _KitComponent.Name);
            InstructionText.Text    = string.Format(InstructionText.Text, _KitComponent.Name, _Product.Name);

            int categoryCount             = CategoryDataSource.CountAll();
            StoreSettingsManager settings = AbleContext.Current.Store.Settings;

            _DisplayCategorySearch = settings.CategorySearchDisplayLimit > 0 && categoryCount >= settings.CategorySearchDisplayLimit;

            // INITIALIZE DROP DOWN LISTS
            if (!_DisplayCategorySearch)
            {
                InitializeCategoryTree();
            }
            else
            {
                // DISPLAY AUTO COMPLETE FOR CATEGORY SEARCH OPTION
                string js = PageHelper.GetAutoCompleteScript(Page.ResolveClientUrl("~/CategorySuggest.ashx"), CategoryAutoComplete, HiddenSelectedCategoryId, "Key", "Value");

                ScriptManager.RegisterStartupScript(PageAjax, this.GetType(), "CATEGORY_SUGGEST", js, true);
                CategoryAutoComplete.Visible = true;
                CategoryFilter.Visible       = false;
            }
            ManufacturerFilter.DataSource = ManufacturerDataSource.LoadAll("Name");
            ManufacturerFilter.DataBind();
            VendorFilter.DataSource = VendorDataSource.LoadAll("Name");
            VendorFilter.DataBind();

            // LOAD CUSTOM VIEWSTATE VARIABLES
            LoadCustomViewState();
            if (_SelectedProducts.Count > 0)
            {
                // REBIND THE REPEATER
                BindSelectedProducts(_SelectedProducts);
            }

            AbleCommerce.Code.PageHelper.SetDefaultButton(NameFilter, SearchButton.ClientID);
            AbleCommerce.Code.PageHelper.SetDefaultButton(SkuFilter, SearchButton.ClientID);
        }
Beispiel #16
0
        private void BindCategory()
        {
            DisplayPage.DataBind();
            Category category  = CategoryDataSource.Load(PageHelper.GetCategoryId());
            int      webpageId = category.Webpage != null ? category.Webpage.Id : 0;

            SelectItem(DisplayPage, webpageId.ToString());
            EditItemLink.Text                 = category.Name;
            EditItemLink.NavigateUrl          = Page.ResolveUrl(string.Format("~/Admin/Catalog/EditCategory.aspx?CategoryId={0}", category.Id));
            MangeDisplayPagesLink.NavigateUrl = Page.ResolveUrl("~/Admin/Website/ContentPages/CategoryPages/Default.aspx");
        }
 protected void UpdateCategories()
 {
     // UPDATE CATEGORIES
     _VolumeDiscount.Categories.Clear();
     foreach (int categoryId in CategoryTree.SelectedCategories)
     {
         Category category = CategoryDataSource.Load(categoryId);
         _VolumeDiscount.Categories.Add(category);
     }
     _VolumeDiscount.Save();
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     _CategoryId = AbleCommerce.Code.PageHelper.GetCategoryId();
     _Category   = CategoryDataSource.Load(_CategoryId);
     _ProductId  = AlwaysConvert.ToInt(Request.QueryString["ProductId"]);
     _Product    = ProductDataSource.Load(_ProductId);
     if (_Product == null)
     {
         Response.Redirect(AbleCommerce.Code.NavigationHelper.GetAdminUrl("Catalog/Browse.aspx?CategoryId=" + _CategoryId.ToString()));
     }
     SearchResultsGrid.Visible = Page.IsPostBack;
 }
        protected void Page_PreRender(object sender, System.EventArgs e)
        {
            Trace.Write(this.GetType().ToString(), "Load Begin");
            _pageSize = AlwaysConvert.ToInt(PageSizeOptions.SelectedValue);
            if (_pageSize == 0)
            {
                _pageSize = ProductDataSource.AdvancedSearchCount(_keywords, this._categoryId, _manufacturerId, true, true, true, 0, 0, false, PageHelper.GetShopByChoices());
            }
            ProductList.RepeatColumns = Cols;
            _keywords = Server.UrlDecode(Request.QueryString["k"]);
            if (!string.IsNullOrEmpty(_keywords))
            {
                _keywords = StringHelper.StripHtml(_keywords).Trim();
            }
            _category = CategoryDataSource.Load(this._categoryId);

            //EXIT PROCESSING IF CATEGORY IS INVALID OR MARKED PRIVATE
            if (!IsValidCategory())
            {
                SearchResultsPanel.Visible = false;
            }
            else
            {
                if (_category != null)
                {
                    //REGISTER THE PAGEVISIT
                    AbleCommerce.Code.PageVisitHelper.RegisterPageVisit(_category.Id, CatalogNodeType.Category, _category.Name);
                }
                if (!Page.IsPostBack)
                {
                    //INITIALIZE SEARCH CRITERIA ON FIRST VISIT
                    HiddenPageIndex.Value = Request.QueryString["p"];
                    string tempSort = Request.QueryString["s"];
                    if (!string.IsNullOrEmpty(tempSort))
                    {
                        ListItem item = SortResults.Items.OfType <ListItem>().SingleOrDefault(x => string.Compare(x.Value, tempSort, StringComparison.InvariantCultureIgnoreCase) == 0);
                        if (item != null)
                        {
                            item.Selected = true;
                        }
                    }
                }

                SetPagerIndex();
            }

            if (IsValidCategory())
            {
                //BIND PAGE
                BindPage();
            }
        }
 private string GetCategoryName(OrderItem item)
 {
     if (item.Product != null && item.Product.Categories.Count > 0)
     {
         int      categoryId = item.Product.Categories[0];
         Category category   = CategoryDataSource.Load(categoryId);
         if (category != null)
         {
             return(SanitizeInput(category.Name));
         }
     }
     return(string.Empty);
 }
Beispiel #21
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(CssClass))
            {
                MainPanel.CssClass = CssClass;
            }
            if (!string.IsNullOrEmpty(HeaderCssClass))
            {
                HeaderPanel.CssClass = HeaderCssClass;
            }
            if (!string.IsNullOrEmpty(HeaderText))
            {
                HeaderTextLabel.Text = HeaderText;
            }
            HeaderPanel.Visible = ShowHeader;
            if (_CategoryId < 0)
            {
                _CategoryId = AbleCommerce.Code.PageHelper.GetCategoryId();
            }
            if (_CategoryId != 0)
            {
                Category cat = CategoryDataSource.Load(_CategoryId);
                if (cat != null)
                {
                    HeaderTextLabel.Text = cat.Name;
                }
            }
            IList <Category> subCategories = GetSubcategories(_CategoryId);

            IList <AccordionCategory> acCategories = new List <AccordionCategory>();

            foreach (Category cat in subCategories)
            {
                AccordionCategory item = new AccordionCategory();
                item.Id            = cat.Id;
                item.Name          = cat.Name;
                item.NavigateUrl   = cat.NavigateUrl;
                item.SubCategories = GetSubcategories(cat.Id);
                acCategories.Add(item);
            }

            if (acCategories.Count == 0)
            {
                this.Controls.Clear();
            }
            else
            {
                CategoryAccordian.DataSource = acCategories;
                CategoryAccordian.DataBind();
            }
        }
 protected void Page_Init(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         IList <Category> categories = CategoryDataSource.LoadForParent(0, false);
         foreach (Category category in categories)
         {
             TreeNode node = new TreeNode(category.Name, category.Id.ToString());
             node.PopulateOnDemand = true;
             node.SelectAction     = TreeNodeSelectAction.SelectExpand;
             t.Nodes.Add(node);
         }
     }
 }
Beispiel #23
0
        protected void Update_Click(object sender, EventArgs e)
        {
            List <Object> dataKeys = CategoriesGrid.GetSelectedDataKeyValues();

            foreach (Object dataKey in dataKeys)
            {
                int      categoryId = AlwaysConvert.ToInt(dataKey);
                Category category   = CategoryDataSource.Load(categoryId);
                category.Webpage = WebpageDataSource.Load(AlwaysConvert.ToInt(CategoryDisplayPages.SelectedValue));
                category.Save();
            }

            CategoriesGrid.DataBind();
        }
 protected void Page_Init(object sender, EventArgs e)
 {
     //INITIALIZE VARIABLES
     _CategoryId = AbleCommerce.Code.PageHelper.GetCategoryId();
     _Category = CategoryDataSource.Load(_CategoryId);
     _ProductId = AlwaysConvert.ToInt(Request.QueryString["ProductId"]);
     _Product = ProductDataSource.Load(_ProductId);
     if (_Product == null) Response.Redirect(AbleCommerce.Code.NavigationHelper.GetAdminUrl("Catalog/Browse.aspx"));
     _KitComponentId = AlwaysConvert.ToInt(Request.QueryString["KitComponentId"]);
     _KitComponent = KitComponentDataSource.Load(_KitComponentId);
     if (_KitComponent == null) Response.Redirect("EditKit.aspx?CategoryId=" + _CategoryId.ToString() + "&ProductId=" + _ProductId.ToString());
     //INITIALIZE PAGE ELEMENTS
     Caption.Text = string.Format(Caption.Text, _KitComponent.Name);
     BindKitList();
 }
        private void CategoryRedir()
        {
            int categoryId = AlwaysConvert.ToInt(CategoryList.SelectedValue);

            if (categoryId == 0)
            {
                Response.Redirect(AbleCommerce.Code.NavigationHelper.GetHomeUrl());
            }
            Category category = CategoryDataSource.Load(categoryId);

            if (category != null)
            {
                Response.Redirect(category.NavigateUrl);
            }
        }
Beispiel #26
0
        private string GenerateMenu(int parentCategoryId, int level)
        {
            StringBuilder    sb         = new StringBuilder();
            bool             menuOpened = false;
            IList <Category> categories = CategoryDataSource.LoadForParent(parentCategoryId, true);

            foreach (Category category in categories)
            {
                string title  = category.Name;
                string url    = category.NavigateUrl;
                string target = string.Empty;
                if (!menuOpened)
                {
                    if (level == 1)
                    {
                        sb.Append("<ul id=\"menu\">");
                    }
                    else
                    {
                        sb.Append("<ul>");
                    }
                    menuOpened = true;
                }
                sb.Append("<li>");
                if (!string.IsNullOrEmpty(url))
                {
                    url = Page.ResolveUrl(url);
                }
                else
                {
                    url = "#";
                }
                sb.Append("<a href=\"" + url + "\"");
                if (!string.IsNullOrEmpty(target))
                {
                    sb.Append("target=\"" + target + "\"");
                }
                sb.Append(">");
                sb.Append(title);
                sb.Append("</a>");
                sb.Append(GenerateMenu(category.Id, level + 1));
            }
            if (menuOpened)
            {
                sb.Append("</ul>");
            }
            return(sb.ToString());
        }
Beispiel #27
0
 protected void Page_Init(object sender, EventArgs e)
 {
     _CategoryId = AbleCommerce.Code.PageHelper.GetCategoryId();
     _Category   = CategoryDataSource.Load(_CategoryId);
     _ProductId  = AlwaysConvert.ToInt(Request.QueryString["ProductId"]);
     _Product    = ProductDataSource.Load(_ProductId);
     if (_Product == null)
     {
         Response.Redirect("~/Admin/Catalog/Browse.aspx?CategoryId=" + _CategoryId.ToString());
     }
     _VariantManager = new ProductVariantManager(_ProductId);
     //BIND GOODS FOR PRODUCT
     BindDigitalGoodsGrid();
     //UPDATE ATTACH BUTTON
     AllVariants.NavigateUrl += _ProductId.ToString();
     //FIGURE OUT PAGING SETTINGS
     _VariantCount = _VariantManager.CountVariantGrid();
     if (_VariantCount > 0)
     {
         _WholePages    = _VariantCount / _PageSize;
         _LeftOverItems = _VariantCount % _PageSize;
         if (_LeftOverItems > 0)
         {
             _TotalPages = _WholePages + 1;
         }
         else
         {
             _TotalPages = _WholePages;
         }
         if (_TotalPages == 1)
         {
             VariantPager.Visible = false;
         }
         //LOAD VIEW STATE
         LoadCustomViewState();
         //SAVE THIS TEXT FOR LATER
         _DisplayRangeLabelText = DisplayRangeLabel.Text;
         //INITIALIZE THE GRID
         BindVariantGrid();
     }
     else
     {
         VariantGoodsPanel.Visible = false;
     }
     //UPDATE THE CAPTION
     Caption.Text = string.Format(Caption.Text, _Product.Name);
 }
Beispiel #28
0
        public static void FindCatalogable(out ICatalogable catalogable, out CatalogNodeType catalogableType)
        {
            HttpContext context = HttpContext.Current;

            if (context != null)
            {
                //CHECK FOR LINK
                int  linkId = AbleCommerce.Code.PageHelper.GetLinkId();
                Link link   = LinkDataSource.Load(linkId);
                if (link != null)
                {
                    catalogable     = link;
                    catalogableType = CatalogNodeType.Link;
                    return;
                }
                //CHECK FOR WEBPAGE
                int     webpageId = AbleCommerce.Code.PageHelper.GetWebpageId();
                Webpage webpage   = WebpageDataSource.Load(webpageId);
                if (webpage != null)
                {
                    catalogable     = webpage;
                    catalogableType = CatalogNodeType.Webpage;
                    return;
                }
                //CHECK FOR PRODUCT
                int     productId = AbleCommerce.Code.PageHelper.GetProductId();
                Product product   = ProductDataSource.Load(productId);
                if (product != null)
                {
                    catalogable     = product;
                    catalogableType = CatalogNodeType.Product;
                    return;
                }
                //CHECK FOR CATEGORY
                int      categoryId = AlwaysConvert.ToInt(context.Request.QueryString["CategoryId"]);
                Category category   = CategoryDataSource.Load(categoryId);
                if (category != null)
                {
                    catalogable     = category;
                    catalogableType = CatalogNodeType.Category;
                    return;
                }
            }
            catalogable     = null;
            catalogableType = CatalogNodeType.Category;
            return;
        }
Beispiel #29
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            _ParentCategoryId = AlwaysConvert.ToInt(Request.QueryString["ParentCategoryId"]);
            if (_ParentCategoryId != 0)
            {
                _ParentCategory = CategoryDataSource.Load(_ParentCategoryId);
            }
            else
            {
                _ParentCategory      = new Category();
                _ParentCategory.Name = "Catalog";
            }
            if (!Page.IsPostBack)
            {
                Caption.Text             = string.Format(Caption.Text, _ParentCategory.Name);
                Visibility.SelectedIndex = 0;
                Name.Focus();
                BindDisplayPage();
                UpdateDescription();
            }
            AbleCommerce.Code.PageHelper.ConvertEnterToTab(Name);
            AbleCommerce.Code.PageHelper.ConvertEnterToTab(Visibility);
            AbleCommerce.Code.PageHelper.DisableValidationScrolling(this);
            MetaKeywordsCharCount.Text = ((int)(MetaKeywordsValue.MaxLength - MetaKeywordsValue.Text.Length)).ToString();
            AbleCommerce.Code.PageHelper.SetMaxLengthCountDown(MetaKeywordsValue, MetaKeywordsCharCount);
            MetaDescriptionCharCount.Text = ((int)(MetaDescriptionValue.MaxLength - MetaDescriptionValue.Text.Length)).ToString();
            AbleCommerce.Code.PageHelper.SetMaxLengthCountDown(MetaDescriptionValue, MetaDescriptionCharCount);

            if (!AbleContext.Current.Store.Settings.EnableWysiwygEditor)
            {
                AbleCommerce.Code.PageHelper.SetHtmlEditor(Summary, SummaryHtmlButton);
            }
            else
            {
                SummaryHtmlButton.Visible = false;
            }

            if (!AbleContext.Current.Store.Settings.EnableWysiwygEditor)
            {
                AbleCommerce.Code.PageHelper.SetHtmlEditor(Description, DescriptionHtmlButton);
            }
            else
            {
                DescriptionHtmlButton.Visible = false;
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     _CategoryId = AbleCommerce.Code.PageHelper.GetCategoryId();
     _Category   = CategoryDataSource.Load(_CategoryId);
     _ProductId  = AlwaysConvert.ToInt(Request.QueryString["ProductId"]);
     _Product    = ProductDataSource.Load(_ProductId);
     if (_Product == null)
     {
         Response.Redirect(AbleCommerce.Code.NavigationHelper.GetAdminUrl("Catalog/Browse.aspx?CategoryId=" + _CategoryId.ToString()));
     }
     Caption.Text = string.Format(Caption.Text, _Product.Name);
     if (!Page.IsPostBack)
     {
         BindComponentList();
     }
     this.Page.ClientScript.RegisterClientScriptInclude(this.GetType(), "selectbox", this.ResolveUrl("~/Scripts/selectbox.js"));
 }