Jump to content

Javascript mysteriously disappears using hook


gmz-collection

Recommended Posts

I've been having an issue with a custom order hook that generates some Javascript. Part of my code is being output, but the rest mysteriously gets combined with some other Javascript on the page.

 

I've disabled all CCC and caching, but still some "optimization" seems to take place. I have verified that the code is being correctly generated, by directly echo'ing it back to the browser. Once I inspect the page's source (Chrome), part of the generated code is missing. Inspecting the DOM tree shows that part of the script contents have been moved elsewhere (into GA-tracking to be specific).

 

I feel like I've exhausted all possibilities, so any insights would be greatly appreciated.

Link to comment
Share on other sites

I'm sorry, I had to strip down my original post a bit, because I was having a very hard time getting my post to even submit to the forum. Seems like the spam filter was a little trigger happy.

 

There is probably a better way to get this done, but I chose to add a hook to controllers/front/OrderConfirmationController.php:

http://pastebin.com/RFfKU5as

 

And then refer to it in the template file themes/simplio/order-confirmation.tpl:

http://pastebin.com/pWEMMqf4

 

On completing an order, all code within the CDATA section is mysteriously taken out and moved to another part of the document. Any help would be greatly appreciated.

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...