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 forums.ablecommerce.com. Please use your AbleCommerce username and password to Login. Forums Registration.

Notification

Icon
Error

Options
Go to last post Go to first unread
Joe Payne @ AbleMods LLC  
#1 Posted : Thursday, October 15, 2020 2:17:30 PM(UTC)
Joe Payne @ AbleMods LLC

Rank: Advanced Member

Groups: Developers
Joined: 11/9/2018(UTC)
Posts: 134

Thanks: 25 times
Was thanked: 5 time(s) in 5 post(s)
I just blew 90 minutes banging my head against my desk trying to figure out why my changes to /Views/Shared/_StoreMenuLight.cshtml would not render.

Eventually I realized there is an override copy of that view in the /App_Themes/<theme-name>/Views/Shared/ folder.

You have GOT to build in some sort of way to make it obvious in the admin when working with widgets. Right now you get no indication that the view being used is going to pull from a non-standard (custom) location.

And the Theme page needs something really obvious to indicate that custom views are in play for that specific theme.

Different people work on a site over time. You can't assume the next guy knows all the tiny details of the software like the last guy did. Help them.

Wanna join the discussion?! Login to your AbleCommerce Forums forum account. Forums Registration.

ray22901031  
#2 Posted : Thursday, October 15, 2020 2:54:19 PM(UTC)
ray22901031

Rank: Advanced Member

Groups: Authorized User, Developers
Joined: 2/17/2019(UTC)
Posts: 186

Thanks: 2 times
Was thanked: 3 time(s) in 3 post(s)
I'll take this conversation up a notch, since I'm constantly creating my own menus, I understand what Joe means. If you were to remove the file from your custom theme, you would get a page load error on the main site.

This should not occur from a view file, if the file is not in the custom theme, it should load it from the main view folder. I've tried removing all contents from the file still keeping the file in the theme folder to see if the main view folder would override, it does not.

Bottom line if my MVC understanding is correct, if the file is not there, it should load from the main source, if the file is there it should override the main source.

Isn't this how custom.css works?

I guess I'm still used to Magento.

Edited by user Thursday, October 15, 2020 2:56:40 PM(UTC)  | Reason: Not specified

shari  
#3 Posted : Friday, October 16, 2020 8:05:44 AM(UTC)
shari

Rank: Advanced Member

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

Was thanked: 20 time(s) in 20 post(s)
Quote:
This should not occur from a view file, if the file is not in the custom theme, it should load it from the main view folder.


This is true for a .cshtml view file. Our application will look for the view file in theme views folder and if not present it will look in the default views folder. The same applies to the areas section.
But this is only for the .cshtml view files not for other resource files like .css or .js etc.
Joe Payne @ AbleMods LLC  
#4 Posted : Friday, October 16, 2020 8:28:18 AM(UTC)
Joe Payne @ AbleMods LLC

Rank: Advanced Member

Groups: Developers
Joined: 11/9/2018(UTC)
Posts: 134

Thanks: 25 times
Was thanked: 5 time(s) in 5 post(s)
I'm pretty sure that's how it's working for me. So long as it's not a brand new view that has no 'original' version in /Views/.

Overall I'm happy so far with how the view overrides behave. It's just not obvious that an override is in play when working with admin pages/widgets.

Long term we really need to work on organizing customizations into a separate folder structure. It would be immensely helpful from a customization perspective to have something like:

/Custom/
/Custom/Views/
/Custom/Controllers/
/Custom/Models/
/Custom/Themes/
/Custom/Code/

The goal is to isolate out anything that is custom. So when a developer comes into the project a year later, he doesn't have customizations scattered all over the place like there is now.

Would the solution be as simple as adjusting MVC routes to include a /Custom/ folder?

In 7.x and Gold, the /ConLib/Custom/ folder was clunky but it worked well. You could easily organize customized user controls away from regular ones. This made merging future release updates soooo much easier because I could just pair the update /ConLib/ folder to the website /ConLib/Custom/ folder and BeyondCompare instantly does the magic.
ray22901031  
#5 Posted : Friday, October 16, 2020 9:05:04 AM(UTC)
ray22901031

Rank: Advanced Member

Groups: Authorized User, Developers
Joined: 2/17/2019(UTC)
Posts: 186

Thanks: 2 times
Was thanked: 3 time(s) in 3 post(s)
Shari,

Yesterday when I rename the .cshtml file under my theme to see if it would load from the default, my system exploded. Even after clearing the cache and using a different browser, it refused to load the front page.

After further investigation, it appears things just get stuck, even after completely clearing out caches from different sources. Best way was to reset the website at IIS.

Yes it will load the default file from the main view directories, glad to see that MVC is functioning as expected.

Thank you for your reply.
Joe Payne @ AbleMods LLC  
#6 Posted : Friday, October 16, 2020 9:09:47 AM(UTC)
Joe Payne @ AbleMods LLC

Rank: Advanced Member

Groups: Developers
Joined: 11/9/2018(UTC)
Posts: 134

Thanks: 25 times
Was thanked: 5 time(s) in 5 post(s)
Sounds like the override theme list is being cached perhaps?
Naveed Ashraf  
#7 Posted : Monday, October 19, 2020 6:41:33 AM(UTC)
Naveed Ashraf

Rank: Advanced Member

Groups: Admin, Administrators, Developers, Registered, HelpDesk, Authorized User
Joined: 7/31/2019(UTC)
Posts: 72

Was thanked: 6 time(s) in 6 post(s)

Quote:
Sounds like the override theme list is being cached perhaps?



No, the view file override is not cached. The razor view engine internally handles it at runtime. If you remove the .cshtml file from theme folder,o subsequent attempts it should pick the view file from the standard location.
Thanks for your support!
Naveed Ashraf
Ablecommerce.com
Developer Assistance Available
ray22901031  
#8 Posted : Monday, October 19, 2020 8:41:35 AM(UTC)
ray22901031

Rank: Advanced Member

Groups: Authorized User, Developers
Joined: 2/17/2019(UTC)
Posts: 186

Thanks: 2 times
Was thanked: 3 time(s) in 3 post(s)
What is supposed to happen in theory and what actually happens in reality are sometime contradictory. There many times especially when working with custom menus which happened to be a razor cshtml file where one has to reset IIS.

So I must respectfully come to the conclusion that how it's supposed to work and how it actually works at times could be in conflict. There are many times when I have rename a file in my theme which should have no effect on the system whatsoever, but yet the system crashes.

Normally fully clearing the cache from a browser does the trick, in the last situation that I had, only resetting IIS was able to resolve problem.

Coming from the school of hard knocks,
-Ray

Naveed Ashraf  
#9 Posted : Monday, October 19, 2020 8:55:29 AM(UTC)
Naveed Ashraf

Rank: Advanced Member

Groups: Admin, Administrators, Developers, Registered, HelpDesk, Authorized User
Joined: 7/31/2019(UTC)
Posts: 72

Was thanked: 6 time(s) in 6 post(s)
Hi Ray,

I have just re-tested with couple of view files, and it seems working for me.

1. I copied the "/Views/Shared/_StoreMenuLight.cshtml" to theme folder and modified. On reload , the page picked up the view file from the theme folder.
2. I re-named the view file, and reloaded the page. This time the page picked up the original view file from the standard "Views/Shared/" folder.

I think we need to dig it a little more. There may be some issue with your setup, or configurations. Or there may be some code changes?
Is it happening for all view files, or just specific view file?
Are there any AJAX calls involved in partial view rendering?

There are many other AC 9.0.2 websites I have worked, it never happened to me.

Thanks.
Thanks for your support!
Naveed Ashraf
Ablecommerce.com
Developer Assistance Available
ray22901031  
#10 Posted : Monday, October 19, 2020 9:09:44 AM(UTC)
ray22901031

Rank: Advanced Member

Groups: Authorized User, Developers
Joined: 2/17/2019(UTC)
Posts: 186

Thanks: 2 times
Was thanked: 3 time(s) in 3 post(s)
Hello Naveed,

I appreciate your reply but I don't believe this is a major concern. There are certain glitches that occur in real life, which could be configuration, different hardware, or even gremlins in the computer.

I have learned so far that certain directories are extremely pickly and others are not. When working with multiple versions of a file, I like to rename a file using the date as the extension to the file name while keeping the file in that directory, try this under the bin directory and the system explodes constantly.

So one learns the glitches and moves forward.

If all else fails, reboot.

Many thanks
Users browsing this topic
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.