Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

main catergories list


gravspeed

Recommended Posts

Posted

i would like to make the first level of the the site (currently the what's new page) to be more like the bulk of the site, with the icons of the subcatergories just above the what's new infobox... i came close to accomplishing the very easily by changing line 16 of the index php from $category_depth = 'top'; to $category_depth = 'nested'; but that makes the page title "Catalog" removes the welcome message and login link and gererates a "Warning: Empty delimiter in /var/www/shop/catalog/index.php on line 80"... i know that's where all the right decisions are made, but i can't quite figure it out... it seems like it should be simple... any thoughts?

Scott Wigle

 

"The first rule of intelligent tinkering is to save all the pieces"

Aldo Leopold

Posted

so i've learned a little more but not enough...there is a giant if () {} elseif () {} else {} that controls wether you see a nested page, product list, or the default, which sections do i need to use to get the catergory names and pictures into the table... also thinking that the table should center when the last row has only 1 or 2 items in it, it will if there are only 1 or 2, maybe a new table for each row?

anyone know how to read this code?

 

Scott

 

"The first rule of intelligent tinkering is to save all the pieces"

Aldo Leopold

Scott Wigle

 

"The first rule of intelligent tinkering is to save all the pieces"

Aldo Leopold

Posted

I would try the following: around line 58 change

  if ($category_depth == 'nested') {

to

  if (($category_depth == 'nested') || ($category_depth == 'top')) {

around lines 63-73, change

      <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
           <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>            <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . $category['categories_image'], $category['categories_name'], HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>

to

  if ($category_depth == 'nested') {
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
           <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>            <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . $category['categories_image'], $category['categories_name'], HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
<?php
   } else {
?>
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
           <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
           <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_default.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
           <td class="main"><?php echo tep_customer_greeting(); ?></td>
         </tr>
         <tr>
           <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
         </tr>
         <tr>
           <td class="main"><?php echo TEXT_MAIN; ?></td>
         </tr>
         <tr>
           <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
         </tr>
<?php
   }
?>

and see if that gets you closer to what you want. There is a fix posted for the line 80 error at http://www.oscommerce.com/community/bugs,1458

 

Hth,

Matt

  • 1 month later...
Posted

sorry for the long delay... life does not make my schedule easy... i've made the above modifications and i'm getting a parse error on line 159... that's the end of the if statement we modified first...i'll include my whole code as i noticed a few sutble differences... i'm using 2.2ms2...

 

if (($category_depth == 'nested')||($category_depth == 'top')) {
   $category_query = tep_db_query("select cd.categories_name, c.categories_image from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION .
" cd where c.categories_id = '" . (int)$current_category_id . "' and cd.categories_id = '" . (int)$current_category_id . "' and cd.language_id = '"
. (int)$languages_id . "'");
   $category = tep_db_fetch_array($category_query);
?>
   <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
   if ($category_depth == 'nested') {
   <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
           <td class="pageHeading"><?php echo $breadcrumb->last(); ?></td>
           <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . $category['categories_image'], $category['categories_name'], H
EADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
     <?php
   } else {
       ?>
           <tr>
           <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
           <tr>
           <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
           <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_default.gif', HEADING_TITLE, HEADING_IMAGE_W
IDTH, HEADING_IMAGE_HEIGHT); ?></td>
           </tr>
           </table></td>
           </tr>
           <tr>
           <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
           </tr>
           <tr>
           <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
           <tr>
           <td class="main"><?php echo tep_customer_greeting(); ?></td>
           </tr>
           <tr>
           <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
           </tr>
           <tr>
           <td class="main"><?php echo TEXT_MAIN; ?></td>
           </tr>
           <tr>
           <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
           </tr>
           <?php
   }
?>
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
         <tr>
           <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
             <tr>
<?php
   if (isset($cPath) && strpos('_', $cPath)) {
// check to see if there are deeper categories within the current category
     $category_links = array_reverse($cPath_array);
     for($i=0, $n=sizeof($category_links); $i<$n; $i++) {
       $categories_query = tep_db_query("select count(*) as total from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.p
arent_id = '" . (int)$category_links[$i] . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "'");
       $categories = tep_db_fetch_array($categories_query);
       if ($categories['total'] < 1) {
         // do nothing, go through the loop
       } else {
         $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id from " . TABLE_CATEGORIES . "
c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$category_links[$i] . "' and c.categories_id = cd.categories_id and cd.lang
uage_id = '" . (int)$languages_id . "' order by sort_order, cd.categories_name");
         break; // we've found the deepest category the customer is in
       }
     }
   } else {
     $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id from " . TABLE_CATEGORIES . " c,
" . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$current_category_id . "' and c.categories_id = cd.categories_id and cd.languag
e_id = '" . (int)$languages_id . "' order by sort_order, cd.categories_name");
   }

   $number_of_categories = tep_db_num_rows($categories_query);

   $rows = 0;
   while ($categories = tep_db_fetch_array($categories_query)) {
     $rows++;
     $cPath_new = tep_get_path($categories['categories_id']);
     $width = (int)(100 / MAX_DISPLAY_CATEGORIES_PER_ROW) . '%';
     echo '                <td align="center" class="smallText" width="' . $width . '" valign="top"><a href="' . tep_href_link(FILENAME_DEFAULT, $cP
ath_new) . '">' . tep_image(DIR_WS_IMAGES . $categories['categories_image'], $categories['categories_name'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMA
GE_HEIGHT) . '<br>' . $categories['categories_name'] . '</a></td>' . "\n";
     if ((($rows / MAX_DISPLAY_CATEGORIES_PER_ROW) == floor($rows / MAX_DISPLAY_CATEGORIES_PER_ROW)) && ($rows != $number_of_categories)) {
       echo '              </tr>' . "\n";
       echo '              <tr>' . "\n";
     }
   }

// needed for the new products module shown below
   $new_products_category_id = $current_category_id;
?>
             </tr>
           </table></td>
         </tr>
         <tr>
           <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
         </tr>
         <tr>
           <td><?php include(DIR_WS_MODULES . FILENAME_NEW_PRODUCTS); ?></td>
         </tr>
       </table></td>
     </tr>
   </table></td>
<?php
 } elseif ($category_depth == 'products' || isset($HTTP_GET_VARS['manufacturers_id'])) {

It all looks right to me, what am i missing?

Scott Wigle

 

"The first rule of intelligent tinkering is to save all the pieces"

Aldo Leopold

Posted

that's lines 58 - 159 btw, thanks

Scott Wigle

 

"The first rule of intelligent tinkering is to save all the pieces"

Aldo Leopold

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...