fuzzybean Posted May 12, 2003 Posted May 12, 2003 Figured i would post this to help anyone else who had a similar problem.. When i edit a product with an image.. It works just fine. But, when i edit a product without an image, the catalog ends up displaying a broken image because it ends up inserting "Array" into the image field. Depending on your view point.. the actual problem could be in the following function.. or the call to the function which is shown below.. function tep_draw_hidden_field($name, $value = '') { $field = '<input type="hidden" name="' . $name . '" value="'; if ($value != '') { $field .= trim($value); } else { $field .= trim($GLOBALS[$name]); } $field .= '">'; return $field; } The call to the function is in admin/categories.php and looks like this.. echo tep_draw_hidden_field('products_image', stripslashes($products_image_name)); Which should be just fine.. except the call to the function sends the name for the hidden field as "products_image" and the value for the field is "$products_image_name" but the function, after testing for an empty value being passed, uses the global value of the field name which in this case is not the same thing. $products_image is previously set in the script as the uploaded image, so it is an array. My solution was to unset $products_image before the function call.. so it now looks like this.. unset($products_image); echo tep_draw_hidden_field('products_image', stripslashes($products_image_name)); maybe there is a better way of fixing it.. but i didn't want to mess with variable names and create an even bigger problem..
Guest Posted May 12, 2003 Posted May 12, 2003 Hi, This is the bug array fix found in the help documents at wiki. Array Bug Fix When you put a product in without an image the words "array" are added to the image section and, in your store, that product image will still show up as broken. This is the fix. admin/categories.php On approximately line 193 you will see this code ... $products_date_available = (date('Y-m-d') < $products_date_available) ? $products_date_available : 'null'; $sql_data_array = array('products_quantity' => tep_db_prepare_input($HTTP_POST_VARS['products_quantity']), change to -- //array bug fix $products_date_available = (date('Y-m-d') < $products_date_available) ? $products_date_available : 'null'; if (tep_db_prepare_input($HTTP_POST_VARS['products_image'])=='Array')$HTTP_POST_VARS['products_image']=''; $sql_data_array = array('products_quantity' => tep_db_prepare_input($HTTP_POST_VARS['products_quantity']), //end array bug fix
Recommended Posts
Archived
This topic is now archived and is closed to further replies.