AbleCommerce Forums
»
AbleCommerce
»
General Questions
»
Theme file minimum requirements and Plugin CSS?
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?
|
|
|
|
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.
|
|
|
|
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 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.
|
|
|
|
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 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.
|
|
|
|
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.
|
|
|
|
AbleCommerce Forums
»
AbleCommerce
»
General Questions
»
Theme file minimum requirements and Plugin CSS?
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