Guest Posted May 29, 2005 Share Posted May 29, 2005 Hi all, Please excuse me, but this is my very first post to this forum and so I?m sorry if the document seems so very long, but it is they only way I think I can explain my situation if I?m to make you understood my problem. Okay my problem is that I?ve put myself up to doing a project that I?m now getting a little lost in. As I promised to design and develop a basic website for a local organisation for free as I thought it would be easy to put together something with the resources available on the OS site, how wrong I was! Anyhow, I?ve come up against a brick wall with a fantastic contribution I have found within the ?contributions? section of the os site which enables your site to have a unique banner (http://www.oscommerce.com/community/contributions,2511/category,all/search,os6tm set for every category of your site, now although this works perfectly when I set it up within the category area of the website, I?m currently failing to get it to work within a another contribution I have setup named Article Manager v1.0 ( http://www.oscommerce.com/community/contri...Article+Manager ) Now I have attempted very, very carefully to copy what was done in the category section of the ?os6tm? contribution, but it all seems to be going extremely wrong, and it doesn?t help the fact that I don?t fully understand the logic of php. Okay so what have done to date: The file structure for os6tm_banner_manager is as follows: banners_to_categories.sql ----------------- \catalog catalog\includes database_tables.php header.php -functions banner.php ----- \catalog\admin banner_manager.php categories.php -includes database_tables.php -languages french.php -French banner_manager.php categories.php +images functions general.php ---------------------------------------------------------------------- Following the structure of the original table that I set-up a unique table within the database: Original: -------------------------------- CREATE TABLE `banners_to_categories` ( `banners_id` bigint(20) NOT NULL default '0', `categories_id` bigint(20) NOT NULL default '0' ) TYPE=MyISAM; -------------------------------- which I reconfigured to read: -------------------------------- CREATE TABLE `banners_to_articles` ( `banners1_id` bigint(20) NOT NULL default '0', `categories1_id` bigint(20) NOT NULL default '0' ) TYPE=MyISAM; -------------------------------- ? then I simply reconfigured all the associating documents to point to the new table, for example: \catalog\includes\database_tables.php //added for os6tm banner manager define('TABLE_BANNERS_TO_CATEGORIES', 'banners_to_categories'); define('TABLE_PRODUCTS_TO_PRODUCTS', 'products_to_products'); I changed it to: //added for os6tm banner manager define('TABLE_BANNERS_TO_ARTICLES', 'banners_to_articles'); I then changed all the cPath from the category to tPaths as this it was is required with the Article Manager v1.0. After I completed reconfiguring all the documents I tested the site and nothing worked, I repeated the process over and over again with a couple of additional approaches but nothing. Although I?m going to keep trying until they early hours to get this to work, I hope somebody out there can find it within themselves to help an old fool get out of the mess he has put himself in. Please remember that any help I receive from anyone out there will be accredited within the code!! Best wishes, Graham Link to comment Share on other sites More sharing options...
Guest Posted May 29, 2005 Share Posted May 29, 2005 Hi I'm just wondering if I should simplify my help ticket [above] as it may be a little long winded and not clear as to what I may need help in, can someone please advice! Link to comment Share on other sites More sharing options...
Guest Posted May 29, 2005 Share Posted May 29, 2005 Original:-------------------------------- CREATE TABLE `banners_to_categories` ( `banners_id` bigint(20) NOT NULL default '0', `categories_id` bigint(20) NOT NULL default '0' ) TYPE=MyISAM; -------------------------------- which I reconfigured to read: -------------------------------- CREATE TABLE `banners_to_articles` ( `banners1_id` bigint(20) NOT NULL default '0', `categories1_id` bigint(20) NOT NULL default '0' ) TYPE=MyISAM; -------------------------------- okay just noticed an error as I was working through my problem categories1_id instead of CREATE TABLE `banners_to_articles` ( `banners1_id` bigint(20) NOT NULL default '0', `articles_id` bigint(20) NOT NULL default '0' ) TYPE=MyISAM; for some reason? If its okay with you I'll keep posting my developments and if you see any problems please let me know... thanks Link to comment Share on other sites More sharing options...
Guest Posted May 30, 2005 Share Posted May 30, 2005 ... can someone please advice? Link to comment Share on other sites More sharing options...
Guest Posted May 30, 2005 Share Posted May 30, 2005 includes/header.php found: <?php //added for os6tm banner manager if ($banner = tep_banner_exists('dynamic', '468x50')) { ?> <br> <table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td align="center"><?php echo tep_display_banner('static', $banner); ?></td> </tr> </table> <?php } ?> no change ------------------------------------------------------------- opened database_tables.php and found: line 59 to 61 //added for os6tm banner manager define('TABLE_BANNERS_TO_CATEGORIES', 'banners_to_categories'); define('TABLE_PRODUCTS_TO_PRODUCTS', 'products_to_products'); change to: //added for os6tm banner manager define('TABLE_BANNERS_TO_ARTICLES', 'banners_to_articles'); define('TABLE_PRODUCTS_TO_PRODUCTS', 'products_to_products'); and put at the bottom of the page. Note: I don't know what "products_to_products" is refering to, but I will it in for the time being. ------------------------------------------------------------- Opened functions/banner.php and found from lines 96 to 117 add the following: //added for os6tm banner manager global $current_category_id, $HTTP_GET_VARS; if ($HTTP_GET_VARS['manufacturers_id'] == '') { if ($action == 'dynamic') { return tep_random_select("select b.banners_id, b.banners_title, b.banners_image, b.banners_html_text from " . TABLE_BANNERS . " b, " . TABLE_BANNERS_TO_CATEGORIES . " btc where status = '1' and banners_group = '" . $identifier . "' and btc.categories_id = '" . $current_category_id . "' and b.banners_id = btc.banners_id"); } elseif ($action == 'static') { //added for os6tm banner manager $banner_query = tep_db_query("select b.banners_id, b.banners_title, b.banners_image, b.banners_html_text from " . TABLE_BANNERS . " b, " . TABLE_BANNERS_TO_CATEGORIES . " btc where status = '1' and banners_id = '" . (int)$identifier . "' and btc.categories_id = '" . $current_category_id . "' and b.banners_id = btc.banners_id"); return tep_db_fetch_array($banner_query); } else { return false; } } else { return false; } } //// changed to the following: //added for os6tm banner manager global $current_category_id, $HTTP_GET_VARS; if ($HTTP_GET_VARS['manufacturers_id'] == '') { if ($action == 'dynamic') { return tep_random_select("select b.banners_id, b.banners_title, b.banners_image, b.banners_html_text from " . TABLE_BANNERS . " b, " . TABLE_BANNERS_TO_ARTICLES . " btc where status = '1' and banners_group = '" . $identifier . "' and btc.articles_id = '" . $current_category_id . "' and b.banners_id = btc.banners_id"); } elseif ($action == 'static') { //added for os6tm banner manager $banner_query = tep_db_query("select b.banners_id, b.banners_title, b.banners_image, b.banners_html_text from " . TABLE_BANNERS . " b, " . TABLE_BANNERS_TO_ARTICLES . " btc where status = '1' and banners_id = '" . (int)$identifier . "' and btc.articles_id = '" . $current_category_id . "' and b.banners_id = btc.banners_id"); return tep_db_fetch_array($banner_query); } else { return false; } } else { return false; } } //// ------------------------------------------------------------- admin\categories.php Go to admin categories take out the following and edited it: lines 322 to 334: //added for os6tm banner manager case 'add_banner': $banner_query = tep_db_query("insert into " . TABLE_BANNERS_TO_CATEGORIES . " values (" . $banners_id . "," . $cID . ")"); break; case 'delete_banner': $banners_query = tep_db_query("delete from " . TABLE_BANNERS_TO_CATEGORIES . " where categories_id = '" . $cID . "' and banners_id = '" . $banners_id . "'"); break; } } added the code to admin\articles.php and changed it to the following: break; //added for os6tm banner manager case 'add_banner': $banner_query = tep_db_query("insert into " . TABLE_BANNERS_TO_ARTICLES . " values (" . $banners_id . "," . $cID . ")"); break; case 'delete_banner': $banners_query = tep_db_query("delete from " . TABLE_BANNERS_TO_ARTICLES . " where categories_id = '" . $cID . "' and banners_id = '" . $banners_id . "'"); break; } } With in the same document found the following: lines 986 to 1068 //added for os6tm banner manager $heading[] = array('text' => TEXT_BANNERS_TO_CATEGORIES); $banners_query = tep_db_query("select b.banners_title, b.banners_image, b.banners_id from " . TABLE_BANNERS . " b, " . TABLE_BANNERS_TO_CATEGORIES . " btc where btc.categories_id = '" . $cInfo->categories_id . "' and btc.banners_id = b.banners_id"); $string_banners = ''; $selected_banners = array(); while ($banner = tep_db_fetch_array($banners_query)) { $string_banners .= $banner['banners_title'] . '<br>' . tep_image('../' . DIR_WS_IMAGES . $banner['banners_image'], $banner['banners_title'], 150, 40) . ' <a href="' . tep_href_link(FILENAME_CATEGORIES, 'action=delete_banner_confirm&cPath=' . $cPath . '&cID=' . $cID . '&banners_id=' . $banner['banners_id']) . '">supprimer</a><br><br>'; $selected_banners[] = $banner['banners_id']; } $contents[] = array('text' => 'Banni?res affich?es : ' . tep_db_num_rows($banners_query) . '<br><br>' . $string_banners); $banners_query = tep_db_query("select banners_title as text, banners_id as id from " . TABLE_BANNERS); while ($banners = tep_db_fetch_array($banners_query)) { $key = array_search($banners['id'],$selected_banners); if (!is_integer($key)) { $banners_array[] = $banners; } } $contents[] = array('text' => tep_draw_form('banners_form', FILENAME_CATEGORIES, 'cPath=' . $cPath . '&action=add_banner&cID=' . $cID)); if (sizeof($banners_array) > 0) { $contents[] = array('text' => tep_draw_pull_down_menu('banners_id',$banners_array) . ' ' . tep_image_submit('button_add_banner.gif', IMAGE_ADD_BANNER)); $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $cInfo->categories_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'); $contents[] = array('text' => '</form>'); } else { $contents[] = array('align' => 'center', 'text' => ' <a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $cInfo->categories_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'); } break; //added for os6tm banner manager case 'delete_banner_confirm': $banner_query = tep_db_query("select banners_title, banners_image from " . TABLE_BANNERS . " where banners_id = '" . $banners_id . "'"); $banner = tep_db_fetch_array($banner_query); $heading[] = array('text' => TEXT_DELETE_BANNER_CONFIRM_HEADING); $contents[] = array('text' => TEXT_DELETE_BANNER_CONFIRM . '<br><br>'); $contents[] = array('text' => $banner['banners_title'] . '<br>' . tep_image('../' . DIR_WS_IMAGES . $banner['banners_image'], $banner['banners_title'], 150, 40) . '<br><br>'); $contents[] = array('text' => '<a href="' . tep_href_link(FILENAME_CATEGORIES, 'action=delete_banner&cPath=' . $cPath . '&cID=' . $cID . '&banners_id=' . $banners_id) . '">' . tep_image_button('button_confirm.gif', IMAGE_CONFIRM) . '</a> ' . ' <a href="' . tep_href_link(FILENAME_CATEGORIES, 'action=edit_banners&cPath=' . $cPath . '&cID=' . $cInfo->categories_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'); break; default: if ($rows > 0) { if (isset($cInfo) && is_object($cInfo)) { // category info box contents $heading[] = array('text' => '<b>' . $cInfo->categories_name . '</b>'); $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $cInfo->categories_id . '&action=edit_category') . '">' . tep_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $cInfo->categories_id . '&action=delete_category') . '">' . tep_image_button('button_delete.gif', IMAGE_DELETE) . '</a> <a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $cInfo->categories_id . '&action=move_category') . '">' . tep_image_button('button_move.gif', IMAGE_MOVE) . '</a>'); //added for os6tm banner manager $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $cInfo->categories_id . '&action=edit_banners') . '">' . tep_image_button('button_manage_banners.gif', IMAGE_MANAGE_BANNERS) . '</a>'); $contents[] = array('text' => '<br>' . TEXT_DATE_ADDED . ' ' . tep_date_short($cInfo->date_added)); if (tep_not_null($cInfo->last_modified)) $contents[] = array('text' => TEXT_LAST_MODIFIED . ' ' . tep_date_short($cInfo->last_modified)); $contents[] = array('text' => '<br>' . tep_info_image($cInfo->categories_image, $cInfo->categories_name, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT) . '<br>' . $cInfo->categories_image); $contents[] = array('text' => '<br>' . TEXT_SUBCATEGORIES . ' ' . $cInfo->childs_count . '<br>' . TEXT_PRODUCTS . ' ' . $cInfo->products_count); //added for os6tm banner manager $banners_query = tep_db_query("select b.banners_title from " . TABLE_BANNERS . " b, " . TABLE_BANNERS_TO_CATEGORIES . " btc where btc.categories_id = '" . $cInfo->categories_id . "' and btc.banners_id = b.banners_id"); $string_banners = '<ul>'; while ($banner = tep_db_fetch_array($banners_query)) { $string_banners .= '<li>' . $banner['banners_title'] . '</li>'; } $string_banners .= '</ul>'; $contents[] = array('text' => 'Banni?res affich?es : ' . tep_db_num_rows($banners_query) . '<br>' . $string_banners); } elseif (isset($pInfo) && is_object($pInfo)) { // product info box contents $heading[] = array('text' => '<b>' . tep_get_products_name($pInfo->products_id, $languages_id) . '</b>'); $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $pInfo->products_id . '&action=new_product') . '">' . tep_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $pInfo->products_id . '&action=delete_product') . '">' . tep_image_button('button_delete.gif', IMAGE_DELETE) . '</a> <a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $pInfo->products_id . '&action=move_product') . '">' . tep_image_button('button_move.gif', IMAGE_MOVE) . '</a> <a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $pInfo->products_id . '&action=copy_to') . '">' . tep_image_button('button_copy_to.gif', IMAGE_COPY_TO) . '</a>'); $contents[] = array('text' => '<br>' . TEXT_DATE_ADDED . ' ' . tep_date_short($pInfo->products_date_added)); if (tep_not_null($pInfo->products_last_modified)) $contents[] = array('text' => TEXT_LAST_MODIFIED . ' ' . tep_date_short($pInfo->products_last_modified)); if (date('Y-m-d') < $pInfo->products_date_available) $contents[] = array('text' => TEXT_DATE_AVAILABLE . ' ' . tep_date_short($pInfo->products_date_available)); $contents[] = array('text' => '<br>' . tep_info_image($pInfo->products_image, $pInfo->products_name, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '<br>' . $pInfo->products_image); $contents[] = array('text' => '<br>' . TEXT_PRODUCTS_PRICE_INFO . ' ' . $currencies->format($pInfo->products_price) . '<br>' . TEXT_PRODUCTS_QUANTITY_INFO . ' ' . $pInfo->products_quantity); $contents[] = array('text' => '<br>' . TEXT_PRODUCTS_AVERAGE_RATING . ' ' . number_format($pInfo->average_rating, 2) . '%'); } } else { // create category/product info $heading[] = array('text' => '<b>' . EMPTY_CATEGORY . '</b>'); $contents[] = array('text' => TEXT_NO_CHILD_CATEGORIES_OR_PRODUCTS); } break; } changed to the following: //added for os6tm banner manager $heading[] = array('text' => TEXT_BANNERS_TO_ARTICLES); $banners_query = tep_db_query("select b.banners_title, b.banners_image, b.banners_id from " . TABLE_BANNERS . " b, " . TABLE_BANNERS_TO_ARTICLES . " btc where btc.categories_id = '" . $cInfo->categories_id . "' and btc.banners_id = b.banners_id"); $string_banners = ''; $selected_banners = array(); while ($banner = tep_db_fetch_array($banners_query)) { $string_banners .= $banner['banners_title'] . '<br>' . tep_image('../' . DIR_WS_IMAGES . $banner['banners_image'], $banner['banners_title'], 150, 40) . ' <a href="' . tep_href_link(FILENAME_ARTICLES, 'action=delete_banner_confirm&tPath=' . $tPath . '&tID=' . $tID . '&banners_id=' . $banner['banners_id']) . '">supprimer</a><br><br>'; $selected_banners[] = $banner['banners_id']; } $contents[] = array('text' => 'Banni?res affich?es : ' . tep_db_num_rows($banners_query) . '<br><br>' . $string_banners); $banners_query = tep_db_query("select banners_title as text, banners_id as id from " . TABLE_BANNERS); while ($banners = tep_db_fetch_array($banners_query)) { $key = array_search($banners['id'],$selected_banners); if (!is_integer($key)) { $banners_array[] = $banners; } } $contents[] = array('text' => tep_draw_form('banners_form', FILENAME_CATEGORIES, 'tPath=' . $tPath . '&action=add_banner&cID=' . $cID)); if (sizeof($banners_array) > 0) { $contents[] = array('text' => tep_draw_pull_down_menu('banners_id',$banners_array) . ' ' . tep_image_submit('button_add_banner.gif', IMAGE_ADD_BANNER)); $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_CATEGORIES, 'tPath=' . $tPath . '&tID=' . $tInfo->categories_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'); $contents[] = array('text' => '</form>'); } else { $contents[] = array('align' => 'center', 'text' => ' <a href="' . tep_href_link(FILENAME_CATEGORIES, 'tPath=' . $tPath . '&tID=' . $tInfo->categories_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'); } break; //added for os6tm banner manager case 'delete_banner_confirm': $banner_query = tep_db_query("select banners_title, banners_image from " . TABLE_BANNERS . " where banners_id = '" . $banners_id . "'"); $banner = tep_db_fetch_array($banner_query); $heading[] = array('text' => TEXT_DELETE_BANNER_CONFIRM_HEADING); $contents[] = array('text' => TEXT_DELETE_BANNER_CONFIRM . '<br><br>'); $contents[] = array('text' => $banner['banners_title'] . '<br>' . tep_image('../' . DIR_WS_IMAGES . $banner['banners_image'], $banner['banners_title'], 150, 40) . '<br><br>'); $contents[] = array('text' => '<a href="' . tep_href_link(FILENAME_CATEGORIES, 'action=delete_banner&tPath=' . $tPath . '&tID=' . $tID . '&banners_id=' . $banners_id) . '">' . tep_image_button('button_confirm.gif', IMAGE_CONFIRM) . '</a> ' . ' <a href="' . tep_href_link(FILENAME_CATEGORIES, 'action=edit_banners&tPath=' . $tPath . '&tID=' . $tInfo->categories_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'); break; default: if ($rows > 0) { if (isset($tInfo) && is_object($cInfo)) { // category info box contents $heading[] = array('text' => '<b>' . $tInfo->categories_name . '</b>'); $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_CATEGORIES, 'tPath=' . $tPath . '&tID=' . $cInfo->categories_id . '&action=edit_category') . '">' . tep_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . tep_href_link(FILENAME_CATEGORIES, 'tPath=' . $tPath . '&tID=' . $cInfo->categories_id . '&action=delete_category') . '">' . tep_image_button('button_delete.gif', IMAGE_DELETE) . '</a> <a href="' . tep_href_link(FILENAME_CATEGORIES, 'tPath=' . $tPath . '&tID=' . $tInfo->categories_id . '&action=move_category') . '">' . tep_image_button('button_move.gif', IMAGE_MOVE) . '</a>'); //added for os6tm banner manager $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_CATEGORIES, 'tPath=' . $tPath . '&tID=' . $cInfo->categories_id . '&action=edit_banners') . '">' . tep_image_button('button_manage_banners.gif', IMAGE_MANAGE_BANNERS) . '</a>'); $contents[] = array('text' => '<br>' . TEXT_DATE_ADDED . ' ' . tep_date_short($cInfo->date_added)); if (tep_not_null($cInfo->last_modified)) $contents[] = array('text' => TEXT_LAST_MODIFIED . ' ' . tep_date_short($cInfo->last_modified)); $contents[] = array('text' => '<br>' . tep_info_image($cInfo->categories_image, $cInfo->categories_name, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT) . '<br>' . $cInfo->categories_image); $contents[] = array('text' => '<br>' . TEXT_SUBCATEGORIES . ' ' . $cInfo->childs_count . '<br>' . TEXT_PRODUCTS . ' ' . $cInfo->products_count); //added for os6tm banner manager $banners_query = tep_db_query("select b.banners_title from " . TABLE_BANNERS . " b, " . TABLE_BANNERS_TO_ARTICLES . " btc where btc.categories_id = '" . $cInfo->categories_id . "' and btc.banners_id = b.banners_id"); $string_banners = '<ul>'; while ($banner = tep_db_fetch_array($banners_query)) { $string_banners .= '<li>' . $banner['banners_title'] . '</li>'; } $string_banners .= '</ul>'; $contents[] = array('text' => 'Banni?res affich?es : ' . tep_db_num_rows($banners_query) . '<br>' . $string_banners); } elseif (isset($pInfo) && is_object($pInfo)) { // product info box contents $heading[] = array('text' => '<b>' . tep_get_products_name($pInfo->products_id, $languages_id) . '</b>'); $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_CATEGORIES, 'tPath=' . $tPath . '&pID=' . $pInfo->products_id . '&action=new_product') . '">' . tep_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . tep_href_link(FILENAME_CATEGORIES, 'tPath=' . $tPath . '&pID=' . $pInfo->products_id . '&action=delete_product') . '">' . tep_image_button('button_delete.gif', IMAGE_DELETE) . '</a> <a href="' . tep_href_link(FILENAME_CATEGORIES, 'tPath=' . $tPath . '&pID=' . $pInfo->products_id . '&action=move_product') . '">' . tep_image_button('button_move.gif', IMAGE_MOVE) . '</a> <a href="' . tep_href_link(FILENAME_CATEGORIES, 'tPath=' . $tPath . '&pID=' . $pInfo->products_id . '&action=copy_to') . '">' . tep_image_button('button_copy_to.gif', IMAGE_COPY_TO) . '</a>'); $contents[] = array('text' => '<br>' . TEXT_DATE_ADDED . ' ' . tep_date_short($pInfo->products_date_added)); if (tep_not_null($pInfo->products_last_modified)) $contents[] = array('text' => TEXT_LAST_MODIFIED . ' ' . tep_date_short($pInfo->products_last_modified)); if (date('Y-m-d') < $pInfo->products_date_available) $contents[] = array('text' => TEXT_DATE_AVAILABLE . ' ' . tep_date_short($pInfo->products_date_available)); $contents[] = array('text' => '<br>' . tep_info_image($pInfo->products_image, $pInfo->products_name, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '<br>' . $pInfo->products_image); $contents[] = array('text' => '<br>' . TEXT_PRODUCTS_PRICE_INFO . ' ' . $currencies->format($pInfo->products_price) . '<br>' . TEXT_PRODUCTS_QUANTITY_INFO . ' ' . $pInfo->products_quantity); $contents[] = array('text' => '<br>' . TEXT_PRODUCTS_AVERAGE_RATING . ' ' . number_format($pInfo->average_rating, 2) . '%'); } } else { // create category/product info $heading[] = array('text' => '<b>' . EMPTY_CATEGORY . '</b>'); $contents[] = array('text' => TEXT_NO_CHILD_CATEGORIES_OR_PRODUCTS); } break; } if ( (tep_not_null($heading)) && (tep_not_null($contents)) ) { echo ' <td width="25%" valign="top">' . "\n"; $box = new box; echo $box->infoBox($heading, $contents); echo ' </td>' . "\n"; } ?> ------------------------------------------------------------- \admin\banner_manager.php lines 92 to 99 found: //added for os6tm banner manager tep_db_query("delete from " . TABLE_BANNERS_TO_CATEGORIES . " where banners_id = '" . $banners_id . "'"); $categories = $HTTP_POST_VARS['categories']; if (is_array($categories)) { while (list(,$category_id) = each($categories)) { tep_db_query("insert into " . TABLE_BANNERS_TO_CATEGORIES . " (banners_id, categories_id) values (" . $banners_id . "," . $category_id . ")"); } } changed to the following: //added for os6tm banner manager tep_db_query("delete from " . TABLE_BANNERS_TO_ARTICLES . " where banners_id = '" . $banners_id . "'"); $categories = $HTTP_POST_VARS['categories']; if (is_array($categories)) { while (list(,$category_id) = each($categories)) { tep_db_query("insert into " . TABLE_BANNERS_TO_ARTICLES . " (banners_id, categories_id) values (" . $banners_id . "," . $category_id . ")"); } } 2nd part>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> lines 259 to 309 found //added for os6tm banner manager if (isset($HTTP_GET_VARS['cid']) && $HTTP_GET_VARS['cid'] != '') { if (isset($HTTP_GET_VARS['gestban']) && $HTTP_GET_VARS['gestban'] != '') { $cid = $HTTP_GET_VARS['cid']; $gestban = $HTTP_GET_VARS['gestban']; switch($gestban) { case 'add': $category_query = tep_db_query("select * from " . TABLE_BANNERS_TO_CATEGORIES . " where banners_id = '" . $bID . "' and categories_id = '" . $cid ."'"); if (tep_db_num_rows($category_query) == 0) { $category_query = tep_db_query("insert into " . TABLE_BANNERS_TO_CATEGORIES . " VALUES ('" . $bID . "','" . $cid ."')"); } break; case 'remove': $category_query = tep_db_query("delete from " . TABLE_BANNERS_TO_CATEGORIES . " where categories_id = '" . $cid . "'"); break; case 'addall': $category_query = tep_db_query("select * from " . TABLE_BANNERS_TO_CATEGORIES . " where banners_id = '" . $bID . "' and categories_id = '" . $cid ."'"); if (tep_db_num_rows($category_query) == 0) { $category_query = tep_db_query("insert into " . TABLE_BANNERS_TO_CATEGORIES . " VALUES ('" . $bID . "','" . $cid ."')"); } if (tep_has_category_subcategories($cid)) { $subcategories = array(); tep_get_subcategories($subcategories, $cid); while(list(,$category) = each($subcategories)) { $category_query = tep_db_query("select * from " . TABLE_BANNERS_TO_CATEGORIES . " where banners_id = '" . $bID . "' and categories_id = '" . $category ."'"); if (tep_db_num_rows($category_query) == 0) { $category_query = tep_db_query("insert into " . TABLE_BANNERS_TO_CATEGORIES . " VALUES (" . $bID . "," . $category .")"); } } } break; case 'removeall': $category_query = tep_db_query("delete from " . TABLE_BANNERS_TO_CATEGORIES . " where categories_id = '" . $cid . "'"); if (tep_has_category_subcategories($cid)) { $subcategories = array(); tep_get_subcategories($subcategories, $cid); while(list(,$category) = each($subcategories)) { $category_query = tep_db_query("delete from " . TABLE_BANNERS_TO_CATEGORIES . " where categories_id = '" . $category . "'"); } } break; } } } $groups_array = array(); $groups_query = tep_db_query("select distinct banners_group from " . TABLE_BANNERS . " order by banners_group"); while ($groups = tep_db_fetch_array($groups_query)) { $groups_array[] = array('id' => $groups['banners_group'], 'text' => $groups['banners_group']); } ?> changed to the following: //added for os6tm banner manager if (isset($HTTP_GET_VARS['cid']) && $HTTP_GET_VARS['cid'] != '') { if (isset($HTTP_GET_VARS['gestban']) && $HTTP_GET_VARS['gestban'] != '') { $cid = $HTTP_GET_VARS['cid']; $gestban = $HTTP_GET_VARS['gestban']; switch($gestban) { case 'add': $category_query = tep_db_query("select * from " . TABLE_BANNERS_TO_ARTICLES . " where banners_id = '" . $bID . "' and categories_id = '" . $cid ."'"); if (tep_db_num_rows($category_query) == 0) { $category_query = tep_db_query("insert into " . TABLE_BANNERS_TO_ARTICLES . " VALUES ('" . $bID . "','" . $cid ."')"); } break; case 'remove': $category_query = tep_db_query("delete from " . TABLE_BANNERS_TO_ARTICLES . " where categories_id = '" . $cid . "'"); break; case 'addall': $category_query = tep_db_query("select * from " . TABLE_BANNERS_TO_ARTICLES . " where banners_id = '" . $bID . "' and categories_id = '" . $cid ."'"); if (tep_db_num_rows($category_query) == 0) { $category_query = tep_db_query("insert into " . TABLE_BANNERS_TO_ARTICLES . " VALUES ('" . $bID . "','" . $cid ."')"); } if (tep_has_category_subcategories($cid)) { $subcategories = array(); tep_get_subcategories($subcategories, $cid); while(list(,$category) = each($subcategories)) { $category_query = tep_db_query("select * from " . TABLE_BANNERS_TO_ARTICLES . " where banners_id = '" . $bID . "' and categories_id = '" . $category ."'"); if (tep_db_num_rows($category_query) == 0) { $category_query = tep_db_query("insert into " . TABLE_BANNERS_TO_ARTICLES . " VALUES (" . $bID . "," . $category .")"); } } } break; case 'removeall': $category_query = tep_db_query("delete from " . TABLE_BANNERS_TO_ARTICLES . " where categories_id = '" . $cid . "'"); if (tep_has_category_subcategories($cid)) { $subcategories = array(); tep_get_subcategories($subcategories, $cid); while(list(,$category) = each($subcategories)) { $category_query = tep_db_query("delete from " . TABLE_BANNERS_TO_ARTICLES . " where categories_id = '" . $category . "'"); } } break; } } } $groups_array = array(); $groups_query = tep_db_query("select distinct banners_group from " . TABLE_BANNERS . " order by banners_group"); while ($groups = tep_db_fetch_array($groups_query)) { $groups_array[] = array('id' => $groups['banners_group'], 'text' => $groups['banners_group']); } ?> 3rd part>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> lines from 375 to 460 found: <?php //added for os6tm banner manager //add a checkbox for the homepage if (isset($HTTP_GET_VARS['bID']) && $HTTP_GET_VARS['bID'] != '') { $homepage_banner_query = tep_db_query("select categories_id as id from " . TABLE_BANNERS_TO_CATEGORIES . " where banners_id = '" . $bID . "' and categories_id = '0'"); if (tep_db_num_rows($homepage_banner_query) > 0) { $homepage_banner = true; } else { $homepage_banner = false; } } else { $homepage_banner = false; } echo tep_draw_checkbox_field('categories[0]', '0', $homepage_banner) . TEXT_BANNER_HOMEPAGE; ?> <script language="javascript"> <!-- function select_all() { for (a=0; a < arguments.length; a++) { chkObj = eval(document.new_banner.elements["categories[" + arguments[a] + "]"]); chkObj.checked = true; } } function unselect_all() { for (a=0; a < arguments.length; a++) { chkObj = eval(document.new_banner.elements["categories[" + arguments[a] + "]"]); chkObj.checked = false; } } //--> </script> <table border=1 cellspacing=0 cellpadding=5 bordercolor=black> <?php $i = 0; $j = 1; $categories_string = ''; $categories = tep_get_categories($bID, '', '0', '...'); while (list(,$category) = each($categories)) { if ($category['parent_id'] == 0) { if ($i == 0) { echo '<tr><td valign="top">'; } if (($i % 3) > 0) { $categories_string = substr($categories_string, 1, strlen($categories_string)); echo tep_draw_separator(); echo '<font size="1">?</font> <a href="java script:onclick=select_all(' . $categories_string . ')">' . TEXT_BANNERS_SELECT_ALL . '</a>'; echo '<br><font size="1">?</font> <a href=java script:onclick=unselect_all(' . $categories_string . ')>' . TEXT_BANNERS_UNSELECT_ALL . '</a>'; echo '</td><td valign="top">'; $categories_string = ''; } if (($i % 3) == 0 && $i > 0) { $categories_string = substr($categories_string, 1, strlen($categories_string)); echo tep_draw_separator(); echo '<font size="1">?</font> <a href=java script:onclick=select_all(' . $categories_string . ')>' . TEXT_BANNERS_SELECT_ALL . '</a>'; echo '<br><font size="1">?</font> <a href=java script:onclick=unselect_all(' . $categories_string . ')>' . TEXT_BANNERS_UNSELECT_ALL . '</a>'; echo '</td></tr><tr><td valign="top">'; $categories_string = ''; } $i++; } $is_selected = $category['is_selected']; echo tep_draw_checkbox_field('categories[' . $j . ']', $category['id'], $is_selected) . '<a href="' . tep_href_link(FILENAME_CATEGORIES, tep_get_path($category['parent_id']) . '&cID=' . $category['id']) . '">' . $category['text'] . '</a>'; echo '<br>'; $categories_string .= ',' . $j; $j++; } $categories_string .= ',' . $j; $categories_string = substr($categories_string, 1, strlen($categories_string)); echo tep_draw_separator(); echo '? <a href=java script:onclick=select_all(' . $categories_string . ')>' . TEXT_BANNERS_SELECT_ALL . '</a>'; echo '<br><font size="1">?</font> <a href=java script:onclick=unselect_all(' . $categories_string . ')>' . TEXT_BANNERS_UNSELECT_ALL . '</a>'; while (($i % 3) > 0) { if (($i % 3) > 2) { echo '</td><td>'; } else { echo '</td></tr>'; } $i++; } ?> </table> changed to the following: <?php //added for os6tm banner manager //add a checkbox for the homepage if (isset($HTTP_GET_VARS['bID']) && $HTTP_GET_VARS['bID'] != '') { $homepage_banner_query = tep_db_query("select categories_id as id from " . TABLE_BANNERS_TO_ARTICLES . " where banners_id = '" . $bID . "' and categories_id = '0'"); if (tep_db_num_rows($homepage_banner_query) > 0) { $homepage_banner = true; } else { $homepage_banner = false; } } else { $homepage_banner = false; } echo tep_draw_checkbox_field('categories[0]', '0', $homepage_banner) . TEXT_BANNER_HOMEPAGE; ?> <script language="javascript"> <!-- function select_all() { for (a=0; a < arguments.length; a++) { chkObj = eval(document.new_banner.elements["categories[" + arguments[a] + "]"]); chkObj.checked = true; } } function unselect_all() { for (a=0; a < arguments.length; a++) { chkObj = eval(document.new_banner.elements["categories[" + arguments[a] + "]"]); chkObj.checked = false; } } //--> </script> <table border=1 cellspacing=0 cellpadding=5 bordercolor=black> <?php $i = 0; $j = 1; $categories_string = ''; $categories = tep_get_categories($bID, '', '0', '...'); while (list(,$category) = each($categories)) { if ($category['parent_id'] == 0) { if ($i == 0) { echo '<tr><td valign="top">'; } if (($i % 3) > 0) { $categories_string = substr($categories_string, 1, strlen($categories_string)); echo tep_draw_separator(); echo '<font size="1">?</font> <a href="java script:onclick=select_all(' . $categories_string . ')">' . TEXT_BANNERS_SELECT_ALL . '</a>'; echo '<br><font size="1">?</font> <a href=java script:onclick=unselect_all(' . $categories_string . ')>' . TEXT_BANNERS_UNSELECT_ALL . '</a>'; echo '</td><td valign="top">'; $categories_string = ''; } if (($i % 3) == 0 && $i > 0) { $categories_string = substr($categories_string, 1, strlen($categories_string)); echo tep_draw_separator(); echo '<font size="1">?</font> <a href=java script:onclick=select_all(' . $categories_string . ')>' . TEXT_BANNERS_SELECT_ALL . '</a>'; echo '<br><font size="1">?</font> <a href=java script:onclick=unselect_all(' . $categories_string . ')>' . TEXT_BANNERS_UNSELECT_ALL . '</a>'; echo '</td></tr><tr><td valign="top">'; $categories_string = ''; } $i++; } $is_selected = $category['is_selected']; echo tep_draw_checkbox_field('categories[' . $j . ']', $category['id'], $is_selected) . '<a href="' . tep_href_link(FILENAME_CATEGORIES, tep_get_path($category['parent_id']) . '&cID=' . $category['id']) . '">' . $category['text'] . '</a>'; echo '<br>'; $categories_string .= ',' . $j; $j++; } $categories_string .= ',' . $j; $categories_string = substr($categories_string, 1, strlen($categories_string)); echo tep_draw_separator(); echo '? <a href=java script:onclick=select_all(' . $categories_string . ')>' . TEXT_BANNERS_SELECT_ALL . '</a>'; echo '<br><font size="1">?</font> <a href=java script:onclick=unselect_all(' . $categories_string . ')>' . TEXT_BANNERS_UNSELECT_ALL . '</a>'; while (($i % 3) > 0) { if (($i % 3) > 2) { echo '</td><td>'; } else { echo '</td></tr>'; } $i++; } ?> </table> ------------------------------------------------------------- \admin\include\database_tables.php found: //os6tm define('TABLE_BANNERS_TO_CATEGORIES', 'banners_to_categories'); changed to: //os6tm define('TABLE_BANNERS_TO_ARTICLES', 'banners_to_articles'); ------------------------------------------------------------- \admin\include\functions\general.php lines 1307 to 1333 found: ////added for os6tm banner manager // return all categories function tep_get_categories($banner_id, $categories_array = '', $parent_id = '0', $indent = '') { global $languages_id; if (!is_array($categories_array)) $categories_array = array(); $categories_query = tep_db_query("select c.categories_id, cd.categories_name from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where parent_id = '" . (int)$parent_id . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' order by sort_order, cd.categories_name"); while ($categories = tep_db_fetch_array($categories_query)) { $banners_query = tep_db_query("select banners_id from " . TABLE_BANNERS_TO_CATEGORIES . " where categories_id = '" . $categories['categories_id'] . "' and banners_id = '" . $banner_id . "'"); $is_selected = false; if (tep_db_num_rows($banners_query) > 0) $is_selected = true; $categories_array[] = array('id' => $categories['categories_id'], 'text' => $indent . $categories['categories_name'], 'parent_id' => $parent_id, 'is_selected' => $is_selected); if ($categories['categories_id'] != $parent_id) { $categories_array = tep_get_categories($banner_id, $categories_array, $categories['categories_id'], $indent . ' '); } } return $categories_array; } //// changed to the following: ////added for os6tm banner manager // return all categories function tep_get_categories($banner_id, $categories_array = '', $parent_id = '0', $indent = '') { global $languages_id; if (!is_array($categories_array)) $categories_array = array(); $categories_query = tep_db_query("select c.categories_id, cd.categories_name from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where parent_id = '" . (int)$parent_id . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' order by sort_order, cd.categories_name"); while ($categories = tep_db_fetch_array($categories_query)) { $banners_query = tep_db_query("select banners_id from " . TABLE_BANNERS_TO_ARTICLES . " where categories_id = '" . $categories['categories_id'] . "' and banners_id = '" . $banner_id . "'"); $is_selected = false; if (tep_db_num_rows($banners_query) > 0) $is_selected = true; $categories_array[] = array('id' => $categories['categories_id'], 'text' => $indent . $categories['categories_name'], 'parent_id' => $parent_id, 'is_selected' => $is_selected); if ($categories['categories_id'] != $parent_id) { $categories_array = tep_get_categories($banner_id, $categories_array, $categories['categories_id'], $indent . ' '); } } return $categories_array; } //// ------------------------------------------------------------- \admin\include\functions\languages\french.php found: //added for os6tm banner_manager define('IMAGE_MANAGE_BANNERS', 'Gérer les bannières'); define('IMAGE_ADD_BANNER','Ajouter la bannière'); at the bottom of page: changed to the following: \admin\include\functions\languages\english.php no change apart from adding it to english.php ------------------------------------------------------------- \admin\include\functions\languages\french\categories.php //added for os6tm banner manager define('TEXT_BANNERS_TO_CATEGORIES', 'Gestionnaire de banni?res'); define('TEXT_DELETE_BANNER_CONFIRM_HEADING', 'Suppression d\'une banni?re'); define('TEXT_DELETE_BANNER_CONFIRM', 'Voulez-vous vraiment supprimer cette banni?re de cette cat?gorie ?'); \admin\include\functions\languages\english\categories.php no change apart from adding it to \english\categories.php ------------------------------------------------------------- \admin\include\functions\languages\french\banner_manager.php //added for os6tm banner manager define('TEXT_BANNER_MANAGER','Gestionnaire de cat?gories'); define('TEXT_BANNER_HOMEPAGE', 'Page d\'accueil'); define('TEXT_BANNERS_SELECT_ALL', 'Tout s?lectionner'); define('TEXT_BANNERS_UNSELECT_ALL', 'Tout d?selectionner'); \admin\include\functions\languages\english\banner_manager.php no change apart from adding it to \english\banner_manager.php ------------------------------------------------------------- \admin\include\functions\languages\english\images uploaded ------------------------------------------------------------- I'll add results soon! Link to comment Share on other sites More sharing options...
Guest Posted May 30, 2005 Share Posted May 30, 2005 Can someone please give me some advice as to where I'm going wrong when requesting help? Link to comment Share on other sites More sharing options...
Guest Posted May 30, 2005 Share Posted May 30, 2005 ... anyone!!! Link to comment Share on other sites More sharing options...
Guest Posted May 31, 2005 Share Posted May 31, 2005 given up all hope of getting any help even from the "Bear", I don't understand what I have done wrong (if anything)! Link to comment Share on other sites More sharing options...
Spaceboy Posted June 1, 2005 Share Posted June 1, 2005 Hello Graham, Unfortunately I do not know these contributions so I cannot be of any help. Did you check out the specific forums of the Contributions Support ? You are posting in the general support where often you do not get a lot of Support. Try posting to one of the official support threads for your contributions. Good luck ! Didier. Published modified Contributions Link to comment Share on other sites More sharing options...
NEMROD34 Posted July 17, 2007 Share Posted July 17, 2007 Hello , with the original contribution i have : TEP ERROR! (tep_display_banner(static, ) -> Banner with ID '' not found, or status inactive on the place of banner ! you have an idea? Link to comment Share on other sites More sharing options...
bhbilbao Posted April 6, 2011 Share Posted April 6, 2011 Need help, all working except for the MANUFACTURERS pages. www. myweb .com/manufacturer-m-20.html There is no banner. I thing this is ther wrong code. Please help. /functions/banner.php // Check to see if a banner exists function tep_banner_exists($action, $identifier) { //added for os6tm banner manager global $current_category_id, $HTTP_GET_VARS; if ($HTTP_GET_VARS['manufacturers_id'] == '') { if ($action == 'dynamic') { return tep_random_select("select b.banners_id, b.banners_title, b.banners_image, b.banners_html_text from " . TABLE_BANNERS . " b, " . TABLE_BANNERS_TO_CATEGORIES . " btc where status = '1' and banners_group = '" . $identifier . "' and btc.categories_id = '" . $current_category_id . "' and b.banners_id = btc.banners_id"); } elseif ($action == 'static') { //added for os6tm banner manager $banner_query = tep_db_query("select b.banners_id, b.banners_title, b.banners_image, b.banners_html_text from " . TABLE_BANNERS . " b, " . TABLE_BANNERS_TO_CATEGORIES . " btc where status = '1' and banners_id = '" . (int)$identifier . "' and btc.categories_id = '" . $current_category_id . "' and b.banners_id = btc.banners_id"); return tep_db_fetch_array($banner_query); } else { return false; } } else { return false; } } Link to comment Share on other sites More sharing options...
bhbilbao Posted April 7, 2011 Share Posted April 7, 2011 There is also some type of bug with other contrib: http://addons.oscommerce.com/info/3713 If I place the code before include (DIR_WS_INCLUDES . 'products_next_previous.php'); the banner works fine. ¿? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.