Esempio n. 1
0
 private bool IsValidCategory()
 {
     // IF IT IS ROOT CATEGORY
     if (this.CategoryId == 0) return true;
     else
     {
         // TRY TO LOAD THE CATEGORY AGAIN
         if (_Category == null) _Category = CategoryDataSource.Load(this.CategoryId);
         if (_Category != null && _Category.Visibility != CatalogVisibility.Private) return true;
         else return false;
     }
 }
Esempio n. 2
0
 void ProcessSidebarEvent(object sender, EventArgs e)
 {
     ISearchSidebar searchSidebar = (ISearchSidebar)sender;
     if (searchSidebar == null) return;
     this.CategoryId = searchSidebar.CategoryId;
     _Category = CategoryDataSource.Load(this.CategoryId);
     _ManufacturerId = searchSidebar.ManufacturerId;
     _Keywords = searchSidebar.Keyword;
     HiddenPageIndex.Value = "0";
     InitializePagingVars(true);
 }
Esempio n. 3
0
    protected void Page_Load(object sender, System.EventArgs e)
    {
        Trace.Write(this.GetType().ToString(), "Load Begin");
        _PageSize = (_Cols * _Rows);
        _Category = CategoryDataSource.Load(this.CategoryId);
        //EXIT PROCESSING IF CATEGORY IS INVALID OR MARKED PRIVATE
        if (!IsValidCategory())
        {
            SearchResultsAjaxPanel.Visible = false;
        }
        else
        {
            if (!Page.IsPostBack)
            {
                //REGISTER THE PAGEVIEW
                CommerceBuilder.Reporting.PageView.RegisterCatalogNode(this.CategoryId, CatalogNodeType.Category);
                //INITIALIZE SEARCH CRITERIA ON FIRST VISIT
                HiddenPageIndex.Value = Request.QueryString["p"];
                string tempSort = Request.QueryString["s"];
                if (!string.IsNullOrEmpty(tempSort))
                {
                    ListItem item = SortResults.Items.FindByValue(tempSort);
                    if (item != null) item.Selected = true;
                }
            }
            //LOOK FOR A SIDEBAR CONTROL TO LINK TO THIS SEARCH PAGE
            Trace.Write(this.GetType().ToString(), "Locating Sidebar");
            _SearchSidebar = (ISearchSidebar)PageHelper.FindSearchSidebarControl(this.Page);
            if (_SearchSidebar != null)
            {
                _SearchSidebar.SubscribeSidebarUpdated(new EventHandler(ProcessSidebarEvent));
                //LOAD VALUES FROM
                if (!Page.IsPostBack) _SearchSidebar.CategoryId = this.CategoryId;
                _Keywords = _SearchSidebar.Keyword;
                _ManufacturerId = _SearchSidebar.ManufacturerId;
            }
            SetPagerIndex();
        }

        if (IsValidCategory())
        {
            //BIND PAGE
            BindPage();
        }
    }