Replies: 5 comments 9 replies
-
mmm the problem is that, if we do that, we may break all custom themes that depends on those classes :-( I would work on some RWD2 theme which has to tackle all of these things, and more. |
Beta Was this translation helpful? Give feedback.
-
I analyzed the issue better. Canceling the functionality of col-1 and col-2 classes from Bootstrap is only a temporary solution, if I want to use them in the future, they will not work. Therefore, the solution I see is to change the name of those classes inherited from the Magento era. So as not to interfere with other classes in the future I will call them col1 and col2. There are already classes that start with these prefixes, for example col1-layout, col2-right-layout. |
Beta Was this translation helpful? Give feedback.
-
I decided to add a prefix to all classes in the col-* format, thus col-1 becomes bs-col-1. The OM code remains unchanged, as do the custom template files. The classes are intuitive and cover all 12 columns in the grid for a viewport bellow 576. I expanded from two initials to twelve because I found an older theme from Template Monster where it uses col-3 and col-4 classes. I will create a paragraph in the Readme file to warn users when using Bootstrap 4. I will call the section Known Issues. |
Beta Was this translation helpful? Give feedback.
-
If we take a look into this file magento-lts/skin/frontend/default/default/css/styles.css Lines 123 to 126 in 6b0408f Magento team used not only col-1 and col-2 but col-3 and col-4 classes. The fastest solution is to rename all 12 Bootstrap classes from col-* to bs-col-* format to avoid future issues. In general, I use special CSS files with which I change the behavior of the default ones that are delivered with Magento/OM and themes. The rule is to load these files at the end. For example, extra_styles.css - here are the classes created by me. |
Beta Was this translation helpful? Give feedback.
-
I recently faced an issue in the use of some Bootstrap components and I said not to keep it to myself because maybe others will also face it. There is a conflict with the Prototype library, in case of a collapse the opening and closing of the hidden block does not work smoothly. Below is the JS code I used to resolve this conflict. A noconflict.js file must be created which can be in /skin/.../theme/js and added to the theme page layout. I went further and avoided a conflict with JQuery too. There is a file already for this issue located in /js/lib/jquery. jQuery.noConflict();
if (Prototype.BrowserFeatures.ElementExtensions) {
var disablePrototypeJS = function (method, pluginsToDisable) {
var handler = function (event) {
event.target[method] = undefined;
setTimeout(function () {
delete event.target[method];
}, 0);
};
pluginsToDisable.each(function (plugin) {
jQuery(window).on(method + '.bs.' + plugin, handler);
});
},
pluginsToDisable = ['collapse', 'dropdown', 'modal', 'tooltip', 'popover', 'tab'];
disablePrototypeJS('show', pluginsToDisable);
disablePrototypeJS('hide', pluginsToDisable);
}
var $j = jQuery.noConflict(); |
Beta Was this translation helpful? Give feedback.
-
In OpenMage there are phtml template files where you will find col-1, col-2 classes. Please be careful when using Bootstrap 4 and 5 because these Magento classes actually mean that container will take 1 or 2 columns in the grid.
This is not an issue with Bootstrap 3 because col-* doesn't exist, it was introduced in version 4. I quickly solved the problem by commenting the Bootstrap classes, but it is a temporary solution, until I can make an assessment. Perhaps these classes inherited from the Magento era should be renamed and modified in the styles.css file, but this will have an big impact on all themes that are already in production.
With Tailwind it is not an issue because it uses columns-*.
Beta Was this translation helpful? Give feedback.
All reactions