Jump to content

Generate Reference


Paulo Nacif
 Share

Recommended Posts

Hello, i am new in presta shop developer.

How put my code in new product, being created in a module?

<script>
function gerar(){
if(document.getElementById('reference').value == '') {
hoje = new Date()
dia = hoje.getDate()
mes = hoje.getMonth()
ano = hoje.getFullYear()
hora = hoje.getHours();
minutos = hoje.getMinutes();
segundos =  hoje.getSeconds();
if (dia < 10)
dia = "0" + dia;
mes++;
if (hora < 10)
hora = "0" + hora;
if (minutos < 10)
minutos = "0" + minutos;
if (segundos < 10)
segundos = "0" + segundos;
document.getElementById('reference').value = ano+''+dia+''+mes+''+segundos+''+hora+''+minutos;
}
}
window.onload = gerar();
</script>

Share this post


Link to post
Share on other sites

you can create module with hook: displayBackOfficeFooter

 

just use .tpl file with your code (don't forget about {literal}{/literal} tags)

 

i think that this is all in this case

  • Like 1

Share this post


Link to post
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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More