pafranklin Posted October 20, 2005 Posted October 20, 2005 On updating a product within the admin area I receiev the followig error message: Warning: Invalid argument supplied for foreach() in /homepages/30/d116518341/htdocs/catalog/admin/categories.php on line 816 The code for the /catalog/admin/categories.php file around this area is (with line 816 highlighted in BOLD). Please can someone help. I cannot see a problem actually being caused by this but would like to correct if possible: <!-- Category Fields EOF //--> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> <tr> <td class="main" align="right"><?php echo tep_draw_hidden_field('products_date_added', (tep_not_null($pInfo->products_date_added) ? $pInfo->products_date_added : date('Y-m-d'))) . tep_image_submit('button_preview.gif', IMAGE_PREVIEW) . '??<a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . (isset($HTTP_GET_VARS['pID']) ? '&pID=' . $HTTP_GET_VARS['pID'] : '')) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'; ?></td> </tr> </table></form> <?php } elseif ($action == 'new_product_preview') { if (tep_not_null($HTTP_POST_VARS)) { $pInfo = new objectInfo($HTTP_POST_VARS); $products_name = $HTTP_POST_VARS['products_name']; $products_description = $HTTP_POST_VARS['products_description']; $products_url = $HTTP_POST_VARS['products_url']; } else { $product_query = tep_db_query("select p.products_id, pd.language_id, pd.products_name, pd.products_description, pd.products_url, p.products_quantity, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = pd.products_id and p.products_id = '" . (int)$HTTP_GET_VARS['pID'] . "'"); $product = tep_db_fetch_array($product_query); $pInfo = new objectInfo($product); $products_image_name = $pInfo->products_image; } $form_action = (isset($HTTP_GET_VARS['pID'])) ? 'update_product' : 'insert_product'; echo tep_draw_form($form_action, FILENAME_CATEGORIES, 'cPath=' . $cPath . (isset($HTTP_GET_VARS['pID']) ? '&pID=' . $HTTP_GET_VARS['pID'] : '') . '&action=' . $form_action, 'post', 'enctype="multipart/form-data"'); $languages = tep_get_languages(); for ($i=0, $n=sizeof($languages); $i<$n; $i++) { if (isset($HTTP_GET_VARS['read']) && ($HTTP_GET_VARS['read'] == 'only')) { $pInfo->products_name = tep_get_products_name($pInfo->products_id, $languages[$i]['id']); $pInfo->products_description = tep_get_products_description($pInfo->products_id, $languages[$i]['id']); $pInfo->products_url = tep_get_products_url($pInfo->products_id, $languages[$i]['id']); } else { $pInfo->products_name = tep_db_prepare_input($products_name[$languages[$i]['id']]); $pInfo->products_description = tep_db_prepare_input($products_description[$languages[$i]['id']]); $pInfo->products_url = tep_db_prepare_input($products_url[$languages[$i]['id']]); } ?> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . '?' . $pInfo->products_name; ?></td> <td class="pageHeading" align="right"><?php echo $currencies->format($pInfo->products_price); ?></td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> <tr> <!-- Category Fields //--> <td class="main"> <?php echo tep_image(DIR_WS_CATALOG_IMAGES . $products_image_name, $pInfo->products_name, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'align="right" hspace="5" vspace="5"'); $extra_fields_names_query = tep_db_query("SELECT * FROM " . TABLE_PRODUCTS_EXTRA_FIELDS); while ($extra_fields_names = tep_db_fetch_array($extra_fields_names_query)) { $extra_field_name[$extra_fields_names['products_extra_fields_id']] = $extra_fields_names['products_extra_fields_name']; } if ($HTTP_GET_VARS['read'] == 'only') { $products_extra_fields_query = tep_db_query("SELECT * FROM " . TABLE_PRODUCTS_TO_PRODUCTS_EXTRA_FIELDS . " WHERE products_id=" . (int)$HTTP_GET_VARS['pID']); while ($products_extra_fields = tep_db_fetch_array($products_extra_fields_query)) { $extra_fields_array[$products_extra_fields['products_extra_fields_id']] = $products_extra_fields['products_extra_fields_value']; } } else { $extra_fields_array = $HTTP_POST_VARS['extra_field']; } foreach ($extra_fields_array as $key=>$val) { ?> <b><? echo $extra_field_name[$key];?>:</b> <? echo $val;?><br /> <? } echo "<br />" . $pInfo->products_description; ?> </td> <!-- Category Fields EOF //--> You will never learn if you don't try. And boy am I trying....!
pafranklin Posted October 20, 2005 Author Posted October 20, 2005 Oh yes, I am using the attributes sets contribution which is working fine. Not sure whether there is something in that?? Please point me in the right direction. You will never learn if you don't try. And boy am I trying....!
Guest Posted October 20, 2005 Posted October 20, 2005 That is a bug in the Category Fields contribution and has been answered in the support thread Matti
pafranklin Posted October 20, 2005 Author Posted October 20, 2005 Brilliant - Please can you point me towards this. I have ahad a quick scout around but could not see it??!! Many thanks. You will never learn if you don't try. And boy am I trying....!
Recommended Posts
Archived
This topic is now archived and is closed to further replies.