Jump to content

hookDisplayHeader - echo any output crashes CART and other features?


Jeff A

Recommended Posts

Hello,

I have a simple module that uses hookDisplayProductAdditionalInfo() to add additional product information.

I also wanted some CSS - so I added hookDisplayHeader() - and there, because it was so tiny, I just echo inline ``<style>...</style>``.

In my simple testing, the product information looked good and the CSS was applied, so I released my minor module to production.

I was horrified to discover later, that if you emit any output in hookDisplayHeader() that all CART functions fail - with no errors in the logs. In fact, the POST can be seen returning 200 - but the returned document has the in-line STYLE outside all tags - it screws up the CART and ORDER functions completely.

I went back and checked the PrestaShop Developer Docs - no mention of this horrible danger?

Such a bad design? I expected hookDisplayHeader() output only to be in the <head></head> part of an HTML document.

Is there any better documentation for Developers? Is there a better hook that only is included in <head/>?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...