Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

I hope I explain my self correctly.

I need to include 2 JS. The first JS code needs to be in all pages of the site.
I could try doing that in 2 ways:

  1. header.phtml
  2. Miscellaneous scripts through magento configuration, design, head.

that would work perfectly fine for the firs script.

<script>/*DO NOT ALTER *** */(function(e){var t="1340",n=document,r,i,s={http:"http://cdn.mplxtms.com/s/MasterTMS.min.js",https:"https://secure-cdn.mplxtms.com/s/MasterTMS.min.js"},o=s[/\w+/.exec(window.location.protocol)[0]];i=n.createElement("script"),i.type="text/javascript",i.async=!0,i.src=o+"#"+t,r=n.getElementsByTagName("script")[0],r.parentNode.insertBefore(i,r),i.readyState?i.onreadystatechange=function(){if(i.readyState==="loaded"||i.readyState==="complete")i.onreadystatechange=null}:i.onload=function(){try{e()}catch(t){}}})(function(){});</script>

However, I am required to do the following on the success page,

http://screencast.com/t/ze0b43gjUyWV

I already know how to generate the script dinamically based on: http://stackoverflow.com/questions/25219799/how-to-integrate-dinamically-js-code-in-success-page-in-magentohttps://stackoverflow.com/questions/25219799/how-to-integrate-dinamically-js-code-in-success-page-in-magento

but I dont know how to include that code only on the head tag of success page.

I hope I explain my self correctly.

I need to include 2 JS. The first JS code needs to be in all pages of the site.
I could try doing that in 2 ways:

  1. header.phtml
  2. Miscellaneous scripts through magento configuration, design, head.

that would work perfectly fine for the firs script.

<script>/*DO NOT ALTER *** */(function(e){var t="1340",n=document,r,i,s={http:"http://cdn.mplxtms.com/s/MasterTMS.min.js",https:"https://secure-cdn.mplxtms.com/s/MasterTMS.min.js"},o=s[/\w+/.exec(window.location.protocol)[0]];i=n.createElement("script"),i.type="text/javascript",i.async=!0,i.src=o+"#"+t,r=n.getElementsByTagName("script")[0],r.parentNode.insertBefore(i,r),i.readyState?i.onreadystatechange=function(){if(i.readyState==="loaded"||i.readyState==="complete")i.onreadystatechange=null}:i.onload=function(){try{e()}catch(t){}}})(function(){});</script>

However, I am required to do the following on the success page,

http://screencast.com/t/ze0b43gjUyWV

I already know how to generate the script dinamically based on: http://stackoverflow.com/questions/25219799/how-to-integrate-dinamically-js-code-in-success-page-in-magento

but I dont know how to include that code only on the head tag of success page.

I hope I explain my self correctly.

I need to include 2 JS. The first JS code needs to be in all pages of the site.
I could try doing that in 2 ways:

  1. header.phtml
  2. Miscellaneous scripts through magento configuration, design, head.

that would work perfectly fine for the firs script.

<script>/*DO NOT ALTER *** */(function(e){var t="1340",n=document,r,i,s={http:"http://cdn.mplxtms.com/s/MasterTMS.min.js",https:"https://secure-cdn.mplxtms.com/s/MasterTMS.min.js"},o=s[/\w+/.exec(window.location.protocol)[0]];i=n.createElement("script"),i.type="text/javascript",i.async=!0,i.src=o+"#"+t,r=n.getElementsByTagName("script")[0],r.parentNode.insertBefore(i,r),i.readyState?i.onreadystatechange=function(){if(i.readyState==="loaded"||i.readyState==="complete")i.onreadystatechange=null}:i.onload=function(){try{e()}catch(t){}}})(function(){});</script>

However, I am required to do the following on the success page,

http://screencast.com/t/ze0b43gjUyWV

I already know how to generate the script dinamically based on: https://stackoverflow.com/questions/25219799/how-to-integrate-dinamically-js-code-in-success-page-in-magento

but I dont know how to include that code only on the head tag of success page.

Source Link
Luis Valencia
  • 303
  • 1
  • 4
  • 15

How to add Javascript code on the head tag, for only success page,

I hope I explain my self correctly.

I need to include 2 JS. The first JS code needs to be in all pages of the site.
I could try doing that in 2 ways:

  1. header.phtml
  2. Miscellaneous scripts through magento configuration, design, head.

that would work perfectly fine for the firs script.

<script>/*DO NOT ALTER *** */(function(e){var t="1340",n=document,r,i,s={http:"http://cdn.mplxtms.com/s/MasterTMS.min.js",https:"https://secure-cdn.mplxtms.com/s/MasterTMS.min.js"},o=s[/\w+/.exec(window.location.protocol)[0]];i=n.createElement("script"),i.type="text/javascript",i.async=!0,i.src=o+"#"+t,r=n.getElementsByTagName("script")[0],r.parentNode.insertBefore(i,r),i.readyState?i.onreadystatechange=function(){if(i.readyState==="loaded"||i.readyState==="complete")i.onreadystatechange=null}:i.onload=function(){try{e()}catch(t){}}})(function(){});</script>

However, I am required to do the following on the success page,

http://screencast.com/t/ze0b43gjUyWV

I already know how to generate the script dinamically based on: http://stackoverflow.com/questions/25219799/how-to-integrate-dinamically-js-code-in-success-page-in-magento

but I dont know how to include that code only on the head tag of success page.