private void gridData_OnAction(string actionName, object actionArgument) { if (string.IsNullOrEmpty(actionName)) { return; } var argument = ValidationHelper.GetInteger(actionArgument, 0); switch (actionName.ToLowerInvariant()) { case "edit": { string url = ProductUIHelper.GetProductEditUrl(); string query = DocumentListingDisplayed ? "?sectionId=" + NodeID + "&nodeId=" + argument + "&culture=" + CultureCode : "?productid=" + argument; url = URLHelper.AppendQuery(url, query); URLHelper.Redirect(UrlResolver.ResolveUrl(url)); } break; case "delete": if (DocumentListingDisplayed) { var url = "Product_Section.aspx?action=delete&nodeId=" + argument; URLHelper.Redirect(UrlResolver.ResolveUrl(URLHelper.AddParameterToUrl(url, "hash", QueryHelper.GetHash(url)))); } else { SKUInfo skuObj = SKUInfoProvider.GetSKUInfo(argument); // Check module permissions CheckModifyPermission(skuObj); // Check dependencies if (SKUInfoProvider.CheckDependencies(argument)) { // Show error message ShowError(EcommerceUIHelper.GetDependencyMessage(skuObj)); return; } SKUInfoProvider.DeleteSKUInfo(skuObj); } break; } }
private void gridData_OnAction(string actionName, object actionArgument) { int argument = ValidationHelper.GetInteger(actionArgument, 0); actionName = actionName.ToLowerCSafe(); switch (actionName) { case "edit": { string url = ProductUIHelper.GetProductEditUrl(); string query = DocumentListingDisplayed ? "?sectionId=" + NodeID + "&nodeId=" + argument + "&culture=" + CultureCode : "?productid=" + argument; url = URLHelper.AppendQuery(url, query); URLHelper.Redirect(url); } break; case "delete": if (DocumentListingDisplayed) { URLHelper.Redirect("Product_Section.aspx?action=delete&nodeId=" + argument); } else { SKUInfo skuObj = SKUInfoProvider.GetSKUInfo(argument); // Check module permissions CheckModifyPermission(skuObj); // Check dependencies if (SKUInfoProvider.CheckDependencies(argument)) { // Show error message ShowError(ECommerceHelper.GetDependencyMessage(skuObj)); return; } SKUInfoProvider.DeleteSKUInfo(skuObj); } break; } }
/// <summary> /// Redirects to the edit page of the saved product. /// </summary> private void RedirectToSavedProduct(BaseInfo product) { string url = ProductUIHelper.GetProductEditUrl(); // Creating product options of type other than products is redirected directly to form if (OptionCategoryID > 0) { var categoryInfo = OptionCategoryInfoProvider.GetOptionCategoryInfo(OptionCategoryID); if (categoryInfo != null) { url = "Product_Edit_General.aspx"; if (categoryInfo.CategoryType == OptionCategoryTypeEnum.Products) { url = UIContextHelper.GetElementUrl("cms.ecommerce", "ProductOptions.Options.Edit", false); } } } url = URLHelper.AddParameterToUrl(url, "siteId", SiteID.ToString()); url = URLHelper.AddParameterToUrl(url, "categoryId", OptionCategoryID.ToString()); url = URLHelper.AddParameterToUrl(url, "objectid", OptionCategoryID.ToString()); if (product is TreeNode) { int nodeId = product.GetIntegerValue("NodeID", 0); url = URLHelper.AddParameterToUrl(url, "nodeId", nodeId.ToString()); } else if (product is SKUInfo) { int skuId = product.GetIntegerValue("SKUID", 0); url = URLHelper.AddParameterToUrl(url, "productId", skuId.ToString()); // Select general tab if stan-alone SKU is saved if (OptionCategoryID == 0) { url = URLHelper.AddParameterToUrl(url, "tabName", "Products.General"); } } url = URLHelper.AddParameterToUrl(url, "saved", "1"); URLHelper.Redirect(url); }
/// <summary> /// Redirects to the edit page of the saved product. /// </summary> private void RedirectToSavedProduct(BaseInfo product) { string url = ProductUIHelper.GetProductEditUrl(); if (OptionCategoryID > 0) { var categoryInfo = OptionCategoryInfoProvider.GetOptionCategoryInfo(OptionCategoryID); if (categoryInfo != null) { url = UIContextHelper.GetElementUrl(ModuleName.ECOMMERCE, "ProductOptions.Options.General", false); } } var categoryID = OptionCategoryID.ToString(); url = URLHelper.AddParameterToUrl(url, "siteId", SiteID.ToString()); url = URLHelper.AddParameterToUrl(url, "categoryId", categoryID); url = URLHelper.AddParameterToUrl(url, "parentobjectid", categoryID); if (product is TreeNode) { int nodeId = product.GetIntegerValue("NodeID", 0); url = URLHelper.AddParameterToUrl(url, "nodeId", nodeId.ToString()); } else if (product is SKUInfo) { var skuId = product.GetIntegerValue("SKUID", 0).ToString(); url = URLHelper.AddParameterToUrl(url, "productId", skuId); url = URLHelper.AddParameterToUrl(url, "objectid", skuId); // Select general tab if stan-alone SKU is saved if (OptionCategoryID == 0) { url = URLHelper.AddParameterToUrl(url, "tabName", "Products.General"); } } url = URLHelper.AddParameterToUrl(url, "saved", "1"); URLHelper.Redirect(UrlResolver.ResolveUrl(url)); }
protected override void OnInit(EventArgs e) { base.OnInit(e); showProductsInTree = ECommerceSettings.DisplayProductsInSectionsTree(CurrentSiteName); if (DocumentListingDisplayed) { // Init document list docList.NodeID = NodeID; docList.Grid.GridName = "~/CMSModules/Ecommerce/Pages/Tools/Products/Product_List_Documents.xml"; docList.AdditionalColumns = "SKUID, DocumentSKUName, NodeParentID, NodeID, NodeSKUID, SKUName, SKUNumber, SKUPrice, SKUAvailableItems, SKUEnabled, SKUSiteID, SKUPublicStatusID, SKUInternalStatusID, SKUReorderAt, SKUTrackInventory"; docList.WhereCondition = GetDocumentWhereCondition(); docList.OrderBy = ShowSections ? "CASE WHEN NodeSKUID IS NULL THEN 0 ELSE 1 END, DocumentName" : "DocumentName"; docList.OnExternalAdditionalDataBound += gridData_OnExternalDataBound; docList.OnDocumentFlagsCreating += docList_OnDocumentFlagsCreating; docList.Grid.OnAction += gridData_OnAction; docList.Grid.RememberStateByParam = ""; docList.SelectLanguageJSFunction = "EditProductInCulture"; docList.DeleteReturnUrl = CONTENT_CMSDESK_FOLDER + "Delete.aspx?multiple=true"; docList.PublishReturnUrl = CONTENT_CMSDESK_FOLDER + "PublishArchive.aspx?multiple=true"; docList.ArchiveReturnUrl = CONTENT_CMSDESK_FOLDER + "PublishArchive.aspx?multiple=true"; docList.TranslateReturnUrl = "~/CMSModules/Translations/Pages/TranslateDocuments.aspx"; if (!string.IsNullOrEmpty(ProductsStartingPath)) { docList.CopyMoveLinkStartingPath = ProductsStartingPath; } string languageSelectionScript = $@" function EditProductInCulture(nodeId, culture, translated, url) {{ parent.RefreshTree(nodeId, nodeId); window.location.href = '{ProductUIHelper.GetProductEditUrl()}&nodeid=' + nodeId + '&culture=' + culture; parent.ChangeLanguage(culture); }} "; ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "EditProductInCulture", ScriptHelper.GetScript(languageSelectionScript)); plcSKUListing.Visible = false; // Stop processing SKU table gridData.StopProcessing = true; EditedObject = docList.Node; // Set title string title = docList.Node.IsRoot() ? GetString("com.sku.productslist") : docList.Node.GetDocumentName(); SetTitle(HTMLHelper.HTMLEncode(ResHelper.LocalizeString(title))); } else { // Init Unigrid gridData.OnAction += gridData_OnAction; gridData.OnExternalDataBound += gridData_OnExternalDataBound; // Stop processing product document listing docList.StopProcessing = true; plcDocumentListing.Visible = false; // Set title according display tree setting SetTitle(GetString(DisplayTreeInProducts ? "com.sku.unassignedlist" : "com.sku.productslist")); } // Show warning when exchange rate from global main currency is missing if (AllowGlobalObjects && ECommerceContext.IsExchangeRateFromGlobalMainCurrencyMissing) { ShowWarning(GetString("com.NeedExchangeRateFromGlobal")); } }