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 : Monday, June 6, 2022 2:28:02 PM(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)
What are the minimum requirements for the themes? We made a copy of the sample theme but there is a ton of stuff in there. I'm assuming some of it is required for the CMS implementation and template Bootstrap.

We're having issues overriding some of the styles due to the specificity of some AC defined classes (we applied .text-success to a span, but because the parent had a rule for article.account-content span, our content won't turn green).

Also, what is the correct way to add CSS stylesheets/scripts for a Plugin? Can a custom Theme be installed and made the default from a Plugin?

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

shaharyar  
#2 Posted : Tuesday, June 7, 2022 5:53:37 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:
Also, what is the correct way to add CSS stylesheets/scripts for a Plugin?


To add a custom stylesheet/script in the plugin you can use RequireCSS and RequireScript functions in the view file.

Open view file
Add the following code at the start. This is an example code. You will have to add your own path. This can be the bundle name or the physical file path.

Code:
{
    RequireCSS("~/plugins/summernoteStyles");
    RequireScript("~/plugins/summernote");
}


Quote:
Can a custom Theme be installed and made the default from a Plugin?


No theme can't be installed and made default from a plugin. The theme is a global entity and you manage the Themes from the admin Website menu.
sweeperqb  
#3 Posted : Tuesday, June 7, 2022 12:59:25 PM(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)
Originally Posted by: shaharyar Go to Quoted Post

No theme can't be installed and made default from a plugin. The theme is a global entity and you manage the Themes from the admin Website menu.


I've said it several times before, but we are trying very hard to avoid modifying AC source. We are coding in new/custom controllers and views in the plugin, but ultimately need to tell the AC admin to use a modified view for it to be useful. The best way we found to do that was making a copy of the original view, dropping it in the Themes, then customizing it to pull in the new/custom UI and logic from the plugin.

I'm about ready to end my quest of keeping things separate, modify the source, and be stuck on AC9.0.6 for the next several years like we were with AC7.0.4.
Joe Payne2  
#4 Posted : Tuesday, June 7, 2022 3:18:35 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)
Originally Posted by: sweeperqb Go to Quoted Post
I'm about ready to end my quest of keeping things separate, modify the source, and be stuck on AC9.0.6 for the next several years like we were with AC7.0.4.


Welcome to the last 15 years of my life.

The app has some great design aspects. But it wasn't built from a pure dev-friendly-customizations standpoint. Add on how MVC is designed to work and it gets even more complex.

The default theme was built poorly. It works, but some of the aspects of it are dependent on things that are not theme-specific such as the base page layouts. What we did was make a copy of it, then modified the daylights out of the copy.

You're also going to have to consider some of the javascript (Able's app.js) is hard-coded to look for specific CSS classes for certain behaviors like add-to-cart. You could easily wind up breaking your ability to add-to-cart by removing certain css classes from the copy of your theme. Again this was poorly implemented but it is what it is.

You can set up MVC routing to make it easier to utilize copies of an able view in a separate /custom/ folder. That's how I do it most of the time, although lately I've gotten more lazy.

For example, I have a folder /Views/Custom/Category/ and modified my MVC to search there. So if I copy a default Able category view into that custom folder, MVC will pick up my copy first before it finds the default able view. This leaves the default one intact, but I'm still faced with merging differences in future releases. I've just changed where that merge occurs.


If you need a working example of how to include a stylesheet in a plugin, the IntegratedProviders/Ups/ plugin does that.
judy at Web2Market  
#5 Posted : Wednesday, June 8, 2022 6:54:57 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)
We do modify the AC files except for adding new controllers, models, views for things that don't exist in AC. We always have the original AC source to refer to if necessary. We do this because for us it makes upgrading easier. I can open AC default code and the site code in BeyondCompare and find the customizations very quickly and copy them to the new version of AC. We have a group of sites that were part of a package of sites customized for book sales in AC Gold. Those developers didn't customize AC files but created new ones. So to find out the changes to determine how to put them into new version of AC, I have to figure out what AC file the customized file replaces and compare them a file at a time instead of starting out by scanning the folder structure for for changed files. It takes at least twice as long to do an upgrade.Everyone is different, but especially with the way MVC is, it's very difficult to avoid changing an AC file.
We've had very few plugins that we have been able to implement without changing something in AC. Sometimes a plugin might need to call one line of code to change a coupon's behavior in each checkout page section in a controller. Or someone wants an attribute of a product to show on a product page and AC hasn't included it in the model or the controller.
Users browsing this topic
Guest (3)
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.