Fix variable context

Avoid attribution to the variable $newProducts inside the if. It caused the code to potentially misbehave throwing errors of:
"variable $newProducts not defined".