loxly Posted March 2, 2003 Share Posted March 2, 2003 I know this should be easy, and I knwo how to add the fields to the database, but how do I ad more fields to the product info page? I need stuff like Photographer, location, year, actually about 7 fields for "standard" stock photography search fields. And I need the fields to be searchable, either with Quick Find or Advanched Search. Possible? Debbie [no external urls in signatures please, kthanks] Link to comment Share on other sites More sharing options...
Guest Posted March 2, 2003 Share Posted March 2, 2003 Everything is possible, but i don't see why do you need more fields on product info page. You could just add that text and there will be no problem with search then too. Maybe i just don't understand what do you mean. :) Link to comment Share on other sites More sharing options...
loxly Posted March 2, 2003 Author Share Posted March 2, 2003 Industry standards have a certain format. Advertising professionals that would be looking for stock photos want to see things layed out a certain way and coding each description to include the information would be a pain, plus look unprofessional. [no external urls in signatures please, kthanks] Link to comment Share on other sites More sharing options...
loxly Posted March 2, 2003 Author Share Posted March 2, 2003 Sorry, hit submit before I was done... :) I tried using categories, but there are too many fields, and too many photos that would be in cross-categories. They also want to be able to sort on the fields, which isn't possible if theya re all lumped together in the description. Like, they want all the photographs by Deborah Carney of coral roses in Rochester, NY. That would be searching on 4 fields. Then the attributes would be file size and type, etc. Hope this makes it clearer! [no external urls in signatures please, kthanks] Link to comment Share on other sites More sharing options...
Gata Posted March 2, 2003 Share Posted March 2, 2003 Hi Debbie I am working on the same problem...What you said about industry standards is correct. I need to add fields such as author, publisher, isbn# etc.- standards in the book industry. I have a full database that already contains these fields that needs to be added to the store. Search capability within these specific fields is very helpful when wading through thousands of entries. I am able to add fields easily to the database, but am having trouble with figuring out what other files need to be changed. What I have come up so far is this: admin/categories.php admin/includes/languages/english.php admin/includes/languages/english/categories.php catalog/default.php catalog/product_info.php catalog/includes/modules/product_listing.php also the files from languages I have no working version of this yet- just me stumbling around trying to add these fields. The next beast to tackle is Easy Populate configuration. I will let you know of any success- and you can post if you come up with an answer! Link to comment Share on other sites More sharing options...
26.2 Posted March 2, 2003 Share Posted March 2, 2003 I am working on the same problem, but for an autodealership. I will use what you have offered and put up what I find. aj "Of the things we think, say or do: Is it the TRUTH? Is it FAIR to all concerned? Will it build GOODWILL and BETTER FRIENDSHIPS? Will it be BENEFICIAL to all concerned?" Link to comment Share on other sites More sharing options...
mouflon Posted March 2, 2003 Share Posted March 2, 2003 I have added extra fields, and in my case, these are the files I had to touch. Given more time, I can give you a breakdown off all the changes that need to be made, there are quite a few. Once done, integration into easy populate is relatively simple. admin/categories.php admin/includes/languages/english.php admin/includes/languages/english/categories.php admin/includes/classes/shopping_cart.php catalog/default.php catalog/product_info.php catalog/advanced_search_result.php catalog/includes/modules/product_listing.php catalog/includes/languages/english/default.php catalog/includes/languages/english/shopping_cart.php catalog/includes/modules/order_details.php catalog/includes/modules/product_listing.php Unexpect the Expected Link to comment Share on other sites More sharing options...
loxly Posted March 2, 2003 Author Share Posted March 2, 2003 Thanks! A breakdown would be great. And yes, adding the fields to easy populate, since they are all similar type and go to the dame table, will be relatively easy. Just have to be VERY CAREFUL, typos will kill it completely. :lol: Debbie [no external urls in signatures please, kthanks] Link to comment Share on other sites More sharing options...
loxly Posted March 2, 2003 Author Share Posted March 2, 2003 oops, Same table :oops: [no external urls in signatures please, kthanks] Link to comment Share on other sites More sharing options...
Gata Posted March 3, 2003 Share Posted March 3, 2003 Jeff, Thanks for the file list! I am so lost here- but what I am doing is opening each file that needs changes and searching for code that contains "product_name" (which I am using for book titles) and adding my new field after that using the same code. Is this what you would recommend doing? This is the only way I can think of to locate the right spots to edit. I know that for an end result I want: product_name | product_author | product_publisher | product_isbn | product_description | product_price Any tips on your methods for determining where to add the fields would be most appreciated. --Catherine Link to comment Share on other sites More sharing options...
mouflon Posted March 3, 2003 Share Posted March 3, 2003 OK - here we go. This code is very specific to this particular site. The field added is product_units It's a building supply company, and the listings are for contractors, who know what they want, so I have removed the link to product_info.php, but I have supplied code (untested) that should work. Also, I have the added field showing in the product_listing, which you may or may not want. Please forgive any spelling misteaks :-) in the filenames. To see figure the changes I made, look for any references to units, or product_unit I am planning to package this up as a tutorial on adding fields, but this should get you going. If you have any question, I'd be glad to help. take line numbers with a grain of salt, this is from a pretty old snapshot. (Part of this exercise is for me, so that I can bring this site up to MS1.) (I really don't suggest copy and pasting this code, just take it as an example) in /admin/categories.php ----------------------------------------------------------- around line 184 case 'insert_product': case 'update_product': if ( ($HTTP_POST_VARS['edit_x']) || ($HTTP_POST_VARS['edit_y']) ) { $HTTP_GET_VARS['action'] = 'new_product'; } else { $products_id = tep_db_prepare_input($HTTP_GET_VARS['pID']); $products_date_available = tep_db_prepare_input($HTTP_POST_VARS['products_date_available']); $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']), 'products_model' => tep_db_prepare_input($HTTP_POST_VARS['products_model']), 'products_image' => (($HTTP_POST_VARS['products_image'] == 'none') ? '' : tep_db_prepare_input($HTTP_POST_VARS['products_image'])), '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_unit' => tep_db_prepare_input($HTTP_POST_VARS['products_unit']), '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'])); ------------------------------------------------ around line 279 if ($HTTP_POST_VARS['copy_as'] == 'link') { if ($HTTP_POST_VARS['categories_id'] != $current_category_id) { $check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . tep_db_input($products_id) . "' and categories_id = '" . tep_db_input($categories_id) . "'"); $check = tep_db_fetch_array($check_query); if ($check['total'] < '1') { tep_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . tep_db_input($products_id) . "', '" . tep_db_input($categories_id) . "')"); } } else { $messageStack->add_session(ERROR_CANNOT_LINK_TO_SAME_CATEGORY, 'error'); } } elseif ($HTTP_POST_VARS['copy_as'] == 'duplicate') { $product_query = tep_db_query("select products_quantity, products_model, products_image, products_price, products_date_available, products_weight, products_unit, products_tax_class_id, manufacturers_id from " . TABLE_PRODUCTS . " where products_id = '" . tep_db_input($products_id) . "'"); $product = tep_db_fetch_array($product_query); tep_db_query("insert into " . TABLE_PRODUCTS . " (products_quantity, products_model,products_image, products_price, products_date_added, products_date_available, products_weight, products_status, products_tax_class_id, manufacturers_id, products_unit) values ('" . $product['products_quantity'] . "', '" . $product['products_model'] . "', '" . $product['products_image'] . "', '" . $product['products_price'] . "', now(), '" . $product['products_date_available'] . "', '" . $product['products_weight'] . "', '0', '" . $product['products_tax_class_id'] . "', '" . $product['manufacturers_id'] . "', '" . $product['products_units'] . "')"); $dup_products_id = tep_db_insert_id(); ------------------------------------------------ around line 347 if ($HTTP_GET_VARS['action'] == 'new_product') { if ( ($HTTP_GET_VARS['pID']) && (!$HTTP_POST_VARS) ) { $product_query = tep_db_query("select pd.products_name, pd.products_description, pd.products_url, p.products_id, p.products_quantity, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_unit, p.products_date_added, p.products_last_modified, date_format(p.products_date_available, '%Y-%m-%d') as products_date_available, p.products_status, p.products_tax_class_id, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . $HTTP_GET_VARS['pID'] . "' and p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "'"); $product = tep_db_fetch_array($product_query); ------------------------------------------- around line 486 <tr> <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> <tr> <td class="main"><?php echo TEXT_PRODUCTS_PRICE; ?></td> <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('products_price', $pInfo->products_price); ?></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_TAX_CLASS; ?></td> <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_pull_down_menu('products_tax_class_id', $tax_class_array, $pInfo->products_tax_class_id); ?></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_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> <tr> <td class="main"><?php echo TEXT_PRODUCTS_UNIT; ?></td> <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('products_unit', $pInfo->products_unit); ?></td> ------------------------------------------- around line 570 // 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("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_unit, 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 = '" . $HTTP_GET_VARS['pID'] . "'"); $product = tep_db_fetch_array($product_query); $pInfo = new objectInfo($product); $products_image_name = $pInfo->products_image; } -------------------------------------------------------- ---------------------------------------------------------- admin/includes/classes/shopping_cart.php around line 200 // products price $product_query = tep_db_query("select products_id, products_price, products_tax_class_id, products_weight,products_unit from " . TABLE_PRODUCTS . " where products_id='" . tep_get_prid($products_id) . "'"); if ($product = tep_db_fetch_array($product_query)) { $prid = $product['products_id']; $products_tax = tep_get_tax_rate($product['products_tax_class_id']); $products_price = $product['products_price']; $products_weight = $product['products_weight']; $products_unit = $product['products_unit']; ----------------------------------------------------- around line 252: function get_products() { global $languages_id; if (!is_array($this->contents)) return 0; $products_array = array(); reset($this->contents); while (list($products_id, ) = each($this->contents)) { $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_model, p.products_price, p.products_weight, p.products_unit, p.products_tax_class_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id='" . tep_get_prid($products_id) . "' and pd.products_id = p.products_id and pd.language_id = '" . $languages_id . "'"); if ($products = tep_db_fetch_array($products_query)) { $prid = $products['products_id']; $products_price = $products['products_price']; $specials_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . $prid . "' and status = '1'"); if (tep_db_num_rows($specials_query)) { $specials = tep_db_fetch_array($specials_query); $products_price = $specials['specials_new_products_price']; } $products_array[] = array('id' => $products_id, 'name' => $products['products_name'], 'model' => $products['products_model'], 'price' => $products_price, 'quantity' => $this->contents[$products_id]['qty'], 'weight' => $products['products_weight'], 'unit' => $products['products_unit'], 'final_price' => ($products_price + $this->attributes_price($products_id)), 'tax_class_id' => $products['products_tax_class_id'], 'attributes' => $this->contents[$products_id]['attributes']); } } return $products_array; } ------------------------------------------------ ------------------------------------------------ /admin/includes/languages/english.php define('JS_PRODUCTS_NAME', '* The new product needs a namen'); define('JS_PRODUCTS_DESCRIPTION', '* The new product needs a descriptionn'); define('JS_PRODUCTS_PRICE', '* The new product needs a price valuen'); define('JS_PRODUCTS_WEIGHT', '* The new product needs a weight valuen'); define('JS_PRODUCTS_UNIT', '* The new product needs a unit valuen'); define('JS_PRODUCTS_QUANTITY', '* The new product needs a quantity valuen'); define('JS_PRODUCTS_MODEL', '* The new product needs a model valuen'); define('JS_PRODUCTS_IMAGE', '* The new product needs an image valuen'); ------------------------------------------ ------------------------------------------ /admin/includes/languages/english/categories.php define('TEXT_PRODUCTS_STATUS', 'Products Status:'); define('TEXT_PRODUCTS_DATE_AVAILABLE', 'Date Available:'); define('TEXT_PRODUCT_AVAILABLE', 'In Stock'); define('TEXT_PRODUCT_NOT_AVAILABLE', 'Out of Stock'); define('TEXT_PRODUCTS_MANUFACTURER', 'Products Manufacturer:'); define('TEXT_PRODUCTS_NAME', 'Products Name:'); define('TEXT_PRODUCTS_DESCRIPTION', 'Products Description:'); define('TEXT_PRODUCTS_QUANTITY', 'Products Quantity:'); define('TEXT_PRODUCTS_MODEL', 'Products Model:'); define('TEXT_PRODUCTS_IMAGE', 'Products Image:'); define('TEXT_PRODUCTS_URL', 'Products URL:'); define('TEXT_PRODUCTS_URL_WITHOUT_HTTP', '<small>(without http://)</small>'); define('TEXT_PRODUCTS_PRICE', 'Products Price:'); define('TEXT_PRODUCTS_WEIGHT', 'Products Weight:'); define('TEXT_PRODUCTS_UNIT', 'Products Unit:'); --------------------------------------------------- --------------------------------------------------- catalog/advanced-search-result.php around line 136 // create column list $define_list = array('PRODUCT_LIST_MODEL' => PRODUCT_LIST_MODEL, 'PRODUCT_LIST_NAME' => PRODUCT_LIST_NAME, 'PRODUCT_LIST_MANUFACTURER' => PRODUCT_LIST_MANUFACTURER, 'PRODUCT_LIST_PRICE' => PRODUCT_LIST_PRICE, 'PRODUCT_LIST_QUANTITY' => PRODUCT_LIST_QUANTITY, 'PRODUCT_LIST_WEIGHT' => PRODUCT_LIST_WEIGHT, 'PRODUCT_LIST_UNIT' => PRODUCT_LIST_UNIT, 'PRODUCT_LIST_IMAGE' => PRODUCT_LIST_IMAGE, 'PRODUCT_LIST_BUY_NOW' => PRODUCT_LIST_BUY_NOW); asort($define_list); ---------------------------------------- around line 165 switch ($column_list[$col]) { case 'PRODUCT_LIST_MODEL': $select_column_list .= 'p.products_model'; break; case 'PRODUCT_LIST_MANUFACTURER': $select_column_list .= 'm.manufacturers_name'; break; case 'PRODUCT_LIST_QUANTITY': $select_column_list .= 'p.products_quantity'; break; case 'PRODUCT_LIST_IMAGE': $select_column_list .= 'p.products_image'; break; case 'PRODUCT_LIST_WEIGHT': $select_column_list .= 'p.products_weight'; break; case 'PRODUCT_LIST_UNIT': $select_column_list .= 'p.products_unit'; break; ------------------------------------------------- around line 261 case 'PRODUCT_LIST_MODEL': $order_str .= "p.products_model " . ($sort_order == 'd' ? "desc" : "") . ", pd.products_name"; break; case 'PRODUCT_LIST_NAME': $order_str .= "pd.products_name " . ($sort_order == 'd' ? "desc" : ""); break; case 'PRODUCT_LIST_MANUFACTURER': $order_str .= "m.manufacturers_name " . ($sort_order == 'd' ? "desc" : "") . ", pd.products_name"; break; case 'PRODUCT_LIST_QUANTITY': $order_str .= "p.products_quantity " . ($sort_order == 'd' ? "desc" : "") . ", pd.products_name"; break; case 'PRODUCT_LIST_IMAGE': $order_str .= "pd.products_name"; break; case 'PRODUCT_LIST_WEIGHT': $order_str .= "p.products_weight " . ($sort_order == 'd' ? "desc" : "") . ", pd.products_name"; break; case 'PRODUCT_LIST_UNIT': $order_str .= "p.products_unit " . ($sort_order == 'd' ? "desc" : "") . ", pd.products_name"; break; case 'PRODUCT_LIST_PRICE': $order_str .= "final_price " . ($sort_order == 'd' ? "desc" : "") . ", pd.products_name"; break; ---------------------------------------------------- ---------------------------------------------------- catalog/default.php around line 119 // create column list $define_list = array('PRODUCT_LIST_MODEL' => PRODUCT_LIST_MODEL, 'PRODUCT_LIST_NAME' => PRODUCT_LIST_NAME, 'PRODUCT_LIST_MANUFACTURER' => PRODUCT_LIST_MANUFACTURER, 'PRODUCT_LIST_PRICE' => PRODUCT_LIST_PRICE, 'PRODUCT_LIST_QUANTITY' => PRODUCT_LIST_QUANTITY, 'PRODUCT_LIST_WEIGHT' => PRODUCT_LIST_WEIGHT, 'PRODUCT_LIST_UNIT' => PRODUCT_LIST_UNIT, 'PRODUCT_LIST_IMAGE' => PRODUCT_LIST_IMAGE, 'PRODUCT_LIST_BUY_NOW' => PRODUCT_LIST_BUY_NOW); asort($define_list); --------------------------- around line 148 switch ($column_list[$col]) { case 'PRODUCT_LIST_MODEL': $select_column_list .= 'p.products_model'; break; case 'PRODUCT_LIST_NAME': $select_column_list .= 'pd.products_name'; break; case 'PRODUCT_LIST_MANUFACTURER': $select_column_list .= 'm.manufacturers_name'; break; case 'PRODUCT_LIST_QUANTITY': $select_column_list .= 'p.products_quantity'; break; case 'PRODUCT_LIST_IMAGE': $select_column_list .= 'p.products_image'; break; case 'PRODUCT_LIST_WEIGHT': $select_column_list .= 'p.products_weight'; break; case 'PRODUCT_LIST_UNIT': $select_column_list .= 'p.products_unit'; break; ------------------------------------ around line 206 switch ($column_list[$sort_col-1]) { case 'PRODUCT_LIST_MODEL': $listing_sql .= "p.products_model " . ($sort_order == 'd' ? "desc" : "") . ", pd.products_name"; break; case 'PRODUCT_LIST_NAME': $listing_sql .= "pd.products_name " . ($sort_order == 'd' ? "desc" : ""); break; case 'PRODUCT_LIST_MANUFACTURER': $listing_sql .= "m.manufacturers_name " . ($sort_order == 'd' ? "desc" : "") . ", pd.products_name"; break; case 'PRODUCT_LIST_QUANTITY': $listing_sql .= "p.products_quantity " . ($sort_order == 'd' ? "desc" : "") . ", pd.products_name"; break; case 'PRODUCT_LIST_IMAGE': $listing_sql .= "pd.products_name"; break; case 'PRODUCT_LIST_WEIGHT': $listing_sql .= "p.products_weight " . ($sort_order == 'd' ? "desc" : "") . ", pd.products_name"; break; case 'PRODUCT_LIST_UNIT': $listing_sql .= "p.products_unit " . ($sort_order == 'd' ? "desc" : "") . ", pd.products_name"; break; case 'PRODUCT_LIST_PRICE': $listing_sql .= "final_price " . ($sort_order == 'd' ? "desc" : "") . ", pd.products_name"; break; ---------------------------------------- ---------------------------------------- catalog/includes/classes/shopping_cart.php around line 205 // products price $product_query = tep_db_query("select products_id, products_price, products_tax_class_id, products_weight, products_unit from " . TABLE_PRODUCTS . " where products_id='" . tep_get_prid($products_id) . "'"); if ($product = tep_db_fetch_array($product_query)) { $prid = $product['products_id']; $products_tax = tep_get_tax_rate($product['products_tax_class_id']); $products_price = $product['products_price']; $products_weight = $product['products_weight']; $products_unit = $product['products_unit']; ------------------------------------------ around line 263 function get_products() { global $languages_id; if (!is_array($this->contents)) return 0; $products_array = array(); reset($this->contents); while (list($products_id, ) = each($this->contents)) { $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_model, p.products_price, p.products_weight, p.products_unit, p.products_tax_class_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id='" . tep_get_prid($products_id) . "' and pd.products_id = p.products_id and pd.language_id = '" . $languages_id . "'"); if ($products = tep_db_fetch_array($products_query)) { $prid = $products['products_id']; $products_price = $products['products_price']; --------------------------------- around line 288 $products_array[] = array('id' => $products_id, 'name' => $products['products_name'], 'model' => $products['products_model'], 'price' => $products_price, 'quantity' => $this->contents[$products_id]['qty'], 'weight' => $products['products_weight'], 'unit' => $products['products_unit'], 'final_price' => ($products_price + $this->attributes_price($products_id)), 'tax_class_id' => $products['products_tax_class_id'], 'attributes' => $this->contents[$products_id]['attributes']); ------------------------------------- ----------------------------------------- catalog/includes/languages/english/checkout_confirmation.php around line 29 define('TEXT_STOCK_WARNING', 'Stock Warning'); define('TEXT_MULTIPLE_SHIPMENT', 'Multiple Shipments'); define('TEXT_UNIQUE_SHIPMENT', 'Single Shipment'); define('TEXT_UNITS', 'Units of'); define('TEXT_IMEDIATE_DELIVER', 'We have for immediate delivery:'); define('TEXT_STOCK_WARNING_DESC', 'The products marked with <span class="markProductOutOfStock">' . STOCK_MARK_PRODUCT_OUT_OF_STOCK . '</span> are not available in the quantity you requested. Choose Multiple Shipments if you want the available quantity in stock to be delivered right away and the rest later or Single Shipment to wait until the quantity you requested is available in our stock.'); ------------------------------------------------------ ------------------------------------------------------ catalog/includes/languages/english/default.php around line 30 define('TABLE_HEADING_PRICE', 'Price'); define('TABLE_HEADING_WEIGHT', 'Weight'); define('TABLE_HEADING_UNIT', 'Units'); define('TABLE_HEADING_BUY_NOW', ' '); ----------------------------------------------- ----------------------------------------------- catalog/includes/languages/english/shopping_cart.php around line 15 define('TABLE_HEADING_REMOVE', 'Remove'); define('TABLE_HEADING_QUANTITY', 'Qty./Units'); define('TABLE_HEADING_MODEL', 'Model'); ---------------------------------------------- ----------------------------------------------- catalog/includes/modules/order_details.php around line 46 // Quantity box or information as an input box or text if (strstr($PHP_SELF, FILENAME_SHOPPING_CART)) { echo ' <td align="left" valign="top" class ="main"><input type="text" name="cart_quantity[]" value="' . $products[$i]['quantity'] . '" size="4"><input type="hidden" name="products_id[]" value="' . $products[$i]['id'] . '"> ' . $products[$i]['unit']. '</td>' . "n"; } else { echo ' <td align="center" valign="top" class ="main">' . $products[$i]['quantity'] . $products[$i]['unit'] . '</td>' . "n"; } ----------------------------------------- ------------------------------------------ catalog/includes/modules/product_listing.php around line 81 case 'PRODUCT_LIST_UNIT': $lc_text = TABLE_HEADING_UNIT; $lc_align = 'left'; break; case 'PRODUCT_LIST_IMAGE': $lc_text = TABLE_HEADING_IMAGE; $lc_align = 'center'; break; case 'PRODUCT_LIST_BUY_NOW': $lc_text = TABLE_HEADING_BUY_NOW; $lc_align = 'center'; break; ------------------------------------- around line 157 case 'PRODUCT_LIST_WEIGHT': $lc_align = 'right'; $lc_text = ' ' . $listing_values['products_weight'] . ' '; break; case 'PRODUCT_LIST_UNIT': $lc_align = 'left'; $lc_text = ' ' . $listing_values['products_unit'] . ' '; break; ------------------------ -------------------------- catalog/product_info.php OK - here I'm flying without testing, because on this site, this page is never referenced. around line 43 <?php $product_info = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_unit, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . $HTTP_GET_VARS['products_id'] . "' and pd.products_id = '" . $HTTP_GET_VARS['products_id'] . "' and pd.language_id = '" . $languages_id . "'"); if (!tep_db_num_rows($product_info)) { // product not found in database ?> now, it's up to you where you want to put it, but it would be something like this: <?php if (PRODUCT_LIST_MODEL) { echo ' <tr>' . "n" . ' <td colspan="2" class="pageHeading">' . $product_info_values['products_model'] . '</td>' . "n" . ' </tr>' . "n"; } echo ' <tr>' . "n" . ' <td class="pageHeading">'. TEXT_PRODUCTS_UNIT .'</td><td class="pageHeading">' . $product_info_values['products_unit'] . '</td>' . "n" . ' </tr>' . "n"; ?> again remember, I've not tried the code for product_info.php, but's a place to start. Unexpect the Expected Link to comment Share on other sites More sharing options...
Guest Posted March 3, 2003 Share Posted March 3, 2003 Thanks for the info mouflon, I followed your guide to add some more Movie categories like Director, Language, Subtitles, Audio, Video ect.. It works fine after some fine tweaking, (errors created by-myself not paying attention - its my DEV shop anyway), I just want to ask is it possible to have these "NEW FIELDS" included in the search.. I cant seem to find any info about this, like I want to be able to search for (Steven Speilberg) in (Directors).. . What I am hoping to achieve in the end is the abilty to show my "NEW FIELDS" in the description page "product_info.php" with dynamically generated links on say "Director" or "Actor" that can be clicked and will take the user the the products listing page and will show them all the Films that contain the specific "Director" or "Actor" depending on the link that was clicked. This sort of rule above will applie to all my new fields, YEAR, DVD-REGION ... lala, Thanks for the CODE you supplied above ( It really helped ) BTW I'm making the changes on (MS1 2.2) all the coding is the same, Cheers Lee Link to comment Share on other sites More sharing options...
mouflon Posted March 3, 2003 Share Posted March 3, 2003 Searching these fields is indeed possiple. It will involve some tweaking of advanced_search.php and advanced_search_results.php. You will have to add new definitions to the array $option_box in advanced_search.php, make the appropriate entries and changes in the language file, then look at the code around line 255 in advanced_search_results.php and you should get an idea of what needs to be added there. Unexpect the Expected Link to comment Share on other sites More sharing options...
Guest Posted March 23, 2003 Share Posted March 23, 2003 This coding is suited to a DVD or VHS Video shop, but could be altered to suit any store needing heaps of new database fields to display. This is a sample of the fields that are being generated dynamically from the database for each dvd displayed, please note this info is comming from its own fields in a table and not the standard osCommerce "Desciption" field, such as: (b)star_title:(/B) star_1, star_2, star_3, star_4 ect... (b)director_title:(/B) director_name ect... working version can be seen on my store, </noscript> <br><br><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?> </td> </tr> <?php } ?> </table><?php echo $product_info['products_pal_ntsc_advice']; ?></a><br><br><b><?php echo $product_info['products_movie_sub_title']; ?></b><br><?php echo stripslashes($product_info['products_description']); ?></p> <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" id="AutoNumber1" height="1"> <tr> <td class="mainbold" width="99" height="0" align="left" valign="top"><?php echo $product_info['products_starring_ch']; ?></td> <td class="main" width="884" height="0" align="left" valign="top"><?php echo $product_info['products_st1']; ?> <?php echo $product_info['products_st2']; ?> <?php echo $product_info['products_st3']; ?> <?php echo $product_info['products_st4']; ?> <?php echo $product_info['products_st5']; ?> <?php echo $product_info['products_st6']; ?> <?php echo $product_info['products_st7']; ?> <?php echo $product_info['products_st8']; ?> <?php echo $product_info['products_st9']; ?> <?php echo $product_info['products_st10']; ?> <?php echo $product_info['products_st11']; ?> <?php echo $product_info['products_st12']; ?></td> </tr> <tr> <td class="mainbold" width="99" height="0" align="left" valign="top"><?php echo $product_info['products_director_ch']; ?></td> <td class="main" width="884" height="0" align="left" valign="top"><?php echo $product_info['products_director']; ?></td> </tr> <tr> <td class="mainbold" width="99" height="0" align="left" valign="top">Distributor:</td> <td class="main" width="884" height="0" align="left" valign="top"><?php echo $product_info['manufacturers_name']; ?></td> </tr> <tr> <td class="mainbold" width="99" height="0" align="left" valign="top"><?php echo $product_info['products_audio_ch']; ?></td> <td class="main" width="884" height="0" align="left" valign="top"><?php echo $product_info['products_audio']; ?></td> </tr> <tr> <td class="mainbold" width="99" height="0" align="left" valign="top"><?php echo $product_info['products_screen_format_ch']; ?></td> <td class="main" width="884" height="0" align="left" valign="top"><?php echo $product_info['products_screen_format']; ?></td> </tr> <tr> <td class="mainbold" width="99" height="0" align="left" valign="top"><?php echo $product_info['products_colour_ch']; ?></td> <td class="main" width="884" height="0" align="left" valign="top"><?php echo $product_info['products_colour']; ?></td> </tr> <tr> <td class="mainbold" width="99" height="0" align="left" valign="top"><?php echo $product_info['products_region_ch']; ?></td> <td class="main" width="884" height="0" align="left" valign="top"><?php echo $product_info['products_region']; ?></td> </tr> <tr> <td class="mainbold" width="99" height="0" align="left" valign="top"><?php echo $product_info['products_pal_format_ch']; ?></td> <td class="main" width="884" height="0" align="left" valign="top"><b><a href="java script:pal_ntsc_info();"><?php echo $product_info['products_pal_format']; ?></a></b></td> </tr> <tr> <td class="mainbold" width="99" height="0" align="left" valign="top"><?php echo $product_info['products_running_time_ch']; ?></td> <td class="main" width="884" height="0" align="left" valign="top"><?php echo $product_info['products_running_time']; ?></td> </tr> <tr> <td class="mainbold" width="99" height="0" align="left" valign="top"><?php echo $product_info['products_year_ch']; ?></td> <td class="main" width="884" height="0" align="left" valign="top"><?php echo $product_info['products_year']; ?></td> </tr> <tr> <td class="mainbold" width="99" height="0" align="left" valign="top"><?php echo $product_info['products_disc_amount_ch']; ?></td> <td class="main" width="884" height="0" align="left" valign="top"><?php echo $product_info['products_disc_amount']; ?></td> </tr> <tr> <td class="mainbold" width="99" height="0" align="left" valign="top"><?php echo $product_info['products_lang_ch']; ?></td> <td class="main" width="884" height="0" align="left" valign="top"><?php echo $product_info['products_lang1']; ?> <?php echo $product_info['products_lang2']; ?> <?php echo $product_info['products_lang3']; ?> <?php echo $product_info['products_lang4']; ?> <?php echo $product_info['products_lang5']; ?> <?php echo $product_info['products_lang6']; ?> <?php echo $product_info['products_lang7']; ?> <?php echo $product_info['products_lang8']; ?> <?php echo $product_info['products_lang9']; ?> <?php echo $product_info['products_lang10']; ?> <?php echo $product_info['products_lang11']; ?> <?php echo $product_info['products_lang12']; ?></td> </tr> <tr> <td class="mainbold" width="99" height="0" align="left" valign="top"><?php echo $product_info['products_sub_ch']; ?></td> <td class="main" width="884" height="0" align="left" valign="top"><?php echo $product_info['products_sub1']; ?> <?php echo $product_info['products_sub2']; ?> <?php echo $product_info['products_sub3']; ?> <?php echo $product_info['products_sub4']; ?> <?php echo $product_info['products_sub5']; ?> <?php echo $product_info['products_sub6']; ?> <?php echo $product_info['products_sub7']; ?> <?php echo $product_info['products_sub8']; ?> <?php echo $product_info['products_sub9']; ?> <?php echo $product_info['products_sub10']; ?> <?php echo $product_info['products_sub11']; ?> <?php echo $product_info['products_sub12']; ?> <?php echo $product_info['products_sub13']; ?> <?php echo $product_info['products_sub14']; ?> <?php echo $product_info['products_sub15']; ?> <?php echo $product_info['products_sub16']; ?> <?php echo $product_info['products_sub16']; ?></td> </tr> <tr> <td class="mainbold" width="99" height="0" align="left" valign="top"><?php echo $product_info['products_rating_ch']; ?></td> <td class="main" width="884" height="0" align="left" valign="top"><?php echo $product_info['products_rating']; ?> <?php echo $product_info['products_ratings_advice']; ?></td> </tr> </table> <?php $products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . $languages_id . "'"); $products_attributes = tep_db_fetch_array($products_attributes_query); if ($products_attributes['total'] > 0) { echo '<b>' . TEXT_PRODUCT_OPTIONS . '</b><br>' . '<table border="0" cellpadding="0" cellspacing"0">'; $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . $languages_id . "'"); while ($products_options_name = tep_db_fetch_array($products_options_name_query)) { $selected = 0; $products_options_array = array(); echo '<tr><td class="main">' . $products_options_name['products_options_name'] . ':</td><td>' . "n"; $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . $products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . $languages_id . "'"); while ($products_options = tep_db_fetch_array($products_options_query)) { $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']); if ($products_options['options_values_price'] != '0') { $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') '; } } echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']]); echo '</td></tr>'; } echo '</table>'; } ?> </td> </tr> <?php $reviews = tep_db_query("select count(*) as count from " . TABLE_REVIEWS . " where products_id = '" . $HTTP_GET_VARS['products_id'] . "'"); $reviews_values = tep_db_fetch_array($reviews); if ($reviews_values['count'] > 0) { ?> <tr> <td class="main"><br><?php echo TEXT_CURRENT_REVIEWS . ' ' . $reviews_values['count']; ?></td> </tr> <?php } if (tep_not_null($product_info['products_url'])) { ?> <tr> <td class="main"><br><?php echo sprintf(TEXT_MORE_INFORMATION, tep_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($product_info['products_url']), 'NONSSL', true, false)); ?></td> </tr> <?php } if ($product_info['products_date_available'] > date('Y-m-d H:i:s')) { ?> <tr> <td align="center" class="smallText"><br><?php echo sprintf(TEXT_DATE_AVAILABLE, tep_date_long($product_info['products_date_available'])); ?></td> </tr> <?php } else { ?> <tr> <td align="center" class="smallText"><br><?php echo sprintf(TEXT_DATE_ADDED, tep_date_long($product_info['products_date_added'])); ?></td> </tr> <?php } ?> <tr> <td><br><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td><center><a href="<?php echo tep_href_link(FILENAME_PRODUCT_REVIEWS, substr(tep_get_all_get_params(), 0, -1)); ?>"><?php echo tep_image_button('button_reviews.gif', IMAGE_BUTTON_REVIEWS); ?></a></center></td> </tr> </table></td> </tr> <tr> <td><br> <?php if ( (USE_CACHE == 'true') && !defined('SID')) { echo tep_cache_also_purchased(3600); } else { include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS); } } ?> </td> </tr> </table></form></td> <!-- body_text_eof //--> <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2"> <!-- right_navigation //--> <?php require(DIR_WS_INCLUDES . 'column_right.php'); ?> <!-- right_navigation_eof //--> </table></td> </tr> </table> <!-- body_eof //--> <!-- footer //--> <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> <!-- footer_eof //--> <br> </body> </html> <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?> (This is the SQL Script to create the additional fields in MySQL *fast) I would personally only use this on a empty database if you already have products in you shop YOU WILL LOOSE THEM! If you have nothing to loose I recommend running this database empty script first http://www.oscommerce.com/community/contributions,353/page,2'>empty database all my fields have been named according to my needs.. DROP TABLE IF EXISTS products;CREATE TABLE products ( products_id int(11) NOT NULL auto_increment, products_image varchar(255) default NULL, products_image_2 varchar(255) default NULL, products_movie_sub_title varchar(255) default NULL, products_audio_ch varchar(255) default NULL, products_audio varchar(255) default NULL, products_screen_format_ch varchar(255) default NULL, products_screen_format varchar(255) default NULL, products_colour_ch varchar(255) default NULL, products_colour varchar(255) default NULL, products_pal_format_ch varchar(255) default NULL, products_pal_format varchar(255) default NULL, products_region_ch varchar(255) default NULL, products_region varchar(255) default NULL, products_year_ch varchar(255) default NULL, products_year varchar(255) default NULL, products_running_time_ch varchar(255) default NULL, products_running_time varchar(255) default NULL, products_disc_amount_ch varchar(255) default NULL, products_disc_amount varchar(255) default NULL, products_pal_ntsc_advice varchar(255) default NULL, products_rating_ch varchar(255) default NULL, products_rating varchar(255) default NULL, products_ratings_advice varchar(255) default NULL, products_model varchar(12) default NULL, products_price decimal(15,4) NOT NULL default '0.0000', products_quantity int(4) NOT NULL default '0', products_status tinyint(1) NOT NULL default '0', products_weight decimal(5,2) NOT NULL default '0.00', products_tax_class_id int(11) NOT NULL default '0', manufacturers_id int(11) default NULL, products_date_added datetime NOT NULL default '0000-00-00 00:00:00', products_last_modified datetime default NULL, products_date_available datetime default NULL, products_ordered int(11) NOT NULL default '0', products_director_ch varchar(255) default NULL, products_director varchar(255) default NULL, products_starring_ch varchar(255) default NULL, products_st1 varchar(255) default NULL, products_st2 varchar(255) default NULL, products_st3 varchar(255) default NULL, products_st4 varchar(255) default NULL, products_st5 varchar(255) default NULL, products_st6 varchar(255) default NULL, products_st7 varchar(255) default NULL, products_st8 varchar(255) default NULL, products_st9 varchar(255) default NULL, products_st10 varchar(255) default NULL, products_st11 varchar(255) default NULL, products_st12 varchar(255) default NULL, products_lang_ch varchar(255) default NULL, products_lang1 varchar(255) default NULL, products_lang2 varchar(255) default NULL, products_lang3 varchar(255) default NULL, products_lang4 varchar(255) default NULL, products_lang5 varchar(255) default NULL, products_lang6 varchar(255) default NULL, products_lang7 varchar(255) default NULL, products_lang8 varchar(255) default NULL, products_lang9 varchar(255) default NULL, products_lang10 varchar(255) default NULL, products_lang11 varchar(255) default NULL, products_lang12 varchar(255) default NULL, products_sub_ch varchar(255) default NULL, products_sub1 varchar(255) default NULL, products_sub2 varchar(255) default NULL, products_sub3 varchar(255) default NULL, products_sub4 varchar(255) default NULL, products_sub5 varchar(255) default NULL, products_sub6 varchar(255) default NULL, products_sub7 varchar(255) default NULL, products_sub8 varchar(255) default NULL, products_sub9 varchar(255) default NULL, products_sub10 varchar(255) default NULL, products_sub11 varchar(255) default NULL, products_sub12 varchar(255) default NULL, products_sub13 varchar(255) default NULL, products_sub14 varchar(255) default NULL, products_sub15 varchar(255) default NULL, products_sub16 varchar(255) default NULL, PRIMARY KEY (products_id), KEY idx_products_date_added (products_date_added) ) TYPE=MyISAM; Hope this gets you started, I will post this info also on the forum a you are the 5th person to PM asking for my modified code. Cheers Lee Link to comment Share on other sites More sharing options...
azer Posted June 4, 2003 Share Posted June 4, 2003 wow , cool , this psot arrives at the moment i need to add fields for a computer shop ! i m gonna work on thoses tweakings ... if anyone work on a computer componant shop, he could message me , will share the experience .. thanks to you that posted your codes ! :o MS2 Link to comment Share on other sites More sharing options...
halbert Posted June 10, 2003 Share Posted June 10, 2003 This was a great little tutorial on how to add fields, but now I have a slightly more complicated problem: I want to display a couple of those fields in the products listing that you get when you click on the Category. So I need to figure out how OSC is displaying the list and so on. Anyone have any suggestions on how this might be accomplished, or if someone has already done it?? Thanks! -al Link to comment Share on other sites More sharing options...
Guest Posted June 10, 2003 Share Posted June 10, 2003 Hi halbert, I have just added fields there now, so It can be done. do you intend on going with the same column style ( the way osCommerce is now) or do/have you already changed the file structure? Files Involved: /catalog/includes/modules/prouduct_listing.php /catalog/includes/modules/languages/(your Lang)/default.php and you also need to add the new columns into MySQL database via PhpMyAdmin (easy) this will allow you admin control over the columns like you have now in: /Admin/ -->Configuration-->Product Listing (options on/off & sort) if this is what your after let me know an i can post some code snippets, the way i did it.. I can now enable diasble the new column "DVD movie Ratings" Like R18 or PG-13 ect.. in the new column. Cheers Lee Link to comment Share on other sites More sharing options...
azer Posted June 10, 2003 Share Posted June 10, 2003 yeah maxi dvd , let us see what u managed to do it , thanks for the effort ! 8) MS2 Link to comment Share on other sites More sharing options...
halbert Posted June 10, 2003 Share Posted June 10, 2003 Hi - thanks for the reply. I'm sticking to the standard OSC column listing. I was *trying* to change the product_listing.php file but it boggles my head. I am having a massive flashback to the time when I swore I'd never program again! Code snippets would be welcome! As well, what did you change in the database? I haven't looked there yet. -al Link to comment Share on other sites More sharing options...
Guest Posted June 10, 2003 Share Posted June 10, 2003 Ok, :idea: :arrow: How to Add New Column to Product Listing + Custom Database Field The new field we are adding "for tutorial purpose" is -Manufacturers ID- (m.manufacturers_id) This is a default database field, I will explain how to add a custom database field furthur down as there are a couple more steps involved. Lets start by making a back up of all the files involved first, this should go with-out saying. :twisted: I also recommend backing up you database by doing a PhpMyAdmin database Export, tick file Structure, data, and drop table, Save as (osCommerce_backup.sql). this allows you do a total restore if something does goes wrong. :!: Files Involved: 1. My SQL database Import2. /catalog/default.php 3. /catalog/includes/modules/prouduct_listing.php 4. /catalog/includes/languages/(your Lang)/default.php 1. - First of --> :arrow: Import My SQL Database Field into PhpMyAdmin: (This creates the new column named "Display My New Field" for us in /Admin/ -->Configuration-->Product Listing) INSERT INTO `configuration` (`configuration_id`, `configuration_title`, `configuration_key`, `configuration_value`, `configuration_description`, `configuration_group_id`, `sort_order`, `last_modified`, `date_added`, `use_function`, `set_function`) VALUES ('', 'Display My New Field', 'PRODUCT_LIST_MY_NEW_FIELD', '3', '<br><br><b>0 = Off and 1, 2, 3, sorts its<br>placement Left or Right', 8, 5, now(), now(), NULL, NULL); Lets begin file modifications: :wink: ================================================================================ === 2.a - Open /catalog/default.php, aprox line 118 look for this part: // create column list $define_list = array('PRODUCT_LIST_MODEL' => PRODUCT_LIST_MODEL, 'PRODUCT_LIST_NAME' => PRODUCT_LIST_NAME, 'PRODUCT_LIST_MANUFACTURER' => PRODUCT_LIST_MANUFACTURER, 'PRODUCT_LIST_PRICE' => PRODUCT_LIST_PRICE, 'PRODUCT_LIST_QUANTITY' => PRODUCT_LIST_QUANTITY, 'PRODUCT_LIST_WEIGHT' => PRODUCT_LIST_WEIGHT, 'PRODUCT_LIST_IMAGE' => PRODUCT_LIST_IMAGE, 'PRODUCT_LIST_BUY_NOW' => PRODUCT_LIST_BUY_NOW); asort($define_list); 2.a - Paste this new "code" into the middle of the above array list: 'PRODUCT_LIST_MY_NEW_FIELD' => PRODUCT_LIST_MY_NEW_FIELD, // New Column It Should now look like: :D // create column list $define_list = array('PRODUCT_LIST_MODEL' => PRODUCT_LIST_MODEL, 'PRODUCT_LIST_NAME' => PRODUCT_LIST_NAME, 'PRODUCT_LIST_MY_NEW_FIELD' => PRODUCT_LIST_MY_NEW_FIELD, // New Column 'PRODUCT_LIST_MANUFACTURER' => PRODUCT_LIST_MANUFACTURER, 'PRODUCT_LIST_PRICE' => PRODUCT_LIST_PRICE, 'PRODUCT_LIST_QUANTITY' => PRODUCT_LIST_QUANTITY, 'PRODUCT_LIST_WEIGHT' => PRODUCT_LIST_WEIGHT, 'PRODUCT_LIST_IMAGE' => PRODUCT_LIST_IMAGE, 'PRODUCT_LIST_BUY_NOW' => PRODUCT_LIST_BUY_NOW); asort($define_list); 2.b - Furthur down the page aprox line 151 look for this part: case 'PRODUCT_LIST_NAME': $select_column_list .= 'pd.products_name'; break; Paste this new "code" directly underneath break; (Im using --> m.manufacturers_id <-- for example purpose) case 'PRODUCT_LIST_MY_NEW_FIELD': // New Column $select_column_list .= 'm.manufacturers_id'; // We add our "database value" break; It Should now look like: :D case 'PRODUCT_LIST_NAME': $select_column_list .= 'pd.products_name'; break; case 'PRODUCT_LIST_MY_NEW_FIELD': // New Column $select_column_list .= 'm.manufacturers_id'; // We add our "database value" break; 2.c - Furthur down the page aprox line 216 look for this part: case 'PRODUCT_LIST_NAME': $listing_sql .= "pd.products_name " . ($sort_order == 'd' ? 'desc' : ''); break; Paste this new "code" directly underneath break; case 'PRODUCT_LIST_MY_NEW_FIELD': // We add SORTING to Table $listing_sql .= "m.manufacturers_id " . ($sort_order == 'd' ? 'desc' : ''); // field to SORT break; It Should now look like: :D case 'PRODUCT_LIST_NAME': $listing_sql .= "pd.products_name " . ($sort_order == 'd' ? 'desc' : ''); break; case 'PRODUCT_LIST_MY_NEW_FIELD': // We add SORTING to Table $listing_sql .= "m.manufacturers_id " . ($sort_order == 'd' ? 'desc' : ''); // field to SORT break; Ok --> Save file and close. :P ================================================================================ = 3.a - Open /catalog/includes/modules/prouduct_listing.php Around line 50 look for this part case 'PRODUCT_LIST_NAME': $lc_text = TABLE_HEADING_PRODUCTS; $lc_align = ''; break; Paste this new "code" directly underneath break; case 'PRODUCT_LIST_MY_NEW_FIELD': // Create our New Column $lc_text = TABLE_HEADING_MY_NEW_FIELD; // Set Column Name /language/default.php $lc_align = 'center'; // align column center break; It Should now look like: :D case 'PRODUCT_LIST_NAME': $lc_text = TABLE_HEADING_PRODUCTS; $lc_align = ''; break; case 'PRODUCT_LIST_MY_NEW_FIELD': // Create our New Column $lc_text = TABLE_HEADING_MY_NEW_FIELD; // Set Column Name /language/default.php $lc_align = 'center'; // align column center break; 3.c - Furthur down the page (this part looks a litter different) Around line 115 you will see another referance to: case 'PRODUCT_LIST_NAME': $lc_align = ''; if (isset($HTTP_GET_VARS['manufacturers_id'])) { $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a>'; } else { $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a> '; } break; Paste this new "code" directly underneath break; case 'PRODUCT_LIST_MY_NEW_FIELD': $lc_align = 'center'; // Center our Field $lc_text = '<b>' . $listing['manufacturers_id'] . '</b>'; // Display our Field break;/ It Should now look like: :D switch ($column_list[$col]) { case 'PRODUCT_LIST_NAME': $lc_align = ''; if (isset($HTTP_GET_VARS['manufacturers_id'])) { $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a>'; } else { $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a> '; } break; case 'MY_NEW_FIELD': case 'PRODUCT_LIST_MY_NEW_FIELD': $lc_align = 'center'; // Center our Field $lc_text = '<b>' . $listing['manufacturers_id'] . '</b>'; // Display our Field break;/ Ok --> Save file and close. :P ================================================================================ = 4. - Define the New Field name in you Languages: /catalog/includes/languages/(your Lang)/default.php open /catalog/(your-language)/default.php Find around line 23: define('TABLE_HEADING_PRODUCTS', 'Product Name'); and under it paste our new field Table Name. define('TABLE_HEADING_MY_NEW_FIELD', 'New MaxiDVD'); Ok --> Save file and close. :oha: ================================================================================ = CONGATS!! :-) :whaasup: Thats it your done... our new column should be turned-on by default in the SQL script from above, if the new column is not in the right place, ie: Left - Middle - Right, just go into: /Admin/ -->Configuration-->Product Listing and changes as required 1 = left, 5 = middle, 10 = right, 0 = OFF ================================================================================ ================= NEED TO DISPLAY CUSTOM DATABASE FIELDS?: If you have added "Custom fields" to your database in Tables: products_description OR products and want to display for example: "products_movie_rating" instead of "manufacturers_id" Simply replace all instances of manufacturers_id with products_movie_rating And all instances of m.manufacturers_id with p.products_movie_rating And all instances of $listing['manufacturers_id'] with $listing['products_movie_rating'] Its Too easy.. Have FUN! :bigups: BTW: The p. in "p.products_movie_rating" indicates TABLE products And pd. in "pd.products_url" indicates TABLE products_description ================================================================================ = ADD MORE THAN 1 COLUMN?: You can easily add a 2nd or 3rd new column by following this guide again, but you need to change: The Defines to something else Example: PRODUCT_LIST_MY_NEW_FIELD Make new PRODUCT_LIST_MY_OTHER_NEW_FIELD TABLE_HEADING_MY_NEW_FIELD Make new TABLE_HEADING_MY_OTHER_NEW_FIELD $listing['manufacturers_id'] Make new $listing['products_movie_rating'] And the SQL script referances to PRODUCT_LIST_MY_NEW_FIELD will also need to be changed to suit. I have tested this code in theory - and it works for me --> osCommerce MS1 2.2. I just confirmed these instuctions work and followed them step by step on a clean DEV site to success. any probs just post them here. Cheers Lee, hope this helps you. :thumbsup: Link to comment Share on other sites More sharing options...
Guest Posted June 10, 2003 Share Posted June 10, 2003 1 mistake in instuctions above SECTION 3.c - Furthur down the page the last box in that section shows a referance too case 'MY_NEW_FIELD': <-- thats not meant to be there, so dont copy that part. Chow! :lol: Link to comment Share on other sites More sharing options...
azer Posted June 11, 2003 Share Posted June 11, 2003 thanks for this tutorial , so precise ! 8) :lol: before doing any big mistake can u tell me on wich version did u perform your modifications ... since i have the MS1 ian load 5 version , i was told that some product variables and the way listing is done is different from the other versions ... so i prefer checking before ! :roll: MS2 Link to comment Share on other sites More sharing options...
halbert Posted June 11, 2003 Share Posted June 11, 2003 Thanks Lee, I'm giving it a whirl... In the mean time, any idea what would cause my product listing to show "buy now" several times, all messed up? It happens both with SEC 1.0b's product_listing.php and the un-modified 5-18 version of the file. I posted the problem in the following thread... http://www.oscommerce.com/forums/viewtopic.php...6568&highlight= And my site is at: http://www.frozenlightning.com/catalog/default.php Thanks! -al Link to comment Share on other sites More sharing options...
Guest Posted June 11, 2003 Share Posted June 11, 2003 Hi halbert, what a mess ay?, SEC 1.0b's product_listing.php and the un-modified 5-18 version of the file. I havent used SEC at all, so i cant comment there, the error could be in /default.php have you tried replacing that with a standard MS1 2.2 release --> just something to try. and also try un-modified 5-18 product_listing.php again with that. It looks like /default.php is responsible did you mess with any code there when you installed SEC ? I've never seen Display Add Multiple Columns? so i gues its part of SEC, looks to me its doing what its meant too --> only all 1 column LOL, in your admin/ --> configuration --> product listing, you have really high values assigned to your sorting, any reason for that. 22, 10, 20, 30, 40 mine range under the < 10's like 1,2,3,4,5 ect.. might be something to look at, also make sure none share the same value like Buy It Now Column = 5 and Price Column = 5 as they can and will cancell each other out, thats whats going on with the other fellow at the top of that post you mentioned - he assigned all number 1's to his product listings -> this means all columns are fighting to be displayed at position one, thus conflict.. see how you go.. Cheers Lee Link to comment Share on other sites More sharing options...
Guest Posted June 11, 2003 Share Posted June 11, 2003 Hi halbert, if you cant fix the buy it now column problem, send me copies of your /default.php and modules/product_listing.php I will have a quick look at them to see if I can find any problems. Cheers Lee Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.