thegeekstore Posted January 26, 2004 Posted January 26, 2004 hi! i've added a new field to the osc database through phpmyadmin. the only thing i did differently from the instructions provided by sandalwood was that i named the field products_title and i've set it as varchar(64). other than that i've followed the instructions. i keep getting these error messages when i try to add a new product or view a product info page... 1054 - Unknown column 'p.products_title' in 'field list' can anyone tell me whats going wrong? or maybe an alternate way to have the new fields work? i'd like for the new field to show up in my admin to enter it in, in the product listings pages and in the product info page. i'm trying to set osC up for a music/book/movie store. so i need artist, title, format.. etc. fields. please help!!!! any help would be great! -aasha here is the code i tried to follow: >############################## STOP WAR AND WRITE CODE!!!!## ############################## oscommerce php piece of code for adding new product fields by sandalwood sandalwoo_d@yahoo.com April 2003 ############################ Sorted by Actions Date ############ #13.04.2003## ##################################################################################### ### 1.DB --------------------------------- We add new fields in osc database example: products_size, int(3), null:yes 2.admin\includes\languages\english\categories.php The Admin english label for this field ------------------------------------------------------------------------- define('TEXT_PRODUCTS_SIZE', 'Products Size:'); 3.catalog\includes\languages\english\product_info.php The Catalog english label for this field ------------------------------------------------------- define('TEXT_PRODUCTS_SIZE','Products Size:'); We do the above steps in all languages files we use! 4.admin/categories.php So we can add/edit/view the new fields in admin area ---------------------------------- ------> In $sql_data_array = array('products_quantity' => tep_db_prepare_input($HTTP_POST_VARS['products_quantity']), ....... we add 'products_size' => tep_db_prepare_input($HTTP_POST_VARS['products_size']), -------> In $product_query = tep_db_query("select products_quantity,.... we add the new field(s) ...products_size.... ------> In tep_db_query("insert into " . TABLE_PRODUCTS . " ( we add the new field(s) ....products_size....values...."', '" . $product['products_size']..... -------> In if ( ($HTTP_GET_VARS['pID']) && (!$HTTP_POST_VARS) ) { $product_query = tep_db_query("select pd.products_name, we add the new field(s) ///,p.products_size.... ------> After <tr> <td class="main"><?php echo TEXT_PRODUCTS_WEIGHT; ?></td> <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('products_weight', $pInfo->products_weight); ?></td> </tr> we add <tr> <td class="main"><?php echo TEXT_PRODUCTS_SIZE; ?></td> <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('products_size', $pInfo->products_size); ?></td> </tr> -------> In // copy image only if modified $products_image = tep_get_uploaded_file('products_image'); $image_directory = tep_get_local_path(DIR_FS_CATALOG_IMAGES); if (is_uploaded_file($products_image['tmp_name'])) { tep_copy_uploaded_file($products_image, $image_directory); $products_image_name = $products_image['name']; } else { $products_image_name = $HTTP_POST_VARS['products_previous_image']; } } else { $product_query = tep_db_query(..... We add the new field(s) ..,p.products_size.... 5.catalog/product_info.php Adding the new field(s) in catalog product view page ------> In ?php $product_info_query = tep_db_query("select We add the new field(s) ...p.products_size... ------> Before <p><?php echo stripslashes($product_info['products_description']); ?></p> And After </table> We Add <?php //sandalwood if (tep_not_null($product_info['products_size'])) { echo TEXT_PRODUCTS_SIZE.' '.$product_info['products_size']; } //end of sandalwood ?> END OF 13.4.2003 Actions ######################################################################### please help me!! i've posted so many topics on the osC forums but no one ever answers.. so please help me i also have many other topics i'd like to address/ask about osC.. but i thought i should start with a major one first. thanks to anyone and everyone in advance! Quote
TCH-Rob Posted January 27, 2004 Posted January 27, 2004 Without seeing the rest of the code I am going to guess that it is in the catalog/product_info.php file. Though we don't directly support osc I wouldn't mind having a look at this in a little more detail. Would you mind sending me a PM or email with your catalog/product_info.php file attached or pasted in? This may benefit my personal site in the future. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.