241 Posted March 6, 2005 Author Share Posted March 6, 2005 (edited) Thanks for the quick tip Steve... Nice MOD, looks great. I have a question about using this MOD in conjuction with the InfoBox Admin MOD. I have gotten each of them to work when installed seperately but not together... I run into a problem when I do a file compare for the changes in: /catalog/includes/boxes/categories.php there are alot of differences in the code... I'll understand if you don't have the time to tackle my issue, but I was wondering if anyone got these two mods working together? thanks in advance <{POST_SNAPBACK}> They are actually very similar in code with hardly any change add this if ( (USE_CACHE == 'true') && !defined('SID')) { echo tep_cache_categories_box(); } else { before this line function tep_show_category($counter) { global $foo, $categories_string, $id, $aa; then add <?php } ?> before this line <!-- categories_eof //--> do these changes to this contributions file Edited March 6, 2005 by 241 Quote No longer giving free advice. Please place deposit in meter slot provided. Individual: [=] SME: [==] Corporation: [===] If deposit does not fit one of the slots provided then you are asking too much! Is your Osc dated try Phoenix raising oscommerce from the ashes. Link to comment Share on other sites More sharing options...
ifccnb Posted March 15, 2005 Share Posted March 15, 2005 Just wanted to mention that your code in the above post worked perfectly for me. Being a non-php guy, I say thank you. Your help was most appreciated. :thumbsup: Quote Link to comment Share on other sites More sharing options...
grayson Posted March 24, 2005 Share Posted March 24, 2005 Dear Steve, I just installed the contribution and it looks great. Thanks for your work, and for all your support in this thread. I have a question about using this contribution together with something like the categories_tree contribution, which forces all categories and subcategories to show always. A similar question has already come up in this thread: I was really after something like your contribution but with all categories showing... i like the idea of the bullets on the side... it looks neat. Can you explain what additions i need to make to your code to show all the categories... <{POST_SNAPBACK}> But I haven't seen an answer come by, so I thought I'd ask if you (or someone else) had merged the two contributions or otherwise had a solution, so as to avoid reinventing the wheel :D . Many thanks, Grayson Morris Quote Grayson Morris Link to comment Share on other sites More sharing options...
grayson Posted March 25, 2005 Share Posted March 25, 2005 Yesterday I said: I have a question about using this contribution together with something like the categories_tree contribution, which forces all categories and subcategories to show always. But I haven't seen an answer come by, so I thought I'd ask if you (or someone else) had merged the two contributions or otherwise had a solution, so as to avoid reinventing the wheel :D . <{POST_SNAPBACK}> Went ahead and reinvented the wheel. To use Categories_tree with Categories Box Bullet and Line on osc2.2M2, install the categories_tree contrib first, then make the changes to it shown below between "for BLC" and "end BLC" (alternatively, just copy the file here in its entirety): <?php /* $Id: categories.php,v 1.17 2002/03/07 20:53:58 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2001 osCommerce Released under the GNU General Public License */ // Categories_tree written by Gideon Romm from Symbio Technologies, LLC function tep_show_category($cid, $cpath, $COLLAPSABLE) { global $categories_string, $languages_id, $HTTP_GET_VARS, $aa; global $level; $selectedPath = array(); // Note: $aa is used only for Bullet Line contribution (BLC) // Get all of the categories on this level $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = " . $cid . " and c.categories_id = cd.categories_id and cd.language_id='" . $languages_id ."' order by sort_order, cd.categories_name"); while ($categories = tep_db_fetch_array($categories_query)) { if ($level{$categories['parent_id']} == "") { $level{$categories['parent_id']} = 0; } $level{$categories['categories_id']} = $level{$categories['parent_id']} + 1; // Add category link to $categories_string for ($a=1; $a<$level{$categories['categories_id']}; $a++) { $categories_string .= " "; } // for BLC // if ($foo[$counter]['level'] == 0) :updated with this file's var names below if ($level{$categories['categories_id']} == 0) { if ($aa == 1) { $categories_string .= "<hr>"; } else {$aa=1;} } // end BLC // for BLC // $categories_string .= '<a href="'; $categories_string .= '<nobr><a nowrap href="'; // end BLC $cPath_new = $cpath; if ($level{$categories['parent_id']} > 0) { $cPath_new .= "_"; } $cPath_new .= $categories['categories_id']; $cPath_new_text = "cPath=" . $cPath_new; $categories_string .= tep_href_link(FILENAME_DEFAULT, $cPath_new_text); // for BLC // $categories_string .= '">'; $categories_string .= '">' . tep_image(DIR_WS_IMAGES . 'checkout_bullet.gif', '') . ' ';; // end BLC if ($HTTP_GET_VARS['cPath']) { $selectedPath = split("_", $HTTP_GET_VARS['cPath']); } if (in_array($categories['categories_id'], $selectedPath)) { $categories_string .= '<b>'; } if ($level{$categories['categories_id']} == 1) { $categories_string .= '<u>'; } $categories_string .= $categories['categories_name']; if ($COLLAPSABLE && tep_has_category_subcategories($categories['categories_id'])) { $categories_string .= ' ->'; } if ($level{$categories['categories_id']} == 1) { $categories_string .= '</u>'; } if (in_array($categories['categories_id'], $selectedPath)) { $categories_string .= '</b>'; } $categories_string .= '</a>'; if (SHOW_COUNTS) { $products_in_category = tep_count_products_in_category($categories['categories_id']); if ($products_in_category > 0) { $categories_string .= ' (' . $products_in_category . ')'; } } $categories_string .= '<br>'; // If I have subcategories, get them and show them if (tep_has_category_subcategories($categories['categories_id'])) { if ($COLLAPSABLE) { if (in_array($categories['categories_id'], $selectedPath)) { tep_show_category($categories['categories_id'], $cPath_new, $COLLAPSABLE); } } else { tep_show_category($categories['categories_id'], $cPath_new, $COLLAPSABLE); } } } } ?> <!-- categories //--> <tr> <td> <?php // for BLC $aa = 0; // end BLC $info_box_contents = array(); $info_box_contents[] = array('align' => 'left', 'text' => BOX_HEADING_CATEGORIES ); new infoBoxHeading($info_box_contents, true, false); $categories_string = ''; // tep_show_category(<top category_id>, <top cpath>, <1=Collapsable tree, 0=static--show all>) tep_show_category(0,'',0); $info_box_contents = array(); $info_box_contents[] = array('align' => 'left', 'text' => $categories_string ); new infoBox($info_box_contents); ?> </td> </tr> <!-- categories_eof //--> hope this helps someone. Regards, Grayson Quote Grayson Morris Link to comment Share on other sites More sharing options...
rowethd Posted April 18, 2005 Share Posted April 18, 2005 Hi, I am very new to OSCOMMERCE and this is my first site using this system. I have already successfully installed this contribution for use with categories, but would like to also integrate it into the EXTRA PAGES contribution I installed. Does anyone have any ideas about how to go about it? This is the code: ?php /* $Id: info_pages.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 */ $page_query = tep_db_query("select p.pages_id, p.sort_order, p.status, s.pages_title, s.pages_html_text, s.intorext, s.externallink, s.link_target from " . TABLE_PAGES . " p LEFT JOIN " .TABLE_PAGES_DESCRIPTION . " s on p.pages_id = s.pages_id where p.status = 1 and p.page_type != 1 and s.language_id = '" . (int)$languages_id . "' order by p.sort_order, s.pages_title"); ?> <!-- info_pages //--> <tr> <td> <?php $info_box_contents = array(); $info_box_contents[] = array('text' => BOX_HEADING_PAGES); new infoBoxHeading($info_box_contents, false, false); $rows = 0; $page_list = '<table border="0" width="100%" cellspacing="0" cellpadding="1">'; while ($page = tep_db_fetch_array($page_query)) { $rows++; $target=""; if($page['link_target']== 1) { $target="_blank"; } if($page['pages_title'] != 'Contact Us'){ $link = FILENAME_PAGES . '?pages_id=' . $page['pages_id']; }else{ $link = FILENAME_CONTACT_US; } if($page['intorext'] == 1) { $page_list .= '<tr><td class="infoBoxContents"><a target="'.$target.'" href="' . $page['externallink'] . '">' . $page['pages_title'] . '</a></td></tr>'; } else { $page_list .= '<tr><td class="infoBoxContents"><a target="'.$target.'" href="' . tep_href_link($link) . '">' . $page['pages_title'] . '</a></td></tr>'; } } $page_list .= '</table>'; $info_box_contents = array(); $info_box_contents[] = array('text' => $page_list); new infoBox($info_box_contents); ?> </td> </tr> <!-- info_pages_eof //--> Thanks for your time. Quote Link to comment Share on other sites More sharing options...
abz786 Posted November 5, 2005 Share Posted November 5, 2005 Hi, I've installed this fantastic contribution (Categories Box Bullet and Line only) and it looks great . However, ever so often I'm getting the following error in the categories box which disappears once you refresh the page: Warning: in_array(): Wrong datatype for second argument in /home/public_html/includes/boxes/categories.php on line 57 Warning: in_array(): Wrong datatype for second argument. Line 57 refers to the following section of my /boxes/categories.php file if ($foo[$counter]['parent'] == 0) { $categories_string .= tep_href_link(FILENAME_DEFAULT, $cPath_new); $categories_string .= '">' . tep_image(DIR_WS_IMAGES . 'arrow_right_nav.gif', '') . ' '; } else { $categories_string .= tep_href_link(FILENAME_DEFAULT, $cPath_new); $categories_string .= '">' . tep_image(DIR_WS_IMAGES . 'arrow_bullet_square.gif', '') . ' '; } //ACTUAL LINE 57 - SEE BELOW if ( ($id) && (in_array($counter, $id)) ) { $categories_string .= "<b><font color='#CC0000'>"; } Any ideas why this is happening?? Quote Link to comment Share on other sites More sharing options...
241 Posted November 5, 2005 Author Share Posted November 5, 2005 Hi, I've installed this fantastic contribution (Categories Box Bullet and Line only) and it looks great . However, ever so often I'm getting the following error in the categories box which disappears once you refresh the page: Warning: in_array(): Wrong datatype for second argument in /home/public_html/includes/boxes/categories.php on line 57 Warning: in_array(): Wrong datatype for second argument. Line 57 refers to the following section of my /boxes/categories.php file if ($foo[$counter]['parent'] == 0) { $categories_string .= tep_href_link(FILENAME_DEFAULT, $cPath_new); $categories_string .= '">' . tep_image(DIR_WS_IMAGES . 'arrow_right_nav.gif', '') . ' '; } else { $categories_string .= tep_href_link(FILENAME_DEFAULT, $cPath_new); $categories_string .= '">' . tep_image(DIR_WS_IMAGES . 'arrow_bullet_square.gif', '') . ' '; } //ACTUAL LINE 57 - SEE BELOW if ( ($id) && (in_array($counter, $id)) ) { $categories_string .= "<b><font color='#CC0000'>"; } Any ideas why this is happening?? Your code is not the code of the contribution but a modified code therefore has nothing to do with the contribution. The contributions code is line #40 to line #60 if ($foo[$counter]['parent'] == 0) { $cPath_new = 'cPath=' . $counter; } else { $cPath_new = 'cPath=' . $foo[$counter]['path']; } $categories_string .= tep_href_link(FILENAME_DEFAULT, $cPath_new); $categories_string .= '">' . tep_image(DIR_WS_IMAGES . 'checkout_bullet.gif', '') . ' ';; if ( ($id) && (in_array($counter, $id)) ) { $categories_string .= "<b><font color='#ff0000'>"; } // display category name $categories_string .= $foo[$counter]['name']; if ( ($id) && (in_array($counter, $id)) ) { $categories_string .= '</font></b>'; } Quote No longer giving free advice. Please place deposit in meter slot provided. Individual: [=] SME: [==] Corporation: [===] If deposit does not fit one of the slots provided then you are asking too much! Is your Osc dated try Phoenix raising oscommerce from the ashes. Link to comment Share on other sites More sharing options...
mr.eyetee Posted November 22, 2005 Share Posted November 22, 2005 Hi, is there any way to center the catagory names next to the button image? Thanks 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.