Jump to content

Generate Reference


Paulo Nacif

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>

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