Issue is fixed #1532

Gallery is not defined for all execution points.  This can be resolved be addressing the above issue, and just manipulating the $product_gallery array.