AbleCommerce Forums
»
AbleCommerce
»
General Questions
»
how to add new menu option in _AccountSideMenu?
Rank: Advanced Member
Groups: Authorized User, Developers Joined: 7/1/2022(UTC) Posts: 71
Thanks: 5 times Was thanked: 1 time(s) in 1 post(s)
|
Hi, is there a documented process on how to add a new menu option in _AccountSideMenu? I have a custom My Recordings tab from AC Gold that I'm trying to recreate in AC9.
I created a partial view _MyRecordings in Views/Members/ that gets data from a modified MembersController.
I modified _AccountSideMenu to show the menu link.
I added a Shared/Inner/MyRecordings placeholder (modeled after MyOrders).
The menu link shows.
When I click on it, it renders, but like a new page outside of the AC website. As such, it doesn't render properly, but the content is coming correctly from the modified controller with a new Action.
I found it likely needs an entry in ac_CatalogUrls. Not knowing the best way to add an entry, I sort of duplicated the one from MyOrders, changing it to MyRecordings.
After restarting IIS, that caused the page to to render in the AC admin content area, but all I get is:
[[ConLib:ProductRow]]
At this point I figured I'm in over my head and need to ask for help! :)
Thanks
|
|
|
|
Rank: Advanced Member
Groups: HelpDesk, Developers Joined: 11/9/2018(UTC) Posts: 564
Thanks: 122 times Was thanked: 26 time(s) in 25 post(s)
|
Creating new pages on the shopper side require more effort than a traditional MVC page. In your specific example you mentioned, here's what to do: You have to understand how the pages are built. In order for Able to handle the 'theme' aspects of the page, you have to let Able do some of the page construction. This means you're going to create a partial view, not a full view. First add your actionresult to the /Controllers/MembersController.cs. I made it partial and put my new stuff in a /Custom/MembersController.cs. Your actionresult will return a partial view. Now create your partial view in the /Views/Members/ folder. Be sure to look at some of the other widgets in the controller to see how Able decorates them with an attribute so they are detected as a widget. Next, you use the admin side to define the widget layout and the page itself: First, find the Website->Store Design menu and go to inner templates. You're going to make a new inner template, define that template layout and then drag-drop your widget onto the inner template. Save the inner template. Next, define a content page. This is where you're going to set the url i.e. "Members/MyRecordings" and specify the inner template you just created. At this point, now the url is wired up to a view created by Able that will properly include the configured store theme. Within that view Able will render the partial view aka widget that you created. It's best to start simple. Don't try to code the whole thing from the start. Make a dumb, simple 'Hello World' widget first. Get that working. Get the feel for how Able wants the pages defined. And then grow it from there. It's definitely a learning curve. But it makes sense once you get the hang of it. And it's incredibly granular as your needs get more advanced. Edited by user Wednesday, November 9, 2022 2:55:46 PM(UTC)
| Reason: Not specified
|
1 user thanked Joe Payne2 for this useful post.
|
|
|
Rank: Advanced Member
Groups: Authorized User, Developers Joined: 7/1/2022(UTC) Posts: 71
Thanks: 5 times Was thanked: 1 time(s) in 1 post(s)
|
Hi Joe, thanks for the walk through. I was really close. I just didn't know how to add the internal mappings through the UI to get it to render properly. It's working great. Thanks again! Originally Posted by: Joe Payne2 Creating new pages on the shopper side require more effort than a traditional MVC page. In your specific example you mentioned, here's what to do:
You have to understand how the pages are built. In order for Able to handle the 'theme' aspects of the page, you have to let Able do some of the page construction. This means you're going to create a partial view, not a full view.
First add your actionresult to the /Controllers/MembersController.cs. I made it partial and put my new stuff in a /Custom/MembersController.cs. Your actionresult will return a partial view. Now create your partial view in the /Views/Members/ folder. Be sure to look at some of the other widgets in the controller to see how Able decorates them with an attribute so they are detected as a widget.
Next, you use the admin side to define the widget layout and the page itself:
First, find the Website->Store Design menu and go to inner templates. You're going to make a new inner template, define that template layout and then drag-drop your widget onto the inner template. Save the inner template.
Next, define a content page. This is where you're going to set the url i.e. "Members/MyRecordings" and specify the inner template you just created.
At this point, now the url is wired up to a view created by Able that will properly include the configured store theme. Within that view Able will render the partial view aka widget that you created.
It's best to start simple. Don't try to code the whole thing from the start. Make a dumb, simple 'Hello World' widget first. Get that working. Get the feel for how Able wants the pages defined. And then grow it from there.
It's definitely a learning curve. But it makes sense once you get the hang of it. And it's incredibly granular as your needs get more advanced.
|
|
|
|
Rank: Advanced Member
Groups: HelpDesk, Developers Joined: 11/9/2018(UTC) Posts: 564
Thanks: 122 times Was thanked: 26 time(s) in 25 post(s)
|
Glad I could help. 18 months ago, I couldn't spell MVC let alone code it :)
|
|
|
|
Rank: Advanced Member
Groups: Authorized User, Developers Joined: 7/1/2022(UTC) Posts: 71
Thanks: 5 times Was thanked: 1 time(s) in 1 post(s)
|
Same! I spent a LOT of time learning Blazor this year, and it helped me a lot when it came time to turn my attention to the AC upgrade and MVC.
I'm hoping the day isn't too far down the road when AC switches out of Framework and into Core...!
|
|
|
|
Rank: Advanced Member
Groups: HelpDesk, Developers Joined: 11/9/2018(UTC) Posts: 564
Thanks: 122 times Was thanked: 26 time(s) in 25 post(s)
|
I haven't messed with Blazor yet. You like it better than Razor?
|
|
|
|
Rank: Advanced Member
Groups: Authorized User, Developers Joined: 7/1/2022(UTC) Posts: 71
Thanks: 5 times Was thanked: 1 time(s) in 1 post(s)
|
I like Blazor a LOT. It's like how "webforms" was supposed to be. Much easier to be productive than MVC is!
|
|
|
|
AbleCommerce Forums
»
AbleCommerce
»
General Questions
»
how to add new menu option in _AccountSideMenu?
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.
Important Information:
The AbleCommerce Forums uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close