Widget Console

Sep 8, 2011 at 1:18 PM

So I think I have nopcommerce setup as an area. routes are registered and I can navigate to /cart and render the shopping cart - so far so good, however now the widget link in the console is disabled (issue 1). next when I comment out most of the routes the widget link comes back however when clicking on the link it wants to redirect to /NopStore/Widget/WidgetManager (NopStore is the area for NopCommerce). if I manually remove the /NopStore the WidgetManager renders, but discovery does not find any of the Widgets I have setup.

 

Any Ideas?

 

one more thing I have gone through all of the NopCommerce source and removed all support for Blog/Forum/News/NewsLetters/Themese as DNA will provide this functionality.

Coordinator
Sep 8, 2011 at 5:27 PM

I don't understand what are " widget link in the console is disabled" and "/NopStore/Widget/WidgetManager" ?  

Sep 8, 2011 at 11:47 PM

in the console, left hand side is your navigation bar. at the bottom is 2 links Widgets and Create Widgets when I click on the it takes me /NopStore/Widget/WidgetManager and for you to know NopStore is the name of the area I created, if I click it I get an 404 however if I remove the /NopStore from the URL the widget panel renders in the console

Coordinator
Sep 9, 2011 at 1:10 AM

At first i create a new DNA project (References:Working with DotNetAge ) and add an Area named "NopStore" and create a WidgetController that has "WidgetManager" Action but i could't get your error. Would you tell me are you using the source code to do this things or vsix project template ?

Sep 9, 2011 at 2:07 PM

I added the source for nopcommerce 2.0.1

here is the source for NopStoreAreaRegistration.cs

using System.Web.Mvc;

namespace DNA.Mvc.Areas.NopStore
{
    public class NopStoreAreaRegistration : AreaRegistration
    {
        public override string AreaName
        {
            get
            {
                return "NopStore";
            }
        }

        public override void RegisterArea(AreaRegistrationContext context)
        {

            //context.MapRoute("NopStore_sub",
            //    "NopStore/{website}/{controller}/{action}/{id}",
            //    new { id = UrlParameter.Optional });
            //context.MapRoute("NopStore_default",
            //                "NopStore/{controller}/{action}/{id}",
            //                new { action = "Index", id = UrlParameter.Optional });

            context.MapRoute("NopStore_products", "products/{id}.aspx",
                new { controller = "BackwardCompatibility1X", action = "RedirectProduct" },
                new[] { "DNA.Mvc.Areas.NopStore.Controllers" });

            //categories
            context.MapRoute("NopStore_category", "category/{id}.aspx",
                            new { controller = "BackwardCompatibility1X", area = AreaName, action = "RedirectCategory" },
                            new[] { "DNA.Mvc.Areas.NopStore.Controllers" });

            //manufacturers
            context.MapRoute("NopStore_manufacturer", "manufacturer/{id}.aspx",
                            new { controller = "BackwardCompatibility1X", area = AreaName, action = "RedirectManufacturer" },
                            new[] { "DNA.Mvc.Areas.NopStore.Controllers" });

            //product tags
            context.MapRoute("NopStore_producttag", "producttag/{id}.aspx",
                            new { controller = "BackwardCompatibility1X", area = AreaName, action = "RedirectProductTag" },
                            new[] { "DNA.Mvc.Areas.NopStore.Controllers" });

            //products
            context.MapRoute("Product",
                            "p/{productId}/{SeName}",
                            new { controller = "Catalog", area = AreaName, action = "Product", SeName = UrlParameter.Optional },
                            new { productId = @"\d+" },
                            new[] { "DNA.Mvc.Areas.NopStore.Controllers" });
            context.MapRoute("RecentlyViewedProducts",
                            "recentlyviewedproducts/",
                            new { controller = "Catalog", area = AreaName, action = "RecentlyViewedProducts" },
                            new[] { "DNA.Mvc.Areas.NopStore.Controllers" });
            context.MapRoute("RecentlyAddedProducts",
                            "newproducts/",
                            new { controller = "Catalog", area = AreaName, action = "RecentlyAddedProducts" },
                            new[] { "DNA.Mvc.Areas.NopStore.Controllers" });
            context.MapRoute("RecentlyAddedProductsRSS",
                            "newproducts/rss",
                            new { controller = "Catalog", area = AreaName, action = "RecentlyAddedProductsRss" },
                            new[] { "DNA.Mvc.Areas.NopStore.Controllers" });

            //comparing products
            context.MapRoute("AddProductToCompare",
                            "compareproducts/add/{productId}",
                            new { controller = "Catalog", area = AreaName, action = "AddProductToCompareList" },
                            new { productId = @"\d+" },
                            new[] { "DNA.Mvc.Areas.NopStore.Controllers" });
            context.MapRoute("CompareProducts",
                            "compareproducts/",
                            new { controller = "Catalog", area = AreaName, action = "CompareProducts" },
                            new[] { "DNA.Mvc.Areas.NopStore.Controllers" });
            context.MapRoute("RemoveProductFromCompareList",
                            "compareproducts/remove/{productId}",
                            new { controller = "Catalog", area = AreaName, action = "RemoveProductFromCompareList" },
                            new[] { "DNA.Mvc.Areas.NopStore.Controllers" });
            context.MapRoute("ClearCompareList",
                            "clearcomparelist/",
                            new { controller = "Catalog", area = AreaName, action = "ClearCompareList" },
                            new[] { "DNA.Mvc.Areas.NopStore.Controllers" });

            //product email a friend
            context.MapRoute("ProductEmailAFriend",
                            "productemailafriend/{productId}",
                            new { controller = "Catalog", area = AreaName, action = "ProductEmailAFriend" },
                            new { productId = @"\d+" },
                            new[] { "DNA.Mvc.Areas.NopStore.Controllers" });

            //catalog
            context.MapRoute("Category",
                            "c/{categoryId}/{SeName}",
                            new { controller = "Catalog", area = AreaName, action = "Category", SeName = UrlParameter.Optional },
                            new { categoryId = @"\d+" },
                            new[] { "DNA.Mvc.Areas.NopStore.Controllers" });
            context.MapRoute("ManufacturerList",
                            "manufacturer/all/",
                            new { controller = "Catalog", area = AreaName, action = "ManufacturerAll" },
                            new[] { "DNA.Mvc.Areas.NopStore.Controllers" });
            context.MapRoute("Manufacturer",
                            "m/{manufacturerId}/{SeName}",
                            new { controller = "Catalog", area = AreaName, action = "Manufacturer", SeName = UrlParameter.Optional },
                            new { manufacturerId = @"\d+" },
                            new[] { "DNA.Mvc.Areas.NopStore.Controllers" });

            //reviews
            context.MapRoute("ProductReviews",
                            "productreviews/{productId}",
                            new { controller = "Catalog", area = AreaName, action = "ProductReviews" },
                            new[] { "DNA.Mvc.Areas.NopStore.Controllers" });



            //shopping cart
            context.MapRoute("AddProductToCart",
                            "cart/addproduct/{productId}",
                            new { controller = "ShoppingCart", area = AreaName, action = "AddProductToCart" },
                            new { productId = @"\d+" },
                            new[] { "DNA.Mvc.Areas.NopStore.Controllers" });
            context.MapRoute("ShoppingCart",
                            "cart/",
                            new { controller = "ShoppingCart", area = AreaName, action = "Cart" },
                            new[] { "DNA.Mvc.Areas.NopStore.Controllers" });
            //wishlist
            context.MapRoute("Wishlist",
                            "wishlist/{customerGuid}",
                            new { controller = "ShoppingCart", area = AreaName, action = "Wishlist", customerGuid = UrlParameter.Optional },
                            new[] { "DNA.Mvc.Areas.NopStore.Controllers" });
            context.MapRoute("EmailWishlist",
                            "emailwishlist",
                            new { controller = "ShoppingCart", area = AreaName, action = "EmailWishlist" },
                            new[] { "DNA.Mvc.Areas.NopStore.Controllers" });

            //checkout
            context.MapRoute("Checkout",
                            "checkout/",
                            new { controller = "Checkout", area = AreaName, action = "Index" },
                            new[] { "DNA.Mvc.Areas.NopStore.Controllers" });
            context.MapRoute("CheckoutOnePage",
                            "onepagecheckout/",
                            new { controller = "Checkout", area = AreaName, action = "OnePageCheckout" },
                            new[] { "DNA.Mvc.Areas.NopStore.Controllers" });
            context.MapRoute("CheckoutShippingAddress",
                            "checkout/shippingaddress",
                            new { controller = "Checkout", area = AreaName, action = "ShippingAddress" },
                            new[] { "DNA.Mvc.Areas.NopStore.Controllers" });
            context.MapRoute("CheckoutSelectShippingAddress",
                            "checkout/selectshippingaddress",
                            new { controller = "Checkout", area = AreaName, action = "SelectShippingAddress" },
                            new[] { "DNA.Mvc.Areas.NopStore.Controllers" });
            context.MapRoute("CheckoutBillingAddress",
                            "checkout/billingaddress",
                            new { controller = "Checkout", area = AreaName, action = "BillingAddress" },
                            new[] { "DNA.Mvc.Areas.NopStore.Controllers" });
            context.MapRoute("CheckoutSelectBillingAddress",
                            "checkout/selectbillingaddress",
                            new { controller = "Checkout", area = AreaName, action = "SelectBillingAddress" },
                            new[] { "DNA.Mvc.Areas.NopStore.Controllers" });
            context.MapRoute("CheckoutShippingMethod",
                            "checkout/shippingmethod",
                            new { controller = "Checkout", area = AreaName, action = "ShippingMethod" },
                            new[] { "DNA.Mvc.Areas.NopStore.Controllers" });
            context.MapRoute("CheckoutPaymentMethod",
                            "checkout/paymentmethod",
                            new { controller = "Checkout", area = AreaName, action = "PaymentMethod" },
                            new[] { "DNA.Mvc.Areas.NopStore.Controllers" });
            context.MapRoute("CheckoutPaymentInfo",
                            "checkout/paymentinfo",
                            new { controller = "Checkout", area = AreaName, action = "PaymentInfo" },
                            new[] { "DNA.Mvc.Areas.NopStore.Controllers" });
            context.MapRoute("CheckoutConfirm",
                            "checkout/confirm",
                            new { controller = "Checkout", area = AreaName, action = "Confirm" },
                            new[] { "DNA.Mvc.Areas.NopStore.Controllers" });
            context.MapRoute("CheckoutCompleted",
                            "checkout/completed",
                            new { controller = "Checkout", area = AreaName, action = "Completed" },
                            new[] { "DNA.Mvc.Areas.NopStore.Controllers" });

            //orders
            context.MapRoute("OrderDetails",
                            "orderdetails/{orderId}",
                            new { controller = "Order", area = AreaName, action = "Details" },
                            new { orderId = @"\d+" },
                            new[] { "DNA.Mvc.Areas.NopStore.Controllers" });
            context.MapRoute("ReturnRequest",
                            "returnrequest/{orderId}",
                            new { controller = "Order", area = AreaName, action = "ReturnRequest" },
                            new { orderId = @"\d+" },
                            new[] { "DNA.Mvc.Areas.NopStore.Controllers" });
            context.MapRoute("GetOrderPdfInvoice",
                            "orderdetails/pdf/{orderId}",
                            new { controller = "Order", area = AreaName, action = "GetPdfInvoice" },
                            new[] { "DNA.Mvc.Areas.NopStore.Controllers" });
            context.MapRoute("PrintOrderDetails",
                            "orderdetails/print/{orderId}",
                            new { controller = "Order", area = AreaName, action = "PrintOrderDetails" },
                            new[] { "DNA.Mvc.Areas.NopStore.Controllers" });


            //contact us
            //context.MapRoute("ContactUs",
            //                "contactus",
            //                new { controller = "Common", area = AreaName, action = "ContactUs" },
            //                new[] { "DNA.Mvc.Areas.NopStore.Controllers" });


            //customer
            context.MapRoute("CustomerMyAccount",
                            "customer/myaccount",
                            new { controller = "Customer", area = AreaName, action = "MyAccount" },
                            new[] { "DNA.Mvc.Areas.NopStore.Controllers" });
            context.MapRoute("CustomerInfo",
                            "customer/info",
                            new { controller = "Customer", area = AreaName, action = "Info" },
                            new[] { "DNA.Mvc.Areas.NopStore.Controllers" });
            context.MapRoute("CustomerAddresses",
                            "customer/addresses",
                            new { controller = "Customer", area = AreaName, action = "Addresses" },
                            new[] { "DNA.Mvc.Areas.NopStore.Controllers" });
            context.MapRoute("CustomerOrders",
                            "customer/orders",
                            new { controller = "Customer", area = AreaName, action = "Orders" },
                            new[] { "DNA.Mvc.Areas.NopStore.Controllers" });
            context.MapRoute("CustomerReturnRequests",
                            "customer/returnrequests",
                            new { controller = "Customer", area = AreaName, action = "ReturnRequests" },
                            new[] { "DNA.Mvc.Areas.NopStore.Controllers" });
            context.MapRoute("CustomerDownloadableProducts",
                            "customer/downloadableproducts",
                            new { controller = "Customer", area = AreaName, action = "DownloadableProducts" },
                            new[] { "DNA.Mvc.Areas.NopStore.Controllers" });
            context.MapRoute("CustomerRewardPoints",
                            "customer/rewardpoints",
                            new { controller = "Customer", area = AreaName, action = "RewardPoints" },
                            new[] { "DNA.Mvc.Areas.NopStore.Controllers" });
            context.MapRoute("CustomerChangePassword",
                            "customer/changepassword",
                            new { controller = "Customer", area = AreaName, action = "ChangePassword" },
                            new[] { "DNA.Mvc.Areas.NopStore.Controllers" });
            context.MapRoute("CustomerAvatar",
                            "customer/avatar",
                            new { controller = "Customer", area = AreaName, action = "Avatar" },
                            new[] { "DNA.Mvc.Areas.NopStore.Controllers" });
            context.MapRoute("AccountActivation",
                            "customer/activation/{token}/{email}",
                            new { controller = "Customer", area = AreaName, action = "AccountActivation" },
                            new[] { "DNA.Mvc.Areas.NopStore.Controllers" });
            context.MapRoute("CustomerProfile",
                            "profile/{id}",
                            new { controller = "Profile", area = AreaName, action = "Index" },
                            new { id = @"\d+" },
                            new[] { "DNA.Mvc.Areas.NopStore.Controllers" });
            context.MapRoute("CustomerProfilePaged",
                            "profile/{id}/page/{page}",
                            new { controller = "Profile", area = AreaName, action = "Index" },
                            new { id = @"\d+", page = @"\d+" },
                            new[] { "DNA.Mvc.Areas.NopStore.Controllers" });
            context.MapRoute("CustomerForumSubscriptions",
                            "customer/forumsubscriptions",
                            new { controller = "Customer", area = AreaName, action = "ForumSubscriptions" },
                            new[] { "DNA.Mvc.Areas.NopStore.Controllers" });
            context.MapRoute("CustomerForumSubscriptionsPaged",
                            "customer/forumsubscriptions/{page}",
                            new { controller = "Customer", area = AreaName, action = "ForumSubscriptions", page = UrlParameter.Optional },
                            new { page = @"\d+" },
                            new[] { "DNA.Mvc.Areas.NopStore.Controllers" });
            //addresses
            context.MapRoute("CustomerAddressDelete",
                            "customer/addressdelete/{addressId}",
                            new { controller = "Customer", area = AreaName, action = "AddressDelete" },
                            new { addressId = @"\d+" },
                            new[] { "DNA.Mvc.Areas.NopStore.Controllers" });
            context.MapRoute("CustomerAddressEdit",
                            "customer/addressedit/{addressId}",
                            new { controller = "Customer", area = AreaName, action = "AddressEdit" },
                            new { addressId = @"\d+" },
                            new[] { "DNA.Mvc.Areas.NopStore.Controllers" });
            context.MapRoute("CustomerAddressAdd",
                            "customer/addressadd",
                            new { controller = "Customer", area = AreaName, action = "AddressAdd" },
                            new[] { "DNA.Mvc.Areas.NopStore.Controllers" });

            //product tags
            context.MapRoute("ProductsByTag",
                            "productag/{productTagId}/{SeName}",
                            new { controller = "Catalog", area = AreaName, action = "ProductsByTag", SeName = UrlParameter.Optional },
                            new { productTagId = @"\d+" },
                            new[] { "DNA.Mvc.Areas.NopStore.Controllers" });

            //product search
            context.MapRoute("ProductSearch",
                            "search/",
                            new { controller = "Catalog", area = AreaName, action = "Search" },
                            new[] { "DNA.Mvc.Areas.NopStore.Controllers" });

        }
    }
}

Sep 10, 2011 at 3:47 PM

Ok so I removed the 

,new[] { "DNA.Mvc.Areas.NopStore.Controllers" } 
parameter and now the widget link in the console is enabled however the URL is being mapped to my area. for example
http://localhost/Store/Home-Widget/WidgetManager which is return 404, if I remove the /Store/ in the address bar, the Widget Manager page pops up and I can discover my widgets.
Coordinator
Sep 10, 2011 at 3:51 PM

well done