Is there a function such that $f(xyz)=f(x)f(y)f(z)$, for any $x,y,z\in G$ but $f$ is not an endomorphism? 
I am required to show that, for a $n\in\mathbb{N}$ and $(G,\cdot)$ a finite group of order $n$, if $n$ is even there is a function $f:G \rightarrow G$ such that $f(xyz)=f(x)f(y)f(z)$, for any $x,y,z\in G$ but $f$ is not an endomorphism. Is this true for $n$ odd?

I chose $\DeclareMathOperator{\ord}{ord}f(x)=\ord(x)$, but I am unsure that $\ord(xy)=\ord(x)\ord(y)$ for any $x,y\in G$.
At least I obtained that it is not a morphism if it respects that property, because indeed as for $e=a^{kl}a^{ph}a^{-1}$, where $(k,p)=1$ and $kl+ph=1$, $f(e)=f(a^{kl}a^{ph}a^{-1})=-klph$, which is false if $f$ is a morphism. 
 A: First of all note that $f(e)=f(e)^3$ and so $f(e)^2=e$. This gives us a hint about $f(e)$. 
So if $n$ is even then pick $g\in G$ such that $g^2=e$, $g\neq e$ (which exists by Cauchy's theorem) and define $f(x)=g$, i.e. the constant function at $g$. Obviously $f(xyz)=f(x)f(y)f(z)$ regardless of what $x,y,z$ are. But since $g\neq e$ then $f$ is not a group homomorphism.
Now if $n$ is odd then the condition $f(e)^2=e$ implies that $f(e)=e$ (this time by Lagrange's theorem). And therefore for any $x,y$ we have
$$f(xy)=f(exy)=f(e)f(x)f(y)=ef(x)f(y)=f(x)f(y)$$
and so $f$ is a group homomorphism.

but I am unsure that $ord(xy)=ord(x)ord(y)$ for any $x,y\in G$.

If $G$ is non-trivial then that never holds for all $x,y$. Consider $x\neq e$ and $y=x^{-1}$. You can also easily check that $ord$ does not satisfy the original condition as well, i.e. consider $ord(exx^{-1})$.
Also talking about $ord$ does not make sense to begin with since the codomain of $ord$ is $\mathbb{N}$, it's not even a group. Not to mention that domain and codomain are different although that assumption is unnecessary.
