This is a discussion on Adding another Manufacturer type box within the osCommerce 2.2 Modification Help forums, part of the osCommerce 2.2 Forums category; Hi all, We sell used romance novels and I'm trying to add a new "field" to the site that covers ...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
|
#1
| |||
| |||
| Hi all, We sell used romance novels and I'm trying to add a new "field" to the site that covers Series Titles. I've added fields before, but this one I want to have listed on the home page like the Manufacturer Box (on our site its Author's Last Name box). Is there a contribution for this? I thought there was, but can't find it and a search for previous help with this can't be found either. Is this task hard? is that why no one is tryin it I added the other fields using Add New Product Field contribution and was going to use that same one to add this field....its just "hooking" it up to a box that I'm unsure about. Thanks in advance, Lalla NothingButRomance.com/shop/catalog |
|
#2
| |||
| |||
| Hi The easiest way to add custom boxes is to modify a similar existing one. As long as you know the name of the new field you can adapt an existing side-box to gather the information. For example the includes/boxes/best_sellers.php is a very simple box that will almost do what you want as standard. You should save a copy with a different name (eg series_titles.php), modify the SQL query on lines 13-17 to read something like "SELECT DISTINCT products_id, products{extra_field} FROM " . TABLE_PRODUCTS . " ORDER BY {whatever} LIMIT {however many yuou want to display}" basically just a simple query to select the relevant data. Then change the variable names in that file so they don't conflict with best_sellers.php (they probably won't anyway but it will save confusion), and just include() your new box in the column_left or column_right. If you can be bothered set up new entries (eg BOX_HEADING_SERIES_TITLES) in the languages/ file, or just hard-code them into your new box. hope this helps jon |
|
#3
| |||
| |||
| ok I just had a quick bash at it, and came up with the code below. Don't know if it works and you'll need to change the name of your field to suit, it's products_series_title at present. The one thing I thought of was that there is probably no direct way to link in to the series title, there is no standard way to display all items with a certain product field on one page. However I see that the latest version of the products field mod allows you to search for the new field so you could send the box links to a search query. anyway try this Code: <?php
/*
$Id: series_titles.php,v 1.21 2003/06/09 22:07:52 hpdl Exp $
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
Released under the GNU General Public License
*/
define('MAX_DISPLAY_SERIES_TITLES', 10); //max number of titles to display
define('MIN_DISPLAY_SERIES_TITLES', 1); //min number to display
define('BOX_HEADING_SERIES_TITLES', 'series titles'); //box heading
if (isset($current_category_id) && ($current_category_id > 0)) {
$series_titles_query = tep_db_query("select distinct p.products_id, p.products_series_title from " . TABLE_PRODUCTS . " p " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where p.products_status = '1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and '" . (int)$current_category_id . "' in (c.categories_id, c.parent_id) order by p.products_ordered desc limit " . MAX_DISPLAY_SERIES_TITLES);
} else {
$series_titles_query = tep_db_query("select distinct p.products_id, p.products_series_title from " . TABLE_PRODUCTS . " p where p.products_status = '1' and p.products_ordered > 0 order by p.products_ordered desc limit " . MAX_DISPLAY_SERIES_TITLES);
}
if (tep_db_num_rows($series_titles_query) >= MIN_DISPLAY_SERIES_TITLES) {
?>
<!-- series_titles //-->
<?php
$boxHeading = BOX_HEADING_SERIES_TITLES;
$corner_left = 'square';
$corner_right = 'square';
$rows = 0;
$boxContent = '<table border="0" width="100%" cellspacing="0" cellpadding="1">';
while ($series_titles = tep_db_fetch_array($series_titles_query)) {
$rows++;
$boxContent .= '<tr><td class="infoBoxContents" valign="top">' . tep_row_number_format($rows) . '.</td><td class="infoBoxContents"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $series_titles['products_id']) . '">' . $series_titles['products_series_title'] . '</a></td></tr>';
}
$boxContent .= '</table>';
require(DIR_WS_TEMPLATES . TEMPLATENAME_BOX);
?>
<!-- series_titles_eof //-->
<?php
}
?>
jon |
|
#4
| |||
| |||
| Thanks Jon, Some of your second post is alittle "over my head" but I have someone helping me that will understand it all Thanks so much, Lalla |
| Thread Tools | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Show Manufacturer | glynn | osCommerce 2.2 Modification Help | 0 | 05-11-2005 05:04 PM |
| adding manufacturer name to product_info | kellbot | osCMax v1.7 Discussion | 1 | 05-11-2005 04:58 PM |
| Getting the Manufacturer name in the title | lem | osCMax v1.7 Discussion | 8 | 12-01-2004 10:34 PM |
| how to add manufacturer to product_info.php | atech | osCommerce 2.2 Modification Help | 0 | 04-14-2004 08:03 PM |
| Manufacturer Description? | Jood | osCommerce 2.2 Modification Help | 0 | 09-29-2003 06:14 AM |