Cyber-Drugs Posted July 23, 2004 Posted July 23, 2004 Hi, I am busy trying to alter my category box to look like one that I hard coded. Here is what it looks like at the moment: www.cyber-lane.co.uk/Online And here is what I want to make it look like: www.cyber-lane.co.uk/Shop Could someone gimme a hand to make it look like my hard coded one please? I know next to nothing about PHP, but am willing to learn. Thanks :) Cyber-Drugs B)
burt Posted July 23, 2004 Posted July 23, 2004 You have it pretty close already. Just take the category out of it's infobox: Change from this [ in includes/boxes/categories.php ]: $info_box_contents = array(); $info_box_contents[] = array('text' => $categories_string); new infoBox($info_box_contents); to this: echo $categories_string; Remove this: $info_box_contents = array(); $info_box_contents[] = array('text' => BOX_HEADING_CATEGORIES); new infoBoxHeading($info_box_contents, true, false); Then you will need to set style on your links, do this in the stylesheet.
241 Posted July 23, 2004 Posted July 23, 2004 I answered in your other post 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.
Cyber-Drugs Posted July 23, 2004 Author Posted July 23, 2004 I changed the first bit you asked, and that removed the heading but I cant find that next bit you wanted me to remove. Here is all of the code in that file after the first alteration you mentioned: <?php /* $Id: categories.php,v 1.23 2002/11/12 14:09:30 dgw_ Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2002 osCommerce Released under the GNU General Public License */ function tep_show_category($counter) { global $foo, $categories_string, $id, $aa; for ($a=0; $a<$foo[$counter]['level']; $a++) { if ($a == $foo[$counter]['level']-1) { $categories_string .= "<font color='#ff0000'> </font>"; } else { $categories_string .= "<font color='#ff0000'> </font>"; } } if ($foo[$counter]['level'] == 0) { if ($aa == 1) { $categories_string .= tep_image(DIR_WS_IMAGES . '../templates/CyberLaneOnline/images/hr01.gif', '3', '137', '') . '<br>'; } else {$aa=1;} } $categories_string .= '<nobr><a nowrap href="'; 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 . 'e02.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>'; } // if (tep_has_category_subcategories($counter)) { // $categories_string .= '->'; // } $categories_string .= '</nobr></a>'; // if (SHOW_COUNTS == 'true') { // $products_in_category = tep_count_products_in_category($counter); // if ($products_in_category > 0) { // $categories_string .= ' (' . $products_in_category . ')'; // } } $categories_string .= '<br>'; if ($foo[$counter]['next_id']) { tep_show_category($foo[$counter]['next_id']); } } ?> <!-- categories //--> <tr> <td> <?php $aa = 0; echo $categories_string; $categories_string = ''; // add links to products with no category $product_query = tep_db_query("select p.products_id, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = p2c.products_id and p2c.categories_id = 0 and p.products_id = pd.products_id and pd.language_id ='" . (int)$languages_id . "' order by pd.products_name " ); while ($no_category = tep_db_fetch_array($product_query)) { $no_cat_product_id = $no_category['products_id']; $no_cat_products_name = $no_category['products_name']; $myref = "<a href=" . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $no_cat_product_id) . '>' . $no_cat_products_name . '</a><br><br>'; $categories_string .= $myref; } // end links to products with no category $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 = '0' 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)) { $foo[$categories['categories_id']] = array( 'name' => $categories['categories_name'], 'parent' => $categories['parent_id'], 'level' => 0, 'path' => $categories['categories_id'], 'next_id' => false ); if (isset($prev_id)) { $foo[$prev_id]['next_id'] = $categories['categories_id']; } $prev_id = $categories['categories_id']; if (!isset($first_element)) { $first_element = $categories['categories_id']; } } //------------------------ if ($cPath) { $new_path = ''; $id = split('_', $cPath); reset($id); while (list($key, $value) = each($id)) { unset($prev_id); unset($first_id); $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 = '" . $value . "' and c.categories_id = cd.categories_id and cd.language_id='" . $languages_id ."' order by sort_order, cd.categories_name"); $category_check = tep_db_num_rows($categories_query); if ($category_check > 0) { $new_path .= $value; while ($row = tep_db_fetch_array($categories_query)) { $foo[$row['categories_id']] = array( 'name' => $row['categories_name'], 'parent' => $row['parent_id'], 'level' => $key+1, 'path' => $new_path . '_' . $row['categories_id'], 'next_id' => false ); if (isset($prev_id)) { $foo[$prev_id]['next_id'] = $row['categories_id']; } $prev_id = $row['categories_id']; if (!isset($first_id)) { $first_id = $row['categories_id']; } $last_id = $row['categories_id']; } $foo[$last_id]['next_id'] = $foo[$value]['next_id']; $foo[$value]['next_id'] = $first_id; $new_path .= '_'; } else { break; } } } tep_show_category($first_element); $info_box_contents = array(); $info_box_contents[] = array('align' => 'left', 'text' => $categories_string ); // WebMakers.com Added: All products or All Products Multiple Purchase // new infoBox($info_box_contents); // WebMakers.com Added: Show All Products Listing if (SHOW_ALL_PRODUCTS_BOX=='1') { $info_box_contents[] = array('align' => 'center" valign="top', 'text' => '<hr><a href="' . tep_href_link(FILENAME_ALLPRODS, '', 'NONSSL') . '">' . BOX_INFORMATION_ALLPRODS . '</a>'); } // WebMakers.com Added: Show multiple product listing add for all products if (SHOW_PRODUCT_LISTINGS_MULTI_ADD_BOX=='1') { // All Products Multiple Purchase $info_box_contents[] = array('align' => 'center" valign="top', 'text' => '<hr><a href="' . tep_href_link(FILENAME_PRODUCTS_ALL, '', 'NONSSL') . '">' . BOX_INFORMATION_PRODUCT_ALL . '</a>'); } new InfoBox($info_box_contents); ?> </td> </tr> <!-- categories_eof //--> [EDIT] 241, you kindly told me what to do, but as I dont know PHP I had no idea "how" to do it, hence my post here. Thanks for all your help thus far though, highly appreciated. :) [/EDIT] Thanks :) Cyber-Drugs B)
burt Posted July 23, 2004 Posted July 23, 2004 That's because you don't have a standard categories box file. Get rid of all that "webmakers" code and you'll see what you need to change.
Cyber-Drugs Posted July 23, 2004 Author Posted July 23, 2004 Do you mean for me to delete all of the following? // WebMakers.com Added: All products or All Products Multiple Purchase // new infoBox($info_box_contents); // WebMakers.com Added: Show All Products Listing if (SHOW_ALL_PRODUCTS_BOX=='1') { $info_box_contents[] = array('align' => 'center" valign="top', 'text' => '<hr><a href="' . tep_href_link(FILENAME_ALLPRODS, '', 'NONSSL') . '">' . BOX_INFORMATION_ALLPRODS . '</a>'); } // WebMakers.com Added: Show multiple product listing add for all products if (SHOW_PRODUCT_LISTINGS_MULTI_ADD_BOX=='1') { // All Products Multiple Purchase $info_box_contents[] = array('align' => 'center" valign="top', 'text' => '<hr><a href="' . tep_href_link(FILENAME_PRODUCTS_ALL, '', 'NONSSL') . '">' . BOX_INFORMATION_PRODUCT_ALL . '</a>'); } new InfoBox($info_box_contents); Thanks :) Cyber-Drugs B)
241 Posted July 23, 2004 Posted July 23, 2004 actually I was refering to this post http://www.oscommerce.com/forums/index.php?sho...ndpost&p=412062 and in the above post keep the last part new InfoBox($info_box_contents); 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.
Cyber-Drugs Posted July 23, 2004 Author Posted July 23, 2004 Ah, I never thought any would reply to it, thanks guys, your the best :) Cyber-Drugs B)
241 Posted July 23, 2004 Posted July 23, 2004 as burt pointed out the stylesheet will be where you can change the colour of the content area to white to match the other site #FFFFFF .infoBoxContents { background: #f8f8f9; font-family: Verdana, Arial, sans-serif; font-size: 10px; } change to .infoBoxContents { background: #ffffff; font-family: Verdana, Arial, sans-serif; font-size: 10px; } 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.
Cyber-Drugs Posted July 23, 2004 Author Posted July 23, 2004 Thanks alot 241 your a role model of mine now, hehe. :) Thanks a load :) Just need to know how to move the text in a little bit so I can see the border of my box properly and then im all done :) Cyber-Drugs B)
burt Posted July 23, 2004 Posted July 23, 2004 use padding-left: 10px; in the relevant stylesheet call.
Cyber-Drugs Posted July 23, 2004 Author Posted July 23, 2004 241 - That background color CSS didnt work, so it must be the wrong sheet you asked me to edit. Or maybe the wrong part of it? burt - Your padding CSS didnt work either, so I guess it is related to me putting it in the wrong sheet call. Thanks :) Cyber-Drugs B)
241 Posted July 23, 2004 Posted July 23, 2004 which sheet are you editing the one for the original or the one for the template you can also use spacing in the categories.php as well 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.
Cyber-Drugs Posted July 23, 2004 Author Posted July 23, 2004 The original one, but I fiddled around with the Template one and it is starting to work now, I have just about finished it, thanks alot guys and sorry to have wasted your time so much :) Cyber-Drugs B)
Recommended Posts
Archived
This topic is now archived and is closed to further replies.