コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            _ProductId = AlwaysConvert.ToInt(Request.QueryString["ProductId"]);
            _Product   = ProductDataSource.Load(_ProductId);
            if (_Product == null)
            {
                Response.Redirect(AbleCommerce.Code.NavigationHelper.GetAdminUrl("Catalog/Browse.aspx"));
            }
            Caption.Text     = string.Format(Caption.Text, _Product.Name);
            ProductName.Text = _Product.Name;
            ValidFiles.Text  = AbleContext.Current.Store.Settings.FileExt_Assets;
            if (string.IsNullOrEmpty(ValidFiles.Text))
            {
                ValidFiles.Text = "any";
            }
            trSku.Visible = !string.IsNullOrEmpty(_Product.Sku);
            if (trSku.Visible)
            {
                Sku.Text = _Product.Sku;
            }
            if (!Page.IsPostBack)
            {
                StoreSettingsManager settings = AbleContext.Current.Store.Settings;
                CustomWidth.Text  = settings.StandardImageWidth.ToString();
                CustomHeight.Text = settings.StandardImageHeight.ToString();
            }

            FileDataMaxSize.Text = String.Format(FileDataMaxSize.Text, AbleContext.Current.Store.Settings.MaxRequestLength);
        }
コード例 #2
0
        protected void Page_Init(object sender, EventArgs e)
        {
            _ProductId = AlwaysConvert.ToInt(Request.QueryString["ProductId"]);
            string optionList = EncryptionHelper.DecryptAES(Request.QueryString["Options"]);

            _OptionList = ProductVariantManager.ValidateOptionList(optionList);
            _Product    = ProductDataSource.Load(_ProductId);
            string productName = _Product.Name;

            _VariantManager = new ProductVariantManager(_ProductId);
            ProductVariant v = _VariantManager.GetVariantFromOptions(_OptionList);

            if (v != null)
            {
                productName = _Product.Name + " (" + v.VariantName + ")";
            }
            else
            {
                _OptionList = string.Empty;
            }
            Caption.Text             = string.Format(Caption.Text, productName);
            CancelButton.NavigateUrl = "DigitalGoods.aspx?ProductId=" + _ProductId.ToString();
            if (!Page.IsPostBack)
            {
                SearchResultsGrid.Visible = false;
            }
        }
コード例 #3
0
        protected void Page_Init(object sender, EventArgs e)
        {
            _ProductId = AlwaysConvert.ToInt(Request.QueryString["ProductId"]);
            _Product   = ProductDataSource.Load(_ProductId);
            if (_Product != null)
            {
                if (_Product.VolumeDiscounts.Count > 0)
                {
                    _VolumeDiscountId = _Product.VolumeDiscounts[0].Id;
                    _VolumeDiscount   = _Product.VolumeDiscounts[0];
                    _IsAdd            = false;
                }
                else
                {
                    _IsAdd               = true;
                    _VolumeDiscount      = new VolumeDiscount();
                    _VolumeDiscount.Name = _Product.Name;
                    _VolumeDiscount.Products.Add(_Product);
                    _VolumeDiscount.Save();
                    _VolumeDiscountId = _VolumeDiscount.Id;
                    VolumeDiscountLevel newDiscountLevel = new VolumeDiscountLevel();
                    _VolumeDiscount.Levels.Add(newDiscountLevel);
                }

                DiscountLevelGrid.DataSource = _VolumeDiscount.Levels;
                DiscountLevelGrid.DataBind();
            }
        }
コード例 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // LOCATE THE USER THAT THE ORDER IS BEING PLACED FOR
            _UserId = AlwaysConvert.ToInt(Request.QueryString["UID"]);
            _User   = UserDataSource.Load(_UserId);
            if (_User == null)
            {
                Response.Redirect("CreateOrder1.aspx");
            }
            _Basket = _User.Basket;

            // INITIALIZE INVENTORY VARIABLES
            _InventoryManager      = AbleContext.Resolve <IInventoryManager>();
            _StoreInventoryEnabled = AbleContext.Current.Store.Settings.EnableInventory;

            // SHOW QUANTITY AVAILABLE COLUMN IF INVENTORY IS ENABLED
            BasketGrid.Columns[4].Visible = _StoreInventoryEnabled;

            // INITIALIZE THE CAPTION
            string userName = _User.IsAnonymous ? "Unregistered User" : _User.UserName;

            Caption.Text = string.Format(Caption.Text, userName);

            // SEE IF THE ADD PRODUCT FORM SHOULD BE VISIBLE
            int     productId = AlwaysConvert.ToInt(Request.Form[AddProductId.UniqueID]);
            Product product   = ProductDataSource.Load(productId);

            if (product != null)
            {
                ShowProductForm(product);
            }
        }
コード例 #5
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            if (this.Visible)
            {
                int     _ProductId = AlwaysConvert.ToInt(Request.QueryString["ProductId"]);
                Product _Product   = ProductDataSource.Load(_ProductId);
                if (_Product != null)
                {
                    List <ProductTemplateField> templateFields = (from tf in _Product.TemplateFields
                                                                  where !string.IsNullOrEmpty(tf.InputValue) && tf.InputField.IsMerchantField
                                                                  select tf).OrderBy(x => x.InputField.OrderBy).ToList();

                    ProductTemplateFieldsList.DataSource = templateFields;
                    ProductTemplateFieldsList.DataBind();

                    //List<ProductCustomField> customFields = (from cf in _Product.CustomFields
                    //                                         where !string.IsNullOrEmpty(cf.FieldValue)
                    //                                         select cf).ToList();

                    //ProductCustomFieldsList.DataSource = customFields;
                    //ProductCustomFieldsList.DataBind();

                    this.Visible = (templateFields.Count > 0 /*|| customFields.Count > 0*/);
                }
            }
        }
コード例 #6
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            int     _ProductId = AlwaysConvert.ToInt(Request.QueryString["ProductId"]);
            Product _Product   = ProductDataSource.Load(_ProductId);

            if (_Product != null)
            {
                ProductName.Text = _Product.Name;
                if (AbleContext.Current.Store.Settings.MobileStoreProductUseSummary)
                {
                    phDescription.Text = _Product.Description;
                }
                else
                {
                    MainDescription.Visible = false;
                }

                if (string.IsNullOrEmpty(_Product.ExtendedDescription))
                {
                    DetailedDescription.Visible = false;
                }
                else
                {
                    DetailedDescription.Visible = true;
                    extDescription.Text         = _Product.ExtendedDescription;
                }
            }
        }
コード例 #7
0
        /// <summary>
        /// Load this Kit object from the database for the given primary key.
        /// </summary>
        /// <param name="productId">Value of ProductId of the object to load.</param>
        /// <returns><b>true</b> if load is successful, <b>false</b> otherwise</returns>
        public virtual bool Load(Int32 productId)
        {
            if (productId < 1)
            {
                throw new ArgumentException("productId", "productId must be greater than 0");
            }
            _Product = ProductDataSource.Load(productId);
            if (_Product == null)
            {
                throw new InvalidProductException("The productId specified is invalid.");
            }
            _ProductId = productId;
            //CREATE THE DYNAMIC SQL TO LOAD OBJECT
            StringBuilder selectQuery = new StringBuilder();

            selectQuery.Append("SELECT " + GetColumnNames(string.Empty));
            selectQuery.Append(" FROM ac_Kits");
            selectQuery.Append(" WHERE ProductId = @productId");
            Database  database      = Token.Instance.Database;
            DbCommand selectCommand = database.GetSqlStringCommand(selectQuery.ToString());

            database.AddInParameter(selectCommand, "@productId", System.Data.DbType.Int32, productId);
            //EXECUTE THE COMMAND
            using (IDataReader dr = database.ExecuteReader(selectCommand))
            {
                if (dr.Read())
                {
                    LoadDataReader(this, dr);;
                }
                dr.Close();
            }
            return(true);
        }
コード例 #8
0
        protected void Page_Init(object sender, EventArgs e)
        {
            if (Request.Browser.IsMobileDevice)
            {
                _largeImageMaxDimension = 300;
            }
            int     productId = AbleCommerce.Code.PageHelper.GetProductId();
            Product product   = ProductDataSource.Load(productId);

            if (product != null)
            {
                this.Page.Title          = "Images of " + product.Name;
                this.GalleryCaption.Text = string.Format(this.GalleryCaption.Text, product.Name);

                List <ProductImage> images = (from i in product.Images select i)
                                             .ToList <ProductImage>();

                if (!string.IsNullOrEmpty(product.ImageUrl))
                {
                    images.Insert(0, new ProductImage()
                    {
                        ImageUrl = product.ImageUrl, ImageAltText = product.ImageAltText
                    });
                }

                MoreImagesList.DataSource = images;
                MoreImagesList.DataBind();
            }
        }
コード例 #9
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            // REGISTER WARNING SCRIPTS IF THE PRODUCT HAS CUSTOMIZED VARIANTS
            string  warnScript;
            int     productId = AbleCommerce.Code.PageHelper.GetProductId();
            Product product   = ProductDataSource.Load(productId);

            if (product != null)
            {
                bool hasDigitalGoods = ProductVariantManager.HasDigitalGoodData(productId);
                if (hasDigitalGoods || product.KitStatus == KitStatus.Member)
                {
                    String delMesssage = String.Empty;
                    if (hasDigitalGoods)
                    {
                        delMesssage += "WARNING: If there are digital goods linked to variants with this choice, deleting the choice will unlink these digital goods.\\n\\n";
                    }
                    if (product.KitStatus == KitStatus.Member)
                    {
                        delMesssage += "WARNING: This product is part of one or more kit products.  Deleting this choice will remove any variants with this choice from those kit products.\\n\\n";
                    }

                    warnScript = "function confirmDel(){return confirm('" + delMesssage + "Are you sure you want to delete this choice?');}";
                }
                else
                {
                    warnScript = "function confirmDel(){return confirm('Are you sure you want to delete this choice?');}";
                }
                this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "checkVariant", warnScript, true);
            }
        }
コード例 #10
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            foreach (RepeaterItem ri in SelectedProductRepeater.Items)
            {
                HiddenField pid       = (HiddenField)ri.FindControl("PID");
                int         productId = AlwaysConvert.ToInt(pid.Value);
                Product     p         = ProductDataSource.Load(productId);
                if (p != null && p.ProductOptions.Count > 0)
                {
                    Dictionary <int, int> selectedOptions = GetSelectedOptions(ri.ItemIndex);
                    bool              allOptionsSelected  = (selectedOptions.Count == p.ProductOptions.Count);
                    string            optionList          = ProductVariantDataSource.GetOptionList(p.Id, selectedOptions, true);
                    ProductCalculator pcalc        = ProductCalculator.LoadForProduct(p.Id, 1, optionList, string.Empty);
                    Literal           productPrice = (Literal)ri.FindControl("ProductPrice");
                    productPrice.Text = pcalc.Price.LSCurrencyFormat("lc");
                    if (allOptionsSelected)
                    {
                        ProductVariant pv = ProductVariantDataSource.LoadForOptionList(p.Id, optionList);
                        if (pv != null && !pv.Available)
                        {
                            HtmlTableRow trInvalidVariant = (HtmlTableRow)ri.FindControl("trInvalidVariant");
                            if (trInvalidVariant != null)
                            {
                                trInvalidVariant.Visible = true;
                            }
                        }
                    }
                }
            }

            // SAVE THE CUSTOM VIEWSTATE
            SaveCustomViewState();
        }
コード例 #11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int     productId = AlwaysConvert.ToInt(Request.QueryString["ProductId"]);
            Product product   = ProductDataSource.Load(productId);

            if (product == null)
            {
                Response.Redirect("../../Catalog/Browse.aspx?CategoryId=" + AbleCommerce.Code.PageHelper.GetCategoryId());
            }
            Caption.Text = string.Format(Caption.Text, product.Name);

            // build list of kits
            List <KitMemberInfo> kitMemberships = new List <KitMemberInfo>();
            IList <KitComponent> components     = KitComponentDataSource.LoadForMemberProduct(productId);

            foreach (KitComponent component in components)
            {
                foreach (ProductKitComponent pkc in component.ProductKitComponents)
                {
                    kitMemberships.Add(new KitMemberInfo(pkc.ProductId, pkc.Product.Name, component.Name));
                }
            }
            kitMemberships.Sort(new KitMemberInfoComparer());
            KitMembershipList.DataSource = kitMemberships;
            KitMembershipList.DataBind();
        }
コード例 #12
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            Product product = ProductDataSource.Load(this.ProductId);

            if (product == null)
            {
                AC.Visible = false;
                MD.Visible = false;
            }
            else
            {
                if (AbleContext.Current.Store.Settings.ProductPurchasingDisabled ||
                    product.DisablePurchase ||
                    product.HasChoices ||
                    product.UseVariablePrice ||
                    product.IsSubscription ||
                    (product.InventoryMode == InventoryMode.Product && product.InStock <= 0))
                {
                    // cannot click to add the indicated item to the cart
                    AC.Visible     = false;
                    MD.Visible     = true;
                    MD.NavigateUrl = product.NavigateUrl;
                }
                else
                {
                    AC.ID      = "AddToCart_" + this.ProductId;
                    AC.Visible = true;
                    MD.Visible = false;
                }
            }
        }
コード例 #13
0
        protected void InventoryGrid_RowCommand(object sender, System.Web.UI.WebControls.GridViewCommandEventArgs e)
        {
            if (e.CommandName.StartsWith("Do_"))
            {
                switch (e.CommandName)
                {
                case "Do_Pub":
                    // TOGGLE VISIBILITY
                    int     productId = AlwaysConvert.ToInt(e.CommandArgument);
                    Product product   = ProductDataSource.Load(productId);
                    switch (product.Visibility)
                    {
                    case CatalogVisibility.Public:
                        product.Visibility = CatalogVisibility.Hidden;
                        break;

                    case CatalogVisibility.Hidden:
                        product.Visibility = CatalogVisibility.Private;
                        break;

                    default:
                        product.Visibility = CatalogVisibility.Public;
                        break;
                    }
                    product.Save();
                    InventoryGrid.DataBind();
                    break;
                }
            }
        }
コード例 #14
0
            private string GetInventoryMessage(string optionlist)
            {
                string message = string.Empty;
                Label  label   = new Label();

                if (!string.IsNullOrEmpty(optionlist) && showInventoryMessage)
                {
                    ProductVariant variant          = ProductVariantDataSource.LoadForOptionList(productId, optionlist);
                    Product        _Product         = ProductDataSource.Load(productId);
                    bool           inventoryEnabled = _Product.InventoryMode == InventoryMode.Variant && !_Product.AllowBackorder;
                    if (inventoryEnabled)
                    {
                        if (variant.InStock > 0)
                        {
                            string inStockformat  = AbleContext.Current.Store.Settings.InventoryInStockMessage;
                            string inStockMessage = string.Format(inStockformat, variant.InStock);
                            message = inStockMessage;
                        }
                        else if (!variant.Available || variant.InStock <= 0)
                        {
                            string outOfStockformat  = AbleContext.Current.Store.Settings.InventoryOutOfStockMessage;
                            string outOfStockMessage = string.Format(outOfStockformat, variant.InStock);
                            message = outOfStockMessage;

                            if (variant != null && variant.AvailabilityDate.HasValue && variant.AvailabilityDate >= LocaleHelper.LocalNow)
                            {
                                string availabilityMessageFormat = AbleContext.Current.Store.Settings.InventoryAvailabilityMessage;
                                string availabilityMessage       = string.Format(availabilityMessageFormat, variant.AvailabilityDate.Value.ToShortDateString());
                                message += availabilityMessage;
                            }
                        }
                    }
                }
                return(string.Format("<span class='errorCondition'>{0}</span>", message));
            }
コード例 #15
0
 protected void Page_Init(object sender, EventArgs e)
 {
     _ProductId            = AlwaysConvert.ToInt(Request.QueryString["ProductId"]);
     _Product              = ProductDataSource.Load(_ProductId);
     HiddenProductId.Value = _ProductId.ToString();
     if (_Product == null)
     {
         ProductCaption.Visible = false;
     }
     else
     {
         ProductCaption.Text = string.Format(ProductCaption.Text, _Product.Name);
     }
     if (!Page.IsPostBack)
     {
         //CHECK FOR SEARCH CACE
         SearchCache.SearchCriteria criteria = SearchCache.GetCriteria();
         if ((criteria != null) && (criteria.Arguments.ContainsKey("ShowApproved")))
         {
             ListItem item = ShowApproved.Items.FindByValue(criteria.Arguments["ShowApproved"].ToString());
             if (item != null)
             {
                 ShowApproved.SelectedIndex = ShowApproved.Items.IndexOf(item);
             }
             ReviewGrid.PageIndex             = criteria.PageIndex;
             ReviewGrid.DefaultSortDirection  = criteria.SortDirection;
             ReviewGrid.DefaultSortExpression = criteria.SortExpression;
         }
     }
 }
コード例 #16
0
        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();
            }
        }
コード例 #17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            _ProductReviewId = AlwaysConvert.ToInt(Request.QueryString["ReviewId"]);
            _ProductReview   = ProductReviewDataSource.Load(_ProductReviewId);

            if (_ProductReview != null)
            {
                _ProductId = _ProductReview.Product.Id;
            }
            else
            {
                _ProductId = AlwaysConvert.ToInt(Request.QueryString["ProductId"]);
            }
            _Product = ProductDataSource.Load(_ProductId);

            if (!Page.IsPostBack)
            {
                InitializeForm();
            }

            //INIT ReviewBody COUNTDOWN
            AbleCommerce.Code.PageHelper.SetMaxLengthCountDown(ReviewBody, ReviewMessageCharCount);
            ReviewMessageCharCount.Text = ((int)(ReviewBody.MaxLength - ReviewBody.Text.Length)).ToString();

            if (AbleContext.Current.Store.Settings.ProductReviewTermsAndConditions != string.Empty)
            {
                ReviewTermsLink.Visible     = true;
                ReviewTermsLink.NavigateUrl = NavigationHelper.GetMobileStoreUrl(string.Format("~/ReviewTerms.aspx?ProductId={0}", _Product.Id));
            }
            else
            {
                ReviewTermsLink.Visible   = false;
                reviewInstruction.Visible = false;
            }
        }
コード例 #18
0
        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);
                }
            }
        }
コード例 #19
0
        /// <summary>
        /// Checks stock for given product
        /// </summary>
        /// <param name="productId">Id of the product to check stock for</param>
        /// <param name="optionList">The option list of the product to check stock for</param>
        /// <param name="kitProductIds">If its a kit product the Ids of the kit products to check stock for</param>
        /// <returns>InventoryManagerData object containing stock details for the given product</returns>
        public static InventoryManagerData CheckStock(int productId, string optionList, List <int> kitProductIds)
        {
            Product product = ProductDataSource.Load(productId);

            if (product == null)
            {
                throw new InvalidProductException();
            }
            if (kitProductIds == null)
            {
                kitProductIds = new List <int>();
            }
            ProductVariant variant = null;

            if (!string.IsNullOrEmpty(optionList))
            {
                variant = ProductVariantDataSource.LoadForOptionList(productId, optionList);
            }

            List <KitProduct> kitProducts = new List <KitProduct>();

            foreach (int kpid in kitProductIds)
            {
                KitProduct kp = KitProductDataSource.Load(kpid);
                if (kp != null)
                {
                    kitProducts.Add(kp);
                }
            }
            return(CheckStock(product, variant, kitProducts));
        }
コード例 #20
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);
         }
     }
 }
コード例 #21
0
 protected void Page_Init(object sender, System.EventArgs e)
 {
     _ProductId = AlwaysConvert.ToInt(Request.QueryString["ProductId"]);
     _Product   = ProductDataSource.Load(_ProductId);
     if (_Product == null)
     {
         Response.Redirect("~/Default.aspx");
     }
 }
コード例 #22
0
        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);
        }
コード例 #23
0
        private void BindProduct()
        {
            DisplayPage.DataBind();
            Product product = ProductDataSource.Load(PageHelper.GetProductId());

            SelectItem(DisplayPage, product.WebpageId.ToString());
            EditItemLink.Text                 = product.Name;
            EditItemLink.NavigateUrl          = Page.ResolveUrl(string.Format("~/Admin/Products/EditProduct.aspx?ProductId={0}", product.Id));
            MangeDisplayPagesLink.NavigateUrl = Page.ResolveUrl("~/Admin/Website/ContentPages/ProductPages/Default.aspx");
        }
コード例 #24
0
        protected bool IsProductFeatured(int productId)
        {
            Product product = ProductDataSource.Load(productId);

            if (product != null)
            {
                return(product.IsFeatured);
            }
            return(false);
        }
コード例 #25
0
        private void SetFeatured(int productId, bool featured)
        {
            Product product = ProductDataSource.Load(productId);

            if (product != null)
            {
                product.IsFeatured = featured;
                product.Save();
            }
        }
コード例 #26
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int productId = AlwaysConvert.ToInt(Request.QueryString["ProductId"]);

            _Product = ProductDataSource.Load(productId);
            if (_Product == null)
            {
                Response.Redirect("ManageProducts.aspx");
            }
            Caption.Text = string.Format(Caption.Text, _Product.Name);
        }
コード例 #27
0
 protected void Page_Load(object sender, EventArgs e)
 {
     _ProductId = AlwaysConvert.ToInt(Request.QueryString["ProductId"]);
     _Product   = ProductDataSource.Load(_ProductId);
     if (_Product == null)
     {
         Response.Redirect(AbleCommerce.Code.NavigationHelper.GetAdminUrl("Catalog/Browse.aspx"));
     }
     CancelButton.NavigateUrl += _ProductId;
     BindImages();
 }
コード例 #28
0
 protected void Page_Load(object sender, EventArgs e)
 {
     _product = ProductDataSource.Load(AbleCommerce.Code.PageHelper.GetProductId());
     if (_product == null)
     {
         Response.Redirect(NavigationHelper.GetMobileStoreUrl("~/Default.aspx"));
         return;
     }
     //ProductName.Text = _product.Name;
     reviewTermsText.Text   = AbleContext.Current.Store.Settings.ProductReviewTermsAndConditions;
     BackToReviewsLink.HRef = Page.ResolveClientUrl(NavigationHelper.GetMobileStoreUrl(string.Format("~/ProductReviews.aspx?ProductId={0}", _product.Id)));
 }
コード例 #29
0
 private void AddProductToList(int productId)
 {
     if (!_SelectedProductIds.Contains(productId))
     {
         Product product = ProductDataSource.Load(productId);
         if (product != null && product.KitStatus != KitStatus.Master)
         {
             _SelectedProducts.Add(product);
             _SelectedProductIds.Add(productId);
         }
     }
 }
コード例 #30
0
 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;
 }