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
Joe Payne2  
#1 Posted : Thursday, October 15, 2020 2:17:30 PM(UTC)
Joe Payne2

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 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. New Registrations are disabled.

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: 909

Thanks: 3 times
Was thanked: 15 time(s) in 15 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)
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:
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 Payne2  
#4 Posted : Friday, October 16, 2020 8:28:18 AM(UTC)
Joe Payne2

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'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: 909

Thanks: 3 times
Was thanked: 15 time(s) in 15 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 Payne2  
#6 Posted : Friday, October 16, 2020 9:09:47 AM(UTC)
Joe Payne2

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)
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: 77

Was thanked: 8 time(s) in 8 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: 909

Thanks: 3 times
Was thanked: 15 time(s) in 15 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: 77

Was thanked: 8 time(s) in 8 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: 909

Thanks: 3 times
Was thanked: 15 time(s) in 15 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
ray22901031  
#11 Posted : Monday, October 19, 2020 12:22:35 PM(UTC)
ray22901031

Rank: Advanced Member

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

Thanks: 3 times
Was thanked: 15 time(s) in 15 post(s)
It just happened again.

I needed to create a form that did a lookup against the database, I follow the instructions to the letter based on the documentation provided by the Ablecommerce developers site.

After creating a custom controller, a custom view, and a custom model, the project compiled successfully. I drag and drop the new widget onto the form, and all works perfectly. The information is being retrieved properly from the database. However, the presentation looks absolutely horrible, so I create the custom view folder in my theme. I modified the CSHTML file but the effects do not display.

I go to the roots directory of views and modify it there, and it displays perfectly. So I reset everything back, completely cleared the browser cache, and we are back to where we started. A horrible looking display. I modified the CSHTML file under my theme, reset IIS, and all is working perfectly.

This is now the second time this has occurred.

No biggie for me, because I will just reset IIS. However, unless there's a configuration setting somewhere that I'm missing, for certain views I still need to continue to reset IIS.

What am I missing here?
Naveed Ashraf  
#12 Posted : Monday, October 19, 2020 1:34:38 PM(UTC)
Naveed Ashraf

Rank: Advanced Member

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

Was thanked: 8 time(s) in 8 post(s)
Quote:
However, the presentation looks absolutely horrible, so I create the custom view folder in my theme. I modified the CSHTML file but the effects do not display.


First of all for your custom views you do not need to create the custom views folder under the theme folder, you should better edit/update the view files under standard /Views folder. However it should have worked, as view engine should have first looked into the theme folder for a view file.


Quote:
I go to the roots directory of views and modify it there, and it displays perfectly. So I reset everything back, completely cleared the browser cache, and we are back to where we started. A horrible looking display.


What you mean by reset everything back? do you mean that you removed the duplicated view file under theme folder?

I think browser cache have no effect in this scenario.
Thanks for your support!
Naveed Ashraf
Ablecommerce.com
Developer Assistance Available
ray22901031  
#13 Posted : Monday, October 19, 2020 1:38:58 PM(UTC)
ray22901031

Rank: Advanced Member

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

Thanks: 3 times
Was thanked: 15 time(s) in 15 post(s)
You are correct, the browser cache has nothing to do with this, but something else in IIS does. Putting a view under theme folders should be proper way to integrate with MVC, especially when it comes to upgrades later on.

Again, it's not a big thing, but just to let you know it happened.

Thanks
ray22901031  
#14 Posted : Monday, October 19, 2020 3:12:56 PM(UTC)
ray22901031

Rank: Advanced Member

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

Thanks: 3 times
Was thanked: 15 time(s) in 15 post(s)
" First of all for your custom views you do not need to create the custom views folder under the theme folder, you should better edit/update the view files under standard /Views folder. However it should have worked, as view engine should have first looked into the theme folder for a view file."

I am not sure what you mean by this at all, if I do not mimic the directory structure from the main view folder, nothing works. This new view is under a directory under my theme called Custom. In other words Themes\[Name of Theme]\Views]\Custom\ [file is here].

In fact just to prove a point, I removed the file from under the proper directory and placed it in the root view folder of my theme. It did not work. I then placed the file back, and had no choice but to reset IIS once again for the file to load properly.

Just reporting my findings.
Naveed Ashraf  
#15 Posted : Tuesday, October 20, 2020 6:35:18 AM(UTC)
Naveed Ashraf

Rank: Advanced Member

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

Was thanked: 8 time(s) in 8 post(s)
Quote:
In fact just to prove a point, I removed the file from under the proper directory and placed it in the root view folder of my theme. It did not work. I then placed the file back, and had no choice but to reset IIS once again for the file to load properly.



Actually I mean the opposite. I mean you do not need to copy or mimic the directory structure under theme folder for your custom view files. And I suggest to update those under standard \Views\Custom folder.

One purpose of copying the view files is prevent direct changes in the standard view files. This way you can compare your custom changes easily, and also future upgrades will be easy. However for your custom view files you do not need compare changes and need not to worry about the future upgrades.
Thanks for your support!
Naveed Ashraf
Ablecommerce.com
Developer Assistance Available
ray22901031  
#16 Posted : Tuesday, October 20, 2020 7:13:30 AM(UTC)
ray22901031

Rank: Advanced Member

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

Thanks: 3 times
Was thanked: 15 time(s) in 15 post(s)
Extremely confusing statement, YOU DO HAVE TO MIMIC the directory structure under your theme folders or it doesn't work. Unless there's something different about my computer down here in Miami, directory structure under theme's is extremely important.

I'm not sure why anyone would suggest differently, or maybe I'm just misreading your statement.

Either way this topic has gone on long enough, everything works as long as proper directory structure is intact.

Thanks
judy at Web2Market  
#17 Posted : Wednesday, October 21, 2020 6:00:41 AM(UTC)
judy at Web2Market

Rank: Advanced Member

Groups: Developers
Joined: 11/7/2018(UTC)
Posts: 303

Thanks: 21 times
Was thanked: 5 time(s) in 5 post(s)
Just a note on what we have found with upgrades over the past 12 years:
We use BeyondCompare folder compare to make sure we have found all the customizations on a site. You can click open a folder, click open a file and see the differences. It is a lot harder/takes a lot longer if the customizations aren't in the standard files because we have to look in two places to see what is customized, switch subfolders in BC. We always have a copy of the original AC install files in another location so there is no way of losing them.
ray22901031  
#18 Posted : Wednesday, October 21, 2020 6:37:54 AM(UTC)
ray22901031

Rank: Advanced Member

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

Thanks: 3 times
Was thanked: 15 time(s) in 15 post(s)
Hi Judy,

I will tell you something, but you have to promise me you will not laugh. Still fairly new to GitHub, so I use a program called "Advanced Diary" to log all my code changes. I created a template within the program just for this. I even use color-code and have the the ability to sort things into changes that needed to be compiled and changes that did not. The beauty of the program is, besides the fact that it timestamps everything, it has the ability to hold attachments. So anytime someone sends me something, I'm able to zip it and attach it to the entry itself.

Yes I know it's old-fashioned, but I guess one tends to use what they know. Either way, I will check out your software, and hopefully later next month I'll be attending a three hour lecture on GitHub.

Either way I'm enclosing a picture for your review.

Many thanks

ChangeLog.jpg (893kb) downloaded 6 time(s).

Edited by user Wednesday, October 21, 2020 6:55:57 AM(UTC)  | Reason: Not specified

judy at Web2Market  
#19 Posted : Monday, October 26, 2020 5:54:09 AM(UTC)
judy at Web2Market

Rank: Advanced Member

Groups: Developers
Joined: 11/7/2018(UTC)
Posts: 303

Thanks: 21 times
Was thanked: 5 time(s) in 5 post(s)
No, I won't laugh! Looks like a good solution for you. I use a program Library.net as a code library to input custom code, web research, etc, to to try to prevent the "I know I did that somewhere"s. We use GitHub for our AC9 sites because of having to compile so many changes and several developers working on a project at a time. We didn't really need it it Gold for most things because you could do so much without compiling. I do still use SVN locally to keep track of my changes, but it gets a little buggy.
ray22901031  
#20 Posted : Monday, October 26, 2020 7:35:10 AM(UTC)
ray22901031

Rank: Advanced Member

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

Thanks: 3 times
Was thanked: 15 time(s) in 15 post(s)
It actually works for us, because I try not to modify the code base too much. This new version, 9.0.3, actually fixed every single one of our issues, so I'm starting with a clean slate again, when it comes to the CodeBase. I was up all night trying to get GitHub up and running from within Visual Studio, not sure what happened, nothing work. Will need to try again this week after much needed coffee.

Since I will require the assistance of a developer down the road, I will need to embrace what everyone uses, hopefully to make life easier, but I will always maintain a diary.

Thanks
Users browsing this topic
Guest (21)
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.