Solution by IcaRoNek0.
All solutions are
f(x)≡0,
f(x)=x+c(x∈R, c∈R),
and
f(x)={x−1,a,x=0,x=0,a∈R.
Put F(x)=1+f(x). The equation becomes
F(xF(y))=F(x)+xF(y)−x.(1)
If F(y0)=0 for some y0, then (1) gives F(x)=x+F(0), which is the second family.
Now suppose F never vanishes. Let
S=F(R),c(x)=F(x)−x.
Then 0∈/S, and every affine map
Tx(t)=xt+c(x)
maps S into S.
We first show that S has no nonzero additive period. The map T−1 is a reflection, so it maps S onto itself. Hence if S+r⊆S, then also S−r⊆S, and consequently S+r=S. Let P be the additive subgroup of periods of S.
For x=0, the composition TxT1/x is a translation; hence its translation amount qx lies in P. If p∈P, then
Tx∘(t↦t+p)∘T1/x
is translation by qx+xp and maps S into itself, so xp∈P. A nonzero p would force P=R, and then S=R, contradicting 0∈/S. Thus P={0}.
So qx=0, and each Tx with x=0 is a bijection of S. The maps TxT−1 and T−1Tx have the same slope; composing one with the inverse of the other gives a translation by
2c(x)+(x−1)c(−1),
which must be zero. If k=c(−1)/2, then
c(x)=k(1−x),F(x)=(1−k)x+k(x=0).
If k∈/{0,1}, this expression vanishes at a nonzero x, impossible.
If k=0, then F(x)=x for x=0, giving the third family. If k=1, then F(x)=1 for x=0, and (1) with x=1,y=0 gives F(0)=1, hence f≡0.
Direct substitution verifies all three families.