Ejemplo n.º 1
0
    /// <summary>
    /// Redirects to the new product page.
    /// </summary>
    private void RedirectToNewProduct()
    {
        string url = "Product_New.aspx";

        url = URLHelper.AddParameterToUrl(url, "siteId", SiteID.ToString());
        url = URLHelper.AddParameterToUrl(url, "categoryId", OptionCategoryID.ToString());
        url = URLHelper.AddParameterToUrl(url, "parentNodeId", ParentNodeID.ToString());
        url = URLHelper.AddParameterToUrl(url, "classId", DataClassID.ToString());
        url = URLHelper.AddParameterToUrl(url, "saved", "1");
        URLHelper.Redirect(url);
    }
Ejemplo n.º 2
0
    /// <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);
    }
Ejemplo n.º 3
0
    /// <summary>
    /// Redirects to the edit page of the saved product.
    /// </summary>
    private void RedirectToSavedProduct(BaseInfo product)
    {
        string url = "Product_Edit_Frameset.aspx";

        url = URLHelper.AddParameterToUrl(url, "siteId", SiteID.ToString());
        url = URLHelper.AddParameterToUrl(url, "categoryId", 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());
        }
        url = URLHelper.AddParameterToUrl(url, "saved", "1");
        URLHelper.Redirect(url);
    }
Ejemplo n.º 4
0
    /// <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));
    }
Ejemplo n.º 5
0
    /// <summary>
    /// Creates breadcrumbs.
    /// </summary>
    /// <param name="skuObj">Product SKU</param>
    private void CreateBreadcrumbs(SKUInfo skuObj)
    {
        string productListText = GetString("Prodect_Edit_Header.ProductOptionsLink");
        string productListUrl  = "~/CMSModules/Ecommerce/Pages/Tools/ProductOptions/OptionCategory_Edit_Options.aspx";

        productListUrl = URLHelper.AddParameterToUrl(productListUrl, "categoryId", OptionCategoryID.ToString());
        productListUrl = URLHelper.AddParameterToUrl(productListUrl, "siteId", SiteID.ToString());
        productListUrl = URLHelper.AddParameterToUrl(productListUrl, "productId", ParentProductID.ToString());
        productListUrl = URLHelper.AddParameterToUrl(productListUrl, "dialog", QueryHelper.GetString("dialog", "0"));

        // Set breadcrumb
        PageBreadcrumbs.AddBreadcrumb(new BreadcrumbItem
        {
            Text        = productListText,
            Target      = "_parent",
            RedirectUrl = ResolveUrl(productListUrl)
        });

        PageBreadcrumbs.AddBreadcrumb(new BreadcrumbItem
        {
            Text = FormatBreadcrumbObjectName(skuObj.SKUName, SiteID)
        });
    }
Ejemplo n.º 6
0
    /// <summary>
    /// Initializes the master page.
    /// </summary>
    private void InitMasterPage()
    {
        string titleText = "";
        string productText;

        // Initialize creation of new product option
        if (OptionCategoryID > 0)
        {
            productText = GetString("product_new.newproductoption");
        }
        // Initialize creation of new product
        else
        {
            if (ParentNodeID > 0)
            {
                titleText = GetString((newObjectSiteId > 0) ? "com_sku_edit_general.newitemcaption" : "com.product.newglobal");
            }
            else
            {
                titleText = GetString((newObjectSiteId > 0) ? "com.sku.newsku" : "com.sku.newglobalsku");
            }

            productText = titleText;
        }


        // Set breadcrumbs
        if (OptionCategoryID > 0)
        {
            var productListUrl = "~/CMSModules/Ecommerce/Pages/Tools/ProductOptions/OptionCategory_Edit_Options.aspx";
            productListUrl = URLHelper.AddParameterToUrl(productListUrl, "siteId", SiteID.ToString());
            productListUrl = URLHelper.AddParameterToUrl(productListUrl, "categoryId", OptionCategoryID.ToString());

            PageBreadcrumbs.AddBreadcrumb(new BreadcrumbItem
            {
                Text        = GetString("product_new.productoptionslink"),
                RedirectUrl = ResolveUrl(productListUrl),
            });

            PageBreadcrumbs.AddBreadcrumb(new BreadcrumbItem
            {
                Text = FormatBreadcrumbObjectName(productText, newObjectSiteId)
            });
        }
        else
        {
            EnsureProductBreadcrumbs(PageBreadcrumbs, productText, false, DisplayTreeInProducts, false);
        }

        PageTitle.TitleText = titleText;
    }
Ejemplo n.º 7
0
    /// <summary>
    /// Creates breadcrumbs.
    /// </summary>
    private void CreateBreadcrumbs()
    {
        if (IsProductOption)
        {
            OptionCategoryInfo categoryInfo = OptionCategoryInfoProvider.GetOptionCategoryInfo(OptionCategoryID);
            if (categoryInfo != null)
            {
                string productListText = GetString("Prodect_Edit_Header.ProductOptionsLink");
                string productListUrl  = "~/CMSModules/Ecommerce/Pages/Tools/ProductOptions/OptionCategory_Edit_Options.aspx";
                productListUrl = URLHelper.AddParameterToUrl(productListUrl, "categoryId", OptionCategoryID.ToString());
                productListUrl = URLHelper.AddParameterToUrl(productListUrl, "siteId", SiteID.ToString());
                productListUrl = URLHelper.AddParameterToUrl(productListUrl, "productId", ParentProductID.ToString());
                productListUrl = URLHelper.AddParameterToUrl(productListUrl, "dialog", QueryHelper.GetString("dialog", "0"));

                // Set breadcrumb
                PageBreadcrumbs.AddBreadcrumb(new BreadcrumbItem
                {
                    Text        = productListText,
                    Target      = (categoryInfo.CategoryType == OptionCategoryTypeEnum.Products) ? "_parent" : null,
                    RedirectUrl = ResolveUrl(productListUrl)
                });

                PageBreadcrumbs.AddBreadcrumb(new BreadcrumbItem
                {
                    Text = FormatBreadcrumbObjectName(SKU.SKUName, SiteID)
                });
            }
        }
        else
        {
            // Ensure correct suffix
            UIHelper.SetBreadcrumbsSuffix(GetString("objecttype.com_sku"));
        }
    }
Ejemplo n.º 8
0
    /// <summary>
    /// Initializes the master page.
    /// </summary>
    private void InitMasterPage()
    {
        string titleText       = "";
        string titleImage      = "";
        string productListText = "";
        string productListUrl  = "";
        string productText     = "";

        // Initialize creation of new product option
        if (OptionCategoryID > 0)
        {
            productText     = GetString("product_new.newproductoption");
            productListText = GetString("product_new.productoptionslink");

            productListUrl = "~/CMSModules/Ecommerce/Pages/Tools/ProductOptions/OptionCategory_Edit_Options.aspx";
            productListUrl = URLHelper.AddParameterToUrl(productListUrl, "siteId", SiteID.ToString());
            productListUrl = URLHelper.AddParameterToUrl(productListUrl, "categoryId", OptionCategoryID.ToString());

            AddMenuButtonSelectScript("ProductOptions", "");

            CurrentMaster.Title.HelpTopicName = "CMS_Ecommerce_New_Product_Option";
            CurrentMaster.Title.HelpName      = "helpTopic";
        }
        // Initialize creation of new product
        else
        {
            titleImage = GetImageUrl((newObjectSiteId > 0) ? "Objects/Ecommerce_SKU/new.png" : "Objects/Ecommerce_SKU/newglobal.png");
            if (ParentNodeID > 0)
            {
                titleText = GetString((newObjectSiteId > 0) ? "com_sku_edit_general.newitemcaption" : "com.product.newglobal");
            }
            else
            {
                titleText = GetString((newObjectSiteId > 0) ? "com.sku.newsku" : "com.sku.newglobalsku");
            }
            productText     = titleText;
            productListText = GetString(((ParentNodeID > 0) || !DisplayTreeInProducts) ? "com.sku.productslist" : "com.sku.unassignedlist");

            productListUrl = "~/CMSModules/Ecommerce/Pages/Tools/Products/Product_List.aspx";
            productListUrl = URLHelper.AddParameterToUrl(productListUrl, "siteId", SiteID.ToString());
            productListUrl = AddNodeIDParameterToUrl(productListUrl);

            AddMenuButtonSelectScript("Products", "");

            CurrentMaster.Title.HelpTopicName = "new_product";
            CurrentMaster.Title.HelpName      = "helpTopic";
        }

        // Prepare global title for product options
        if (OptionCategoryID > 0)
        {
            productText = FormatBreadcrumbObjectName(productText, newObjectSiteId);
        }

        // Create breadcrumbs when creating product document
        if (ParentNodeID > 0)
        {
            // Register script for selecting nodes from breadcrumbs
            ScriptHelper.RegisterClientScriptBlock(Page, typeof(string), "selectItem", ScriptHelper.GetScript(@"function SelectItem(nodeId, parentNodeId, documentId) { if (nodeId != 0) { parent.SelectNode(nodeId); parent.RefreshTree(parentNodeId, nodeId); }}"));

            TreeNode parentNode = DocumentHelper.GetDocument(ParentNodeID, TreeProvider.ALL_CULTURES, Tree);
            CurrentMaster.Title.Breadcrumbs = CreateNodeBreadcrumbs(parentNode, productText);
        }
        else
        {
            // Set master page breadcrumbs
            string[,] breadcrumbs = new string[2, 3];

            breadcrumbs[0, 0] = productListText;
            breadcrumbs[0, 1] = productListUrl;
            breadcrumbs[1, 0] = productText;

            CurrentMaster.Title.Breadcrumbs = breadcrumbs;
        }

        CurrentMaster.Title.TitleText  = titleText;
        CurrentMaster.Title.TitleImage = titleImage;
    }