logo
Welcome to our new AbleCommerce forums. As a guest, you may view the information here. To post to this forum, you must have a registered account with us, either as a new user evaluating AbleCommerce or an existing user of the application. For all questions related to the older version of Gold and earlier, please go to AbleCommerce Gold forum. Please use your AbleCommerce username and password to Login. New Registrations are disabled.

Notification

Icon
Error

Options
Go to last post Go to first unread
sweeperqb  
#1 Posted : Monday, June 13, 2022 10:23:05 AM(UTC)
sweeperqb

Rank: Advanced Member

Groups: Authorized User, Developers
Joined: 5/30/2020(UTC)
Posts: 125

Thanks: 14 times
Was thanked: 3 time(s) in 3 post(s)
I tried to create a new retail controller with a simple Test action and view using the existing _Base.layout.cshtml as the layout. It failed because of the whole CMS/Outer/Inner template system.

Let's say I create a new controller called GalleryController with an action ViewPhoto, and I want it to use the default /Gallery/ViewPhoto/{id} route, what is the easiest way to wire up the controller and views so they have the same layout as the rest of the website?

Wanna join the discussion?! Login to your AbleCommerce Forums forum account. New Registrations are disabled.

sweeperqb  
#2 Posted : Monday, June 13, 2022 10:58:41 AM(UTC)
sweeperqb

Rank: Advanced Member

Groups: Authorized User, Developers
Joined: 5/30/2020(UTC)
Posts: 125

Thanks: 14 times
Was thanked: 3 time(s) in 3 post(s)
Note that adding new controllers and views works just fine in the admin. It is only on the retail side where I am having difficulty. If I set the Layout=null it works fine (it doesn't have the header/nav/footer/etc), so I'm 99.9% sure it is related to CMS/Outer/Inner template system.
sweeperqb  
#3 Posted : Monday, June 13, 2022 12:00:47 PM(UTC)
sweeperqb

Rank: Advanced Member

Groups: Authorized User, Developers
Joined: 5/30/2020(UTC)
Posts: 125

Thanks: 14 times
Was thanked: 3 time(s) in 3 post(s)
Oh my!! After digging through the code I'm not even sure it is possible to use the existing base layout with custom controllers and views. My controller inherits from AbleController, which has a LayoutDataAttribute attached to it. That attribute that injects layout details (Outer/Inner template, Theme, DisplayUrl, etc) based on whether the controller is named "Webpage", "Product", or "Category" and the action called is "Index". Obviously, a new controller name is none of those, and my actions are not "Index".

At this point I feel stuck. I can create all the code to administer our photo gallery, but how to display it within the site template eludes me. I can create a separate base layout, but with all of the content boards/widgets/HTML Snippets, I'm not sure how that would work.
nadeem  
#4 Posted : Monday, June 13, 2022 1:13:58 PM(UTC)
nadeem

Rank: Advanced Member

Groups: Administrators, Developers, Registered, HelpDesk, Authorized User, Admin, System
Joined: 10/11/2018(UTC)
Posts: 110

Thanks: 19 times
Was thanked: 18 time(s) in 18 post(s)
Quote:
At this point I feel stuck. I can create all the code to administer our photo gallery, but how to display it within the site template eludes me. I can create a separate base layout, but with all of the content boards/widgets/HTML Snippets, I'm not sure how that would work.


You can create a widget using your custom controller, views, etc., and then drag and drop that widget to a CMS page e.g. Category, content, or the product page. You can also create a new blank content page from the merchant admin and then drag and drop your custom widget onto it.
sweeperqb  
#5 Posted : Monday, June 13, 2022 2:17:56 PM(UTC)
sweeperqb

Rank: Advanced Member

Groups: Authorized User, Developers
Joined: 5/30/2020(UTC)
Posts: 125

Thanks: 14 times
Was thanked: 3 time(s) in 3 post(s)
To make sure I am understanding... I would create a Content page for a list view and drop a GalleryList widget in there. Then create a Content page for individual gallery photo and drop a GalleryPhoto widget in there? Am I going to be able to create custom routes or static urls and have it all still work?
shaharyar  
#6 Posted : Tuesday, June 14, 2022 3:23:19 AM(UTC)
shaharyar

Rank: Advanced Member

Groups: Admin, Developers, Registered, HelpDesk, Authorized User
Joined: 10/5/2018(UTC)
Posts: 704

Thanks: 5 times
Was thanked: 113 time(s) in 112 post(s)
Quote:
I would create a Content page for a list view and drop a GalleryList widget in there. Then create a Content page for individual gallery photo and drop a GalleryPhoto widget in there?


Yes, you are correct.

Quote:
Am I going to be able to create custom routes or static urls and have it all still work?


Yes, you can assign your custom URL to a content page you will create.

Hope it helps!
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.