birchy82 Posted June 7, 2007 Share Posted June 7, 2007 Ok im in need of an addon that is like the banner manager except you can add banners or advertisements for products within the product listing right where the header image is. so when you are createing the banner just like in the banner manager you can choose under what categorie or sub cat you want the banner to show up so you can display a sale banner above the sub categorie images. just like this. shows in blue http://www.target.com/gp/browse.html/ref=n...mp;node=1042122 Quote Link to comment Share on other sites More sharing options...
oschellas Posted June 7, 2007 Share Posted June 7, 2007 Would not be very hard to use the existing banner function for this, add some coding from the example where you want to display the banners and create banner groups in your admin related to the categories (use their ID from the cPath var). if ($banner = tep_banner_exists('dynamic', $HTTP_GET_VARS['cPath'])) { $show_banner = tep_display_banner('dynamic', $HTTP_GET_VARS['cPath']); echo $show_banner; } Quote Link to comment Share on other sites More sharing options...
Guest Posted June 7, 2007 Share Posted June 7, 2007 I agree, you can just created and oschellas described, just a little bit of programming and thats it. Interesting idea though for people who use the banner system, otherwise I would comment it out to save up a few queries, Quote Link to comment Share on other sites More sharing options...
birchy82 Posted June 7, 2007 Author Share Posted June 7, 2007 Would not be very hard to use the existing banner function for this, add some coding from the example where you want to display the banners and create banner groups in your admin related to the categories (use their ID from the cPath var). if ($banner = tep_banner_exists('dynamic', $HTTP_GET_VARS['cPath'])) { $show_banner = tep_display_banner('dynamic', $HTTP_GET_VARS['cPath']); echo $show_banner; } hmm im not sure i totally understand what you are saying, will that enable me to display a differant banner for each categorie of my choice so right above the sub categorie pictures on the index.php page it will show the banner if i have chossen one for that particular categorie? Quote Link to comment Share on other sites More sharing options...
oschellas Posted June 7, 2007 Share Posted June 7, 2007 Yes, for example for the maincatetegory with cpath 1 you create a group in the banner manager called 1, for a subcategory with cpath 1_1 you create a group 1_1 and so on... Quote Link to comment Share on other sites More sharing options...
birchy82 Posted June 7, 2007 Author Share Posted June 7, 2007 Yes, for example for the maincatetegory with cpath 1 you create a group in the banner manager called 1, for a subcategory with cpath 1_1 you create a group 1_1 and so on... hm ok i will give it a show ill let you know how it turns out Quote Link to comment Share on other sites More sharing options...
birchy82 Posted June 7, 2007 Author Share Posted June 7, 2007 Yes, for example for the maincatetegory with cpath 1 you create a group in the banner manager called 1, for a subcategory with cpath 1_1 you create a group 1_1 and so on... would it look something like this, if so its not workin for me. if ($banner = tep_banner_exists('dynamic', $HTTP_GET_VARS['cPath= . '1_17])) { $show_banner = tep_display_banner('dynamic', $HTTP_GET_VARS['cPath']); echo $show_banner; } Quote Link to comment Share on other sites More sharing options...
oschellas Posted June 7, 2007 Share Posted June 7, 2007 No, like I posted before: if ($banner = tep_banner_exists('dynamic', $HTTP_GET_VARS['cPath'])) { $show_banner = tep_display_banner('dynamic', $HTTP_GET_VARS['cPath']); echo $show_banner; } The $HTTP_GET_VARS['cPath'] takes the value from the url if you are visiting a category, you specify the 1_17 as group in your banner admin and you attach banner(s) to this group. Quote Link to comment Share on other sites More sharing options...
birchy82 Posted June 7, 2007 Author Share Posted June 7, 2007 No, like I posted before: if ($banner = tep_banner_exists('dynamic', $HTTP_GET_VARS['cPath'])) { $show_banner = tep_display_banner('dynamic', $HTTP_GET_VARS['cPath']); echo $show_banner; } The $HTTP_GET_VARS['cPath'] takes the value from the url if you are visiting a category, you specify the 1_17 as group in your banner admin and you attach banner(s) to this group. dude you are the man! thanks so much i've been searching forever for something to function like this i've even tryed some thing on my own this was my last resort. You're the shit, Ryan Quote Link to comment Share on other sites More sharing options...
birchy82 Posted June 7, 2007 Author Share Posted June 7, 2007 No, like I posted before: if ($banner = tep_banner_exists('dynamic', $HTTP_GET_VARS['cPath'])) { $show_banner = tep_display_banner('dynamic', $HTTP_GET_VARS['cPath']); echo $show_banner; } The $HTTP_GET_VARS['cPath'] takes the value from the url if you are visiting a category, you specify the 1_17 as group in your banner admin and you attach banner(s) to this group. ok stupid question...now how do i link the banners to a particular product. without dropping the session sorry to bother you again. Quote Link to comment Share on other sites More sharing options...
oschellas Posted June 8, 2007 Share Posted June 8, 2007 (edited) You would have to modify catalog/includes/functions/banner.php Replace this code: function tep_display_banner($action, $identifier) { if ($action == 'dynamic') { $banners_query = tep_db_query("select count(*) as count from " . TABLE_BANNERS . " where status = '1' and banners_group = '" . $identifier . "'"); $banners = tep_db_fetch_array($banners_query); if ($banners['count'] > 0) { $banner = tep_random_select("select banners_id, banners_title, banners_image, banners_html_text from " . TABLE_BANNERS . " where status = '1' and banners_group = '" . $identifier . "'"); } else { return '<b>TEP ERROR! (tep_display_banner(' . $action . ', ' . $identifier . ') -> No banners with group \'' . $identifier . '\' found!</b>'; } } elseif ($action == 'static') { if (is_array($identifier)) { $banner = $identifier; } else { $banner_query = tep_db_query("select banners_id, banners_title, banners_image, banners_html_text from " . TABLE_BANNERS . " where status = '1' and banners_id = '" . (int)$identifier . "'"); if (tep_db_num_rows($banner_query)) { $banner = tep_db_fetch_array($banner_query); } else { return '<b>TEP ERROR! (tep_display_banner(' . $action . ', ' . $identifier . ') -> Banner with ID \'' . $identifier . '\' not found, or status inactive</b>'; } } } else { return '<b>TEP ERROR! (tep_display_banner(' . $action . ', ' . $identifier . ') -> Unknown $action parameter value - it must be either \'dynamic\' or \'static\'</b>'; } if (tep_not_null($banner['banners_html_text'])) { $banner_string = $banner['banners_html_text']; } else { $banner_string = '<a href="' . tep_href_link(FILENAME_REDIRECT, 'action=banner&goto=' . $banner['banners_id']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $banner['banners_image'], $banner['banners_title']) . '</a>'; } tep_update_banner_display_count($banner['banners_id']); return $banner_string; } By this: function tep_display_banner($action, $identifier) { if ($action == 'dynamic') { $banners_query = tep_db_query("select count(*) as count from " . TABLE_BANNERS . " where status = '1' and banners_group = '" . $identifier . "'"); $banners = tep_db_fetch_array($banners_query); if ($banners['count'] > 0) { $banner = tep_random_select("select banners_id, banners_title, banners_image, banners_html_text from " . TABLE_BANNERS . " where status = '1' and banners_group = '" . $identifier . "'"); } else { return '<b>TEP ERROR! (tep_display_banner(' . $action . ', ' . $identifier . ') -> No banners with group \'' . $identifier . '\' found!</b>'; } } elseif ($action == 'static') { if (is_array($identifier)) { $banner = $identifier; } else { $banner_query = tep_db_query("select banners_id, banners_title, banners_image, banners_html_text from " . TABLE_BANNERS . " where status = '1' and banners_id = '" . (int)$identifier . "'"); if (tep_db_num_rows($banner_query)) { $banner = tep_db_fetch_array($banner_query); } else { return '<b>TEP ERROR! (tep_display_banner(' . $action . ', ' . $identifier . ') -> Banner with ID \'' . $identifier . '\' not found, or status inactive</b>'; } } } else { return '<b>TEP ERROR! (tep_display_banner(' . $action . ', ' . $identifier . ') -> Unknown $action parameter value - it must be either \'dynamic\' or \'static\'</b>'; } if (tep_not_null($banner['banners_html_text'])) { $banner_string = $banner['banners_html_text']; } else { if(is_numeric($banner['banners_url'])){ $banner_string = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $banner['banners_url']) . '" target="_self">' . tep_image(DIR_WS_IMAGES . $banner['banners_image'], $banner['banners_title']) . '</a>'; } else { $banner_string = '<a href="' . tep_href_link(FILENAME_REDIRECT, 'action=banner&goto=' . $banner['banners_id']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $banner['banners_image'], $banner['banners_title']) . '</a>'; } } tep_update_banner_display_count($banner['banners_id']); return $banner_string; } And specify in the admin banner manager only the product id as url for the banner. For example if the product id from the product you want to link to is 1, Banner URL: 1 Edited June 8, 2007 by oschellas Quote Link to comment Share on other sites More sharing options...
oschellas Posted June 8, 2007 Share Posted June 8, 2007 Just too late to edit my previous message, use the code from below to replace with the original. function tep_display_banner($action, $identifier) { if ($action == 'dynamic') { $banners_query = tep_db_query("select count(*) as count from " . TABLE_BANNERS . " where status = '1' and banners_group = '" . $identifier . "'"); $banners = tep_db_fetch_array($banners_query); if ($banners['count'] > 0) { $banner = tep_random_select("select banners_id, banners_url, banners_title, banners_image, banners_html_text from " . TABLE_BANNERS . " where status = '1' and banners_group = '" . $identifier . "'"); } else { return '<b>TEP ERROR! (tep_display_banner(' . $action . ', ' . $identifier . ') -> No banners with group \'' . $identifier . '\' found!</b>'; } } elseif ($action == 'static') { if (is_array($identifier)) { $banner = $identifier; } else { $banner_query = tep_db_query("select banners_id, banners_url, banners_title, banners_image, banners_html_text from " . TABLE_BANNERS . " where status = '1' and banners_id = '" . (int)$identifier . "'"); if (tep_db_num_rows($banner_query)) { $banner = tep_db_fetch_array($banner_query); } else { return '<b>TEP ERROR! (tep_display_banner(' . $action . ', ' . $identifier . ') -> Banner with ID \'' . $identifier . '\' not found, or status inactive</b>'; } } } else { return '<b>TEP ERROR! (tep_display_banner(' . $action . ', ' . $identifier . ') -> Unknown $action parameter value - it must be either \'dynamic\' or \'static\'</b>'; } if (tep_not_null($banner['banners_html_text'])) { $banner_string = $banner['banners_html_text']; } else { if(is_numeric($banner['banners_url'])){ $banner_string = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $banner['banners_url']) . '" target="_self">' . tep_image(DIR_WS_IMAGES . $banner['banners_image'], $banner['banners_title']) . '</a>'; } else { $banner_string = '<a href="' . tep_href_link(FILENAME_REDIRECT, 'action=banner&goto=' . $banner['banners_id']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $banner['banners_image'], $banner['banners_title']) . '</a>'; } } tep_update_banner_display_count($banner['banners_id']); return $banner_string; } Quote Link to comment Share on other sites More sharing options...
birchy82 Posted June 8, 2007 Author Share Posted June 8, 2007 Just too late to edit my previous message, use the code from below to replace with the original. function tep_display_banner($action, $identifier) { if ($action == 'dynamic') { $banners_query = tep_db_query("select count(*) as count from " . TABLE_BANNERS . " where status = '1' and banners_group = '" . $identifier . "'"); $banners = tep_db_fetch_array($banners_query); if ($banners['count'] > 0) { $banner = tep_random_select("select banners_id, banners_url, banners_title, banners_image, banners_html_text from " . TABLE_BANNERS . " where status = '1' and banners_group = '" . $identifier . "'"); } else { return '<b>TEP ERROR! (tep_display_banner(' . $action . ', ' . $identifier . ') -> No banners with group \'' . $identifier . '\' found!</b>'; } } elseif ($action == 'static') { if (is_array($identifier)) { $banner = $identifier; } else { $banner_query = tep_db_query("select banners_id, banners_url, banners_title, banners_image, banners_html_text from " . TABLE_BANNERS . " where status = '1' and banners_id = '" . (int)$identifier . "'"); if (tep_db_num_rows($banner_query)) { $banner = tep_db_fetch_array($banner_query); } else { return '<b>TEP ERROR! (tep_display_banner(' . $action . ', ' . $identifier . ') -> Banner with ID \'' . $identifier . '\' not found, or status inactive</b>'; } } } else { return '<b>TEP ERROR! (tep_display_banner(' . $action . ', ' . $identifier . ') -> Unknown $action parameter value - it must be either \'dynamic\' or \'static\'</b>'; } if (tep_not_null($banner['banners_html_text'])) { $banner_string = $banner['banners_html_text']; } else { if(is_numeric($banner['banners_url'])){ $banner_string = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $banner['banners_url']) . '" target="_self">' . tep_image(DIR_WS_IMAGES . $banner['banners_image'], $banner['banners_title']) . '</a>'; } else { $banner_string = '<a href="' . tep_href_link(FILENAME_REDIRECT, 'action=banner&goto=' . $banner['banners_id']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $banner['banners_image'], $banner['banners_title']) . '</a>'; } } tep_update_banner_display_count($banner['banners_id']); return $banner_string; } You're the shit dude! Thanks alotttt i wanna pass you alittle money for helping me out, whats your paypal? Quote Link to comment Share on other sites More sharing options...
birchy82 Posted June 20, 2007 Author Share Posted June 20, 2007 Just too late to edit my previous message, use the code from below to replace with the original. function tep_display_banner($action, $identifier) { if ($action == 'dynamic') { $banners_query = tep_db_query("select count(*) as count from " . TABLE_BANNERS . " where status = '1' and banners_group = '" . $identifier . "'"); $banners = tep_db_fetch_array($banners_query); if ($banners['count'] > 0) { $banner = tep_random_select("select banners_id, banners_url, banners_title, banners_image, banners_html_text from " . TABLE_BANNERS . " where status = '1' and banners_group = '" . $identifier . "'"); } else { return '<b>TEP ERROR! (tep_display_banner(' . $action . ', ' . $identifier . ') -> No banners with group \'' . $identifier . '\' found!</b>'; } } elseif ($action == 'static') { if (is_array($identifier)) { $banner = $identifier; } else { $banner_query = tep_db_query("select banners_id, banners_url, banners_title, banners_image, banners_html_text from " . TABLE_BANNERS . " where status = '1' and banners_id = '" . (int)$identifier . "'"); if (tep_db_num_rows($banner_query)) { $banner = tep_db_fetch_array($banner_query); } else { return '<b>TEP ERROR! (tep_display_banner(' . $action . ', ' . $identifier . ') -> Banner with ID \'' . $identifier . '\' not found, or status inactive</b>'; } } } else { return '<b>TEP ERROR! (tep_display_banner(' . $action . ', ' . $identifier . ') -> Unknown $action parameter value - it must be either \'dynamic\' or \'static\'</b>'; } if (tep_not_null($banner['banners_html_text'])) { $banner_string = $banner['banners_html_text']; } else { if(is_numeric($banner['banners_url'])){ $banner_string = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $banner['banners_url']) . '" target="_self">' . tep_image(DIR_WS_IMAGES . $banner['banners_image'], $banner['banners_title']) . '</a>'; } else { $banner_string = '<a href="' . tep_href_link(FILENAME_REDIRECT, 'action=banner&goto=' . $banner['banners_id']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $banner['banners_image'], $banner['banners_title']) . '</a>'; } } tep_update_banner_display_count($banner['banners_id']); return $banner_string; } Ok now that you can link the banners to products i was wondering if there was a way to link them to categories as well without the 2 screwing eachother up. I was able to get it to work but it disabled the banners i had linked to the categories. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.