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)
|
Let's say we wanted to add some fields to products, content pages, categories, ship methods, etc. Are we able to update the default admin and retail controllers and views via the plugin system?
We would like to keep the AbleCommerce and CommerceBuilder projects as close to the original as possible. All of our in-house customizations for AC7 kept us from upgrading to Gold. Now that we are committed to AC9, we want to add features in a way that allows us to more easily keep our system up to date with new features and security improvements.
|
|
|
|
Rank: Member
Groups: HelpDesk
Joined: 11/15/2021(UTC) Posts: 10
|
There is definitely a lack of plugins available for Able. And I don't see many outside developers offering ones.
I came over to Able from twenty years of using OsCommerce. It was an open source project and had a strong public support. There were many addons and help was easily found in the forum section if you had an issue.
Unfortunately, OSC went several years without a viable update to the core code, mainly due to its sale to a private group in Europe.
I would love to see more plugins offered to expand the power of this great software.
|
|
|
|
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)
|
Originally Posted by: sweeperq1766875 Let's say we wanted to add some fields to products, content pages, categories, ship methods, etc. Are we able to update the default admin and retail controllers and views via the plugin system? The short is no, you cannot. The plugin system can only be used offer additional (aka new) behaviors. It cannot be used to modify existing an behavior because there's no mechanism to recompile the MVC solution after the plugin is installed. The long answer is there are some ways to get around some of those limitations. But the effort is enormous, and the architecture of both MVC and the AC9 app make certain things simply not possible to change once the application is compiled. Sure you could rewrite certain Able files, include those files in the plugin zip and then modify your plugin bootstrap to copy those modified files over the top of the existing files. But there's no way to make the web server recompile the solution. So your modifications would be limited to view files only. The plugin system was a good start, but it never got any more love after the initial release. And they didn't design key aspects of AC9 to make 3rd party plugins worth the effort the build, document and market.
|
|
|
|
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)
|
That is unfortunate. I spent several hours last night finally getting a plugin to build, zip, and install to the website.
However, maybe it is a small blessing in disguise. It was painful to get the plugin up and running because of library differences between the Random Quote samples and 9.0.6. Was also thinking about what it would look like if AbleCommerce updates controller logic and/or view templates that we basically copy+paste into Plugin projects... We'd have to run merge comparisons between their code and our plugin code after each update and hope we covered everything. However, if we put our changes into the main project, Git will show us all of the changes generated by the update so we should know what needs to be merged.
Like you mentioned, I can see it being useful for completely new features and widgets.
|
|
|
|
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)
|
Well, you can't change the existing views/controllers from the plugin interface as Joe explained. However, you can achieve this by overriding the required views/controllers, etc. in the plugin. For this, you have to replicate all the related code for the plugin. You can also extend the existing functionality instead of overriding all the code by only implementing your custom database fields instead of overriding all the code. For example, you can create and inject the custom view inside your exiting edit product page tabs.
If you are going to override all the existing code, you have to maintain two copies of the files for upgrades i.e. one stock Ablecommerce files and the other are your plugin files. For the products, I will suggest you to use the ProductCustomFields in the plugin instead of adding direct custom fields/columns into the database.
|
|
|
|
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)
|
Originally Posted by: sweeperq1766875 Was also thinking about what it would look like if AbleCommerce updates controller logic and/or view templates that we basically copy+paste into Plugin projects... We'd have to run merge comparisons between their code and our plugin code after each update and hope we covered everything. And there in lies the real issue with the idea of copying existing Able behaviors. Now your merge workload just increased by a very large amount. There are customization design standards that can help with this concern, but not completely eliminate it. For example: I always put all new behaviors in separate controller files and views. I never just add them to the existing controller file. I modify the original controller as 'partial' and just create a new file in a /Controllers/Custom/ folder. This isolates all new behavior customizations quite nicely when it comes time to install an update. In full source, I do the same thing isolating my custom work via partial and starting a new class file in a /Custom/ folder. When it is necessary to modify existing behavior and views, I denote those changes at the beginning and end with comments in both controller and view files. This plays well when using a tool like BeyondCompare to merge the upgrade files into my modified ones. My changes now stick out like a sore thumb to the compare tool. This doesn't eliminate the merge work, but greatly speeds up the process. Certain occasions require massive modification to a specific view (ex: category page). In those cases, I'll copy the entire Able view to a /Custom/ file and just change the filename in the original controller's return PartialView("_whatever.cshtml") to PartialView("/Views/Custom/_whatever.cshtml"). This way I've minimized merge-change work for the next update and I'm not trying to compare a 1-line change made by Able to a view that's been completely rewritten by me. The vast majority of Able's view changes don't break a previous copy of the view. Not a 100% guarantee, I've had a few problems in the past. But overall this saves a ton of time. Table/schema changes are the least flexible. All those mappings are in nHibernate and there's no way to change that with a plugin. You could extend the object class, but that still doesn't update the nHibernate mapping file. I've never understand why Able hasn't switched to fluent nHibnerate mappings...maybe there's a technical reason I don't understand. These xml mapping files are just barbarian. And fluent mappings could be overridden, so far as I know. But then you get into a situation where multiple plugins override the same object class and things get ugly fast. Using the custom-fields classes work, but only to a point. While beneficial for basic read-write of field data, they become terribly awkward and cumbersome when you need to search or report those custom fields. Merge is a pain but you can minimize that pain quite a bit with consistent customization standards.
|
|
|
|
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