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 : Wednesday, March 31, 2021 10:37:07 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'm trying to wrap my head around customizing AbleCommerce. I want to limit touching the original code as much as possible in order to simplify upgrades.

I noticed while answering another question about customizing view locations that AC9 uses the ThemeableRazorViewEngine. Theoretically, I could create a custom "MyStore" theme and implement all of my custom Views in there. However, that doesn't address coding changes for adding/processing custom fields.

For example, we have always utilized 4 product photos (icon, thumbnail, main, and zoom). If I wanted to extend AC9 to add a zoom photo, what is the preferred method for doing so? Do I go into /Admin/Controllers/AssetsController.cs and modify that directly, or is there a better/more compartmentalized way?

We are just getting started with AC9, so I want to make sure we are setting ourselves up well for maintainability the next several years.

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

mazhar  
#2 Posted : Thursday, April 1, 2021 4:18:05 AM(UTC)
mazhar

Rank: Administration

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

Thanks: 8 times
Was thanked: 17 time(s) in 15 post(s)
You can create a plugin, create a new product image widget that can make use of zoom functions. Then when you install plugin, the widget will be listed in available plugins. You can then remove default widget and use your zoom widget instead.
ray22901031  
#3 Posted : Thursday, April 1, 2021 10:59:37 AM(UTC)
ray22901031

Rank: Advanced Member

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

Thanks: 3 times
Was thanked: 13 time(s) in 13 post(s)
>>> I could create a custom "MyStore" theme and implement all of my custom Views in there.

Please note that there are still some issues with this, sometimes it will bypass your new theme directory and look for files in the "sample theme directory ". This is a bug and they are aware of it and hopefully should be fixed in version 9.04. For now I'm saving the original files in the sample directory by renaming them and having to place my custom files in the sample directory as well.

You can imagine how many hours I spent trying to figure out why certain things weren't working. Many things seem to work at first, until you go to a different page and come back to the original, or hitting refresh on your browser.

Quite annoying actually.

Hope this saves you time,
-Ray
sweeperqb  
#4 Posted : Friday, April 2, 2021 11:12:18 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)
Ray, thanks for the heads up!

Mazhar, that works great for displaying custom info. But what would the process look like for updating the Admin to create the zoom image when uploaded? Currently, the AssetsController creates 3 versions of specified dimensions. We would like it to create a 4th larger version. Do we customize the AssetsController and associated views directly, or is there a way to override/replace it with a plugin that doesn't require touching the original code?

Note that this is just one example. We are going to want custom product fields displayed right on the Add/Edit product page, add address validation, fraud processing, etc. Going to be a ton of work which is why I want to make sure we are doing things in a manner that will allow for easier upgrades.

I might try writing an ImageUpload plug-in that essentially copies what you have in the ImageUpload portion AssetsController, but adds a 4th image, and uses an exact route in the RouteProvider.

shaharyartiwana25816656  
#5 Posted : Tuesday, April 6, 2021 5:17:23 AM(UTC)
shaharyar

Rank: Advanced Member

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

Thanks: 5 times
Was thanked: 113 time(s) in 112 post(s)
To avoid creating a plugin for admin side customizations.

You can only override view files the same way as you do on the retail side. All you have to do is to create a theme folder in the admin area folder and place the view file you want to override following the same herirarchy.

For controller code, you have to make changes to the existing controller.
sweeperqb  
#6 Posted : Tuesday, April 6, 2021 10:21:19 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 was able to create a plugin that took over the AssetController ImageUpload action and views. My Config page had settings for zoom width and height that were stored in the CustomFields table. I essentially copied the logic, added my customizations to create the zoom (which included looking at the EXIF data b/c AC was rotating some images).

However, after doing so I realized what a pain it is going to be to maintain when AC releases updates. Since AAC updates don't touch my plugins, I have to know everything AC changes with an update to make sure I update my plugins accordingly. If I just do it in the AC source, I can use source control and WinMerge to merge changes and keep things running smoothly.
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.