baber Posted July 1, 2003 Posted July 1, 2003 Dear all, I need to add the product part number into the Product Listing Page so that customers can order products with that number. This is how I plan to do it. 1) First of all, I will add a new field called product_part_number to products table in mySQL. 2) Then I will add a new textbox - product_part_number into the entry page (Add New Product Page). 3)Lastly, I would go to the Product Listing page to configure that page to show the Part Number in product listing. I have done the first part. Can anyone show me how to do the second and third part?
Guest Posted July 1, 2003 Posted July 1, 2003 2. The add new products page is part of admin/categories.php. If you just want it to appear first, you can replace this code: <tr><?php echo tep_draw_form('new_product', FILENAME_CATEGORIES, 'cPath=' . $cPath . (isset($HTTP_GET_VARS['pID']) ? '&pID=' . $HTTP_GET_VARS['pID'] : '') . '&action=new_product_preview', 'post', 'enctype="multipart/form-data"'); ?> <td><table border="0" cellspacing="0" cellpadding="2"> <tr> <td class="main"><?php echo TEXT_PRODUCTS_STATUS; ?></td> <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_radio_field('products_status', '1', $in_status) . ' ' . TEXT_PRODUCT_AVAILABLE . ' ' . tep_draw_radio_field('products_status', '0', $out_status) . ' ' . TEXT_PRODUCT_NOT_AVAILABLE; ?></td> </tr> with this code: <tr><?php echo tep_draw_form('new_product', FILENAME_CATEGORIES, 'cPath=' . $cPath . (isset($HTTP_GET_VARS['pID']) ? '&pID=' . $HTTP_GET_VARS['pID'] : '') . '&action=new_product_preview', 'post', 'enctype="multipart/form-data"'); ?> <td><table border="0" cellspacing="0" cellpadding="2"> <tr> <td class="main"><?php echo TEXT_PRODUCT_PART_NUMBER; ?></td> <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('products_part_number', $pInfo->products_part_number); ?></td> </tr> <tr> <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> <tr> <td class="main"><?php echo TEXT_PRODUCTS_STATUS; ?></td> <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_radio_field('products_status', '1', $in_status) . ' ' . TEXT_PRODUCT_AVAILABLE . ' ' . tep_draw_radio_field('products_status', '0', $out_status) . ' ' . TEXT_PRODUCT_NOT_AVAILABLE; ?></td> </tr> and add to admin/includes/language/english/categories.php define('TEXT_PRODUCT_PART_NUMBER', 'Product Part Number: '); 3. Do you want it to show in the product listing (shows multiple products)? Or the product info page (shows all customer viewable information about one product)? Or both? I'm going to assume that you want the information available on the product info page (product_info.php). If you want to add it to the product listing page (product_listing.php), the process will be similar. Replace this code: <p><?php echo stripslashes($product_info['products_description']); ?></p> with this code: <p><?php echo TEXT_PRODUCT_PART_NUMBER . $product_info['product_part_number']; echo stripslashes($product_info['products_description']); ?></p> and add this to includes/languages/english/product_info.php define('TEXT_PRODUCT_PART_NUMBER', 'Product Part Number: '); No testing has been done. Use at your own risk. This should at least get you started though. Btw, now that I've written this, it occurs to me to point out that you could probably use the products_model field to do what you want without making any code changes. Good luck, Matt
baber Posted July 1, 2003 Author Posted July 1, 2003 Hi iiinetworks, Thanks you so much for your codes. After adding the code in part (2), the part number textbox shows up, but I am unable to update the record. I looked into mySQL and the changes are not reflected there too. Is there any sql statements I have to add in the categories.php file to do that? I appreciate any help or advice. Thanks!
Guest Posted July 1, 2003 Posted July 1, 2003 $sql_data_array = array('products_quantity' => tep_db_prepare_input($HTTP_POST_VARS['products_quantity']), 'products_model' => tep_db_prepare_input($HTTP_POST_VARS['products_model']), 'products_price' => tep_db_prepare_input($HTTP_POST_VARS['products_price']), 'products_date_available' => $products_date_available, 'products_weight' => tep_db_prepare_input($HTTP_POST_VARS['products_weight']), 'products_status' => tep_db_prepare_input($HTTP_POST_VARS['products_status']), 'products_tax_class_id' => tep_db_prepare_input($HTTP_POST_VARS['products_tax_class_id']), 'manufacturers_id' => tep_db_prepare_input($HTTP_POST_VARS['manufacturers_id'])); add 'product_part_number' => tep_db_prepare_input($HTTP_POST_VARS['product_part_number']), somewhere before the manufacturers_id. The insert or update will process this automatically. Good luck, Matt
baber Posted July 1, 2003 Author Posted July 1, 2003 Thanks Matt, It worked for me. I tried to make the part number display on the Product Listing Page but it still doesn't show up. I inserted the following code: case 'PRODUCT_PARTNUMBER': $lc_align = 'right'; $lc_text = ' ' . $listing['products_partnumber'] . ' '; break; in the sections for ($col=0, $n=sizeof($column_list); $col<$n; $col++) { switch ($column_list[$col]) { and for ($col=0, $n=sizeof($column_list); $col<$n; $col++) { $lc_align = ''; I don't know if that's the right way to do it or I need to do more thing. Greatly appreciate your help!
baber Posted July 2, 2003 Author Posted July 2, 2003 Hi, Thanks Matt. I found a previous Post that solves my problem. The URL is http://www.oscommerce.com/forums/viewtopic.php...er=asc&start=10 Thanks!
Recommended Posts
Archived
This topic is now archived and is closed to further replies.