Add JavaScript or CSS in Block class

 To add JavaScript or CSS files to the head section of the resulting HTML page, you can add something like this to the _prepareLayout function of a Block class:

As you can see, we can use the layout model to get the head block an use its functions to add files. This doesn’t work inside of […]

Automatically load custom product attribute with collection (every time)

You can do this with the following XML in your config.xml:

But ATTENTION: This can become a performance issue, because it loads the attribute every time the product collection is loaded! If you added too many attributes, the performance can get worse!