2

I read an article once that said when creating your own Magento theme that you should keep the default class/id names?

I heard it's best to keep these in place as some modules reference these classes/ids and stripping them out completely may cause issues.

Is this true? I just want to know what is best practice.

3 Answers 3

3

Changing them most likely won't cause errors, unless you're dealing with dynamic parts as Matthias mentioned. The product page, address form, and checkout are all pretty JS-heavy, and changing IDs is liable to break them.

A bigger reason to maintain the default classes as much as possible is extension compatibility. Every third-party module you use will most likely be based on the default theme. If you changed it to your own set of classes, they will probably not look or work as expected without a bunch of extra skinning.

2

I think it is helpful to keep the class/id names in some situations.

Especially the parts using JS (e.g. checkout, product configuration) rely on them so you would have to rewrite them and/or update your code when upgrades happen.

1

I always keep the classes (and especially ID's), but remove the styles associated with them in the style.css (once you copy it to your own package/theme). Then depending on how it should look, I add my own classes in the html. This way, the magento js performs as expected and extensions have a higher chance of working out of the box.

This does require you to copy over a lot of templates to your theme, but I think this is better than having non-DRY and messy CSS.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.