You have an extra paren after prod1. try this
.>0 and if(selected(${productId},'prod1'), .<=2,.<=500)
If that does not go I tend to write it all out
if(selected(${productId},'prod1'), .>0 and .<=2, .>0 and .<=500)
If that still does not removed the dot and use the full field name notation. I have seen it happen where the short hand . gets messed up when its complicated.
I have done this successfully.