Yea, noticed that, but that’s not the issue. I figured that it’s not the writing out of the string (that seems to work after all), it’s the part where I check if it exists. I did not included that in my original post cause I wanted to figure out the standard way of writing things first.
doesn’t work, you’re using single-quotes in it, which means that the field it’s trying to get is `product_image_$i`. There might be other issues going on (I’m mobile right now so can’t test it thoroughly), but that’s at least why that’s not working.
I think the whole confusion is rooted in the way quotes have to be used. It sure confused me, because of the double quotes (see @melindrea‘s comment), but it does seem the way to go. This is what I’ll end up with, although I can’t fully wrap my head around why it’s working….