Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

INDEX.PHP EXPLAINED for the Newbies


sonny

Recommended Posts

HERE WE GO..

 

Through my customizations od OSCOMMERCE I really got a hold on the design layout of OSCOMMERCE.....

 

Here a solid explination <!-- look for the comment tags ---> they are well detailed in ripping apart /catalog/index.php :wink:

 

<?php

/*

 $Id: index.php,v 1.1 2003/06/11 17:37:59 hpdl Exp $



 osCommerce, Open Source E-Commerce Solutions

 http://www.oscommerce.com



 Copyright (c) 2003 osCommerce



 Released under the GNU General Public License

*/



 require('os_untouched/oscommerce-2.2ms2/catalog/includes/application_top.php');



// the following cPath references come from application_top.php

 $category_depth = 'top';

 if (isset($cPath) && tep_not_null($cPath)) {

   $categories_products_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id = '" . (int)$current_category_id . "'");

   $cateqories_products = tep_db_fetch_array($categories_products_query);

   if ($cateqories_products['total'] > 0) {

     $category_depth = 'products'; // display products

   } else {

     $category_parent_query = tep_db_query("select count(*) as total from " . TABLE_CATEGORIES . " where parent_id = '" . (int)$current_category_id . "'");

     $category_parent = tep_db_fetch_array($category_parent_query);

     if ($category_parent['total'] > 0) {

       $category_depth = 'nested'; // navigate through the categories

     } else {

       $category_depth = 'products'; // category has no products, but display the 'no products' message

     }

   }

 }



 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_DEFAULT);

?>

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

<html <?php echo HTML_PARAMS; ?>>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> 

<title><?php echo TITLE; ?></title>

<base href="<?php echo (($request_type == 'os_untouched/oscommerce-2.2ms2/catalog/SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">

<link rel="stylesheet" type="text/css" href="os_untouched/oscommerce-2.2ms2/catalog/stylesheet.css">



<!--- PUT DEFAULT LOCATION OF HEADER HERE BEFORE THE CLOSING </head> TAG makes for GOOD HTML PRACTICE--->



<!-- BEGIN HEADER-------------------------------------------------->



<!-- header //-->

<?php require(DIR_WS_INCLUDES . 'header.php'); ?>

<!-- header_eof //-->



<!-- END BEGIN HEADER-------------------------------------------------->





</head>

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">



<!-- <center> --- // you can add a center here to center the **MAIN** TABLE  -->





<!--- MOVED DEFAULT LOCATION OF HEADER FROM HERE --->





<!-- body //-->





<!---- THIS CONTROLS **MAIN** BODY TABLE example width="646" to change width ---->



<table border="0" width="100%" cellspacing="3" cellpadding="3">



<!---- END CONTROLS **MAIN** BODY TABLE------------------------------->





<!--FIRST TABLE ROW OF **MAIN** TABLE in INDEX.PHP--->



 <tr>



<!-- END FIRST TABLE ROW OF **MAIN** TABLE in INDEX.PHP--->  







<!----- THIS CONTROLS DISPLAY OF COLUMN_LEFT.PHP -----> 

   <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">



<!-- left_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>

<!-- left_navigation_eof //-->



   </table></td>



<!----- END CONTROLS DISPLAY OF COLUMN_LEFT.PHP ----->	





<!-- body_text //-->







<?php

 if ($category_depth == 'nested') {

   $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);

?>



<!--- THIS CONTROLS CATEGORY DISPLAY DATA ----->



   <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">

     <tr>

       <td><table border="0" width="100%" cellspacing="0" cellpadding="0">

         <tr>

   

   <!--- THIS CONTROLS HEADING DATA example LETS SEE WHATS IN HERE --->

           <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>

    <!--- END CONTROLS HEADING DATA example LETS SEE WHATS IN HERE --->

	 

	 <!--- THIS CONTROLS HEADING IMAGE example Sign in book --->

           <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>

           <!--- END CONTROLS HEADING IMAGE example Sign in book --->

   



<!-- KINDA LEAVE THIS ALONE ------>



   </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="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.parent_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.language_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.language_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, $cPath_new) . '">' . tep_image(DIR_WS_IMAGES . $categories['categories_image'], $categories['categories_name'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_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'])) {

// create column list

   $define_list = array('PRODUCT_LIST_MODEL' => PRODUCT_LIST_MODEL,

                        'PRODUCT_LIST_NAME' => PRODUCT_LIST_NAME,

                        'PRODUCT_LIST_MANUFACTURER' => PRODUCT_LIST_MANUFACTURER,

                        'PRODUCT_LIST_PRICE' => PRODUCT_LIST_PRICE,

                        'PRODUCT_LIST_QUANTITY' => PRODUCT_LIST_QUANTITY,

                        'PRODUCT_LIST_WEIGHT' => PRODUCT_LIST_WEIGHT,

                        'PRODUCT_LIST_IMAGE' => PRODUCT_LIST_IMAGE,

                        'PRODUCT_LIST_BUY_NOW' => PRODUCT_LIST_BUY_NOW);



   asort($define_list);



   $column_list = array();

   reset($define_list);

   while (list($key, $value) = each($define_list)) {

     if ($value > 0) $column_list[] = $key;

   }



   $select_column_list = '';



   for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {

     switch ($column_list[$i]) {

       case 'PRODUCT_LIST_MODEL':

         $select_column_list .= 'p.products_model, ';

         break;

       case 'PRODUCT_LIST_NAME':

         $select_column_list .= 'pd.products_name, ';

         break;

       case 'PRODUCT_LIST_MANUFACTURER':

         $select_column_list .= 'm.manufacturers_name, ';

         break;

       case 'PRODUCT_LIST_QUANTITY':

         $select_column_list .= 'p.products_quantity, ';

         break;

       case 'PRODUCT_LIST_IMAGE':

         $select_column_list .= 'p.products_image, ';

         break;

       case 'PRODUCT_LIST_WEIGHT':

         $select_column_list .= 'p.products_weight, ';

         break;

     }

   }



// show the products of a specified manufacturer

   if (isset($HTTP_GET_VARS['manufacturers_id'])) {

     if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) {

// We are asked to show only a specific category

       $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "'";

     } else {

// We show them all

       $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'";

     }

   } else {

// show the products in a given categorie

     if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) {

// We are asked to show only specific catgeory

       $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";

     } else {

// We show them all

       $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";

     }

   }



   if ( (!isset($HTTP_GET_VARS['sort'])) || (!ereg('[1-8][ad]', $HTTP_GET_VARS['sort'])) || (substr($HTTP_GET_VARS['sort'], 0, 1) > sizeof($column_list)) ) {

     for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {

       if ($column_list[$i] == 'PRODUCT_LIST_NAME') {

         $HTTP_GET_VARS['sort'] = $i+1 . 'a';

         $listing_sql .= " order by pd.products_name";

         break;

       }

     }

   } else {

     $sort_col = substr($HTTP_GET_VARS['sort'], 0 , 1);

     $sort_order = substr($HTTP_GET_VARS['sort'], 1);

     $listing_sql .= ' order by ';

     switch ($column_list[$sort_col-1]) {

       case 'PRODUCT_LIST_MODEL':

         $listing_sql .= "p.products_model " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";

         break;

       case 'PRODUCT_LIST_NAME':

         $listing_sql .= "pd.products_name " . ($sort_order == 'd' ? 'desc' : '');

         break;

       case 'PRODUCT_LIST_MANUFACTURER':

         $listing_sql .= "m.manufacturers_name " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";

         break;

       case 'PRODUCT_LIST_QUANTITY':

         $listing_sql .= "p.products_quantity " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";

         break;

       case 'PRODUCT_LIST_IMAGE':

         $listing_sql .= "pd.products_name";

         break;

       case 'PRODUCT_LIST_WEIGHT':

         $listing_sql .= "p.products_weight " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";

         break;

       case 'PRODUCT_LIST_PRICE':

         $listing_sql .= "final_price " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";

         break;

     }

   }

?>

   <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">

     <tr>

       <td><table border="0" width="100%" cellspacing="0" cellpadding="0">

         <tr>

           <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>

<?php

// optional Product List Filter

   if (PRODUCT_LIST_FILTER > 0) {

     if (isset($HTTP_GET_VARS['manufacturers_id'])) {

       $filterlist_sql = "select distinct c.categories_id as id, cd.categories_name as name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where p.products_status = '1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and p2c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' order by cd.categories_name";

     } else {

       $filterlist_sql= "select distinct m.manufacturers_id as id, m.manufacturers_name as name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_MANUFACTURERS . " m where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and p.products_id = p2c.products_id and p2c.categories_id = '" . (int)$current_category_id . "' order by m.manufacturers_name";

     }

     $filterlist_query = tep_db_query($filterlist_sql);

     if (tep_db_num_rows($filterlist_query) > 1) {

       echo '            <td align="center" class="main">' . tep_draw_form('filter', FILENAME_DEFAULT, 'get') . TEXT_SHOW . ' ';

       if (isset($HTTP_GET_VARS['manufacturers_id'])) {

         echo tep_draw_hidden_field('manufacturers_id', $HTTP_GET_VARS['manufacturers_id']);

         $options = array(array('id' => '', 'text' => TEXT_ALL_CATEGORIES));

       } else {

         echo tep_draw_hidden_field('cPath', $cPath);

         $options = array(array('id' => '', 'text' => TEXT_ALL_MANUFACTURERS));

       }

       echo tep_draw_hidden_field('sort', $HTTP_GET_VARS['sort']);

       while ($filterlist = tep_db_fetch_array($filterlist_query)) {

         $options[] = array('id' => $filterlist['id'], 'text' => $filterlist['name']);

       }

       echo tep_draw_pull_down_menu('filter_id', $options, (isset($HTTP_GET_VARS['filter_id']) ? $HTTP_GET_VARS['filter_id'] : ''), 'onchange="this.form.submit()"');

       echo '</form></td>' . "n";

     }

   }



// Get the right image for the top-right

   $image = DIR_WS_IMAGES . 'table_background_list.gif';

   if (isset($HTTP_GET_VARS['manufacturers_id'])) {

     $image = tep_db_query("select manufacturers_image from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'");

     $image = tep_db_fetch_array($image);

     $image = $image['manufacturers_image'];

   } elseif ($current_category_id) {

     $image = tep_db_query("select categories_image from " . TABLE_CATEGORIES . " where categories_id = '" . (int)$current_category_id . "'");

     $image = tep_db_fetch_array($image);

     $image = $image['categories_image'];

   }

?>

           <td align="right"><?php echo tep_image(DIR_WS_IMAGES . $image, 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><?php include(DIR_WS_MODULES . FILENAME_PRODUCT_LISTING); ?></td>

     </tr>

   </table></td>



 <!-- END KINDA LEAVE THIS ALONE ------>

 

 



<?php

 } else { // default page  

?>

   <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">

     <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>

 

   <!---- THIS DISPALYS THE  Welcome Guest! TEXT ----> 

          

     <td class="main"><?php echo TEXT_MAIN; ?></td>

    

    <!---- END DISPALYS THE  Welcome Guest! TEXT ----> 

	 

         </tr>

         <tr>

           <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

         </tr>

         <tr>

  

   <!---- THIS SHOWS THE NEW MONTHY PRODUCTS BOX IN THE INDEX.PHP--->

         

     <td><?php include(DIR_WS_MODULES . FILENAME_NEW_PRODUCTS); ?></td>

   

   <!---- END THIS SHOWS THE NEW MONTHY PRODUCTS BOX IN THE INDEX.PHP--->

         

   </tr>

<?php

   include(DIR_WS_MODULES . FILENAME_UPCOMING_PRODUCTS);

?>

       </table></td>

     </tr>

   </table></td>

<?php

 }

?>



<!--------------------------------------------------------------------------------------------------->



<!--THERE IS A LAYOUT BUG THAT NEEDS TO BE FIXED::: The bug displays the footer in the right column, 

so if you make any modifications to the width of OSCOMMERCE sometimes the footer gets stuck

in the column_right.php <table>, THE FIX IS SHOWN BELOW --->



<!--------------------------------------------------------------------------------------------------->







<!--- THIS CONTROLS DISPLAY OF COLUMN_RIGHT.PHP -------------------------->



<!-- body_text_eof //-->

 <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">



<!-- right_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>

<!-- right_navigation_eof //-->



   </table></td>

 </tr>

</table>

<!-- body_eof //-->



<!--- END CONTROLS DISPLAY OF COLUMN_RIGHT.PHP ----------------------------->





<!----- START LAYOUT BUG FIX OSC MS2 ---->





</table>   <!-- MUST ADD </TABLE> to close COLUMN_RIGHT.PHP TABLE --->







<tr><!-- ADD A <tr> as the LAST TABLE ROW IN **MAIN** TABLE---->



<td> <!-- ADD A <td> TO STICK THE FOOTER IN -->





<!-- BEGIN FOOTER CONTROL ---->





<!-- footer //-->

<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>

<!-- footer_eof //-->



<!-- END BEGIN FOOTER CONTROL ---->





<!--- CLOSE TAGS --->



</td>



</tr>



<!--- END CLOSE TAGS--->



</table> <!--- CLOSE **MAIN** TABLE --->



<!-- END APPLICATION-->



<br>

<!-- </center>  if you put a center under the body, you can close it here --->

</body>

</html>

<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>



<!--- NOTE EVERY FILE UNDER /catalog/ IS STRUCTURED SIMULAR TO THE INDEX.PHP, GOOD LUCK --->

 

Well I hope this helps someone :D

Link to comment
Share on other sites

Thanks,

 

explanations like this really help to learn much faster how osC works! Most cracks probably can not image how difficult the first steps in custumizing osC are anymore.

 

<!--- NOTE EVERY FILE UNDER /catalog/ IS STRUCTURED SIMULAR TO THE INDEX.PHP, GOOD LUCK --->

So this probably means that several other files (which?) have to be edited the same way to alter the looks of the whole site?

(I would not use the old center tag myself, but use CSS to do it but that is probably not the issue here).

 

Anyway, I think it might be very usefull to have a separate forum, about how to configure/customize osC for newbies only. Filled with hints and tips like sonny did in this thread!

Link to comment
Share on other sites

Anyway, I think it might be very usefull to have a separate forum, about how to configure/customize osC for newbies only. Filled with hints and tips like sonny did in this thread!

 

Naw, just need to teach hacks how to post like this. It's the comments that make this post very informative for newbies.

 

It would be good to see all files in osCommerce explained. At least to a degree that explains where they are and what they do on a basic level.

I think wiki is headed in this direction.

 

Emmett

Link to comment
Share on other sites

I glad to see this has come in use to many people :D

 

 

So this probably means that several other files (which?) have to be edited the same way to alter the looks of the whole site?  

(I would not use the old center tag myself, but use CSS to do it but that is probably not the issue here).

 

 

As far as which files... practicly everyone under /catalog/*.php,

 

Once you understand how the index is structured.. you will understand how not to mess with the meat of the code and just mess with the cosmetics of each file.

 

As far as the center, you could use CSS, but to make sure that I get the results I want without the linked reference file, I use the good old <center>tag :wink:

 

If anyone has any concerns, feel free to email me at

[email protected]

 

Sonny

Link to comment
Share on other sites

<!--THERE IS A LAYOUT BUG THAT NEEDS TO BE FIXED::: The bug displays the footer in the right column, 

so if you make any modifications to the width of OSCOMMERCE sometimes the footer gets stuck

in the column_right.php <table>, THE FIX IS SHOWN BELOW --->

This is caused by a bug in PHP. Discussed here. In a stock MS2 index.php, the closing table tag for column_right is on line 329. It's the next line after <!-- right_navigation_eof //-->. What you call the main table gets closed on line 331. footer.php has its own table below this.

 

Also, tep_customer_greeting displays the "Welcome Guest!" text. The TEXT_MAIN line you point out starts with "This is a default setup".

 

Cheers,

Matt

Link to comment
Share on other sites

As far as the center, you could use CSS, but to make sure that I get the results I want without the linked reference file, I use the good old <center>tag

"The linked reference file" (=>stylesheet.css) is already used bij osC. Without it, your site probably wont look the way you want anyway. An advantage of CSS is, you only have to edit a few lines in the style sheet to make changes to the whole site!. With the "good" old tags you have to edit more code in more files for every change in the layout you want to make.

Link to comment
Share on other sites

Someone want to help me out. I still cant figure out that php bug. Im new to php, switching over from asp. Any chance someone could "hold my hand" and walk me through it a little more. Im not quite understanding what is being discussed.

Link to comment
Share on other sites

Matt already linked to

This is a bug in PHP that shows up under certain circumstances.

 

Details can be found here:

 

http://bugs.php.net/bug.php?id=19553

http://bugs.php.net/bug.php?id=17236

 

Here are possible solutions/workarounds:

 

- Change the .htaccess file in the catalog directory. Remove the comment in front of the line reading

# php_value session.use_trans_sid 0

 

- Update PHP to 4.3.x - the problem is solved here.

 

- Force cookie usage

 

HTH

 

Jan Wildeboer

What more do you need to know? :?

Don't ask me, this is all I know, and it's even more than I wanted to know, about this PHP bug. :)

Link to comment
Share on other sites

Ok so I just checked and it doesnt look like my new version of php got installed. any idea on why this might be. Could someone help me out with the configure command so that I might actually get it installed correctly?

Link to comment
Share on other sites

  • 2 weeks later...

thks in adv, buddy :rolleyes:

i love LAMP tools and other open source software initiatives, I would liket to get involved in and hack a website together.

 

y'al know da deal, here, GPL world wide, so keep it real and wide open, for us ordianry mortals.

Link to comment
Share on other sites

Hey, this is sonny again... Im my previous post index explained for the newbies.. be carefull i made a small require error at the top of my code, I just noticed.

 

change ::::

 

require('os_untouched/oscommerce-2.2ms2/catalog/includes/application_top.php');

 

to :::

 

require('includes/application_top.php');

 

:P sorry bout that he he

 

I did this for my install.. not ur's but the rest is ok B)

 

here is the fixed for your convienence

 

<?php

/*

$Id: index.php,v 1.1 2003/06/11 17:37:59 hpdl Exp $



osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com



Copyright (c) 2003 osCommerce



Released under the GNU General Public License

*/



require('includes/application_top.php');



// the following cPath references come from application_top.php

$category_depth = 'top';

if (isset($cPath) && tep_not_null($cPath)) {

  $categories_products_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id = '" . (int)$current_category_id . "'");

  $cateqories_products = tep_db_fetch_array($categories_products_query);

  if ($cateqories_products['total'] > 0) {

    $category_depth = 'products'; // display products

  } else {

    $category_parent_query = tep_db_query("select count(*) as total from " . TABLE_CATEGORIES . " where parent_id = '" . (int)$current_category_id . "'");

    $category_parent = tep_db_fetch_array($category_parent_query);

    if ($category_parent['total'] > 0) {

      $category_depth = 'nested'; // navigate through the categories

    } else {

      $category_depth = 'products'; // category has no products, but display the 'no products' message

    }

  }

}



require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_DEFAULT);

?>

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

<html <?php echo HTML_PARAMS; ?>>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> 

<title><?php echo TITLE; ?></title>

<base href="<?php echo (($request_type == 'os_untouched/oscommerce-2.2ms2/catalog/SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">

<link rel="stylesheet" type="text/css" href="os_untouched/oscommerce-2.2ms2/catalog/stylesheet.css">



<!--- PUT DEFAULT LOCATION OF HEADER HERE BEFORE THE CLOSING </head> TAG makes for GOOD HTML PRACTICE--->



<!-- BEGIN HEADER-------------------------------------------------->



<!-- header //-->

<?php require(DIR_WS_INCLUDES . 'header.php'); ?>

<!-- header_eof //-->



<!-- END BEGIN HEADER-------------------------------------------------->





</head>

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">



<!-- <center> --- // you can add a center here to center the **MAIN** TABLE  -->





<!--- MOVED DEFAULT LOCATION OF HEADER FROM HERE --->





<!-- body //-->





<!---- THIS CONTROLS **MAIN** BODY TABLE example width="646" to change width ---->



<table border="0" width="100%" cellspacing="3" cellpadding="3">



<!---- END CONTROLS **MAIN** BODY TABLE------------------------------->





<!--FIRST TABLE ROW OF **MAIN** TABLE in INDEX.PHP--->



<tr>



<!-- END FIRST TABLE ROW OF **MAIN** TABLE in INDEX.PHP--->  







<!----- THIS CONTROLS DISPLAY OF COLUMN_LEFT.PHP -----> 

  <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">



<!-- left_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>

<!-- left_navigation_eof //-->



  </table></td>



<!----- END CONTROLS DISPLAY OF COLUMN_LEFT.PHP -----> 





<!-- body_text //-->







<?php

if ($category_depth == 'nested') {

  $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);

?>



<!--- THIS CONTROLS CATEGORY DISPLAY DATA ----->



  <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">

    <tr>

      <td><table border="0" width="100%" cellspacing="0" cellpadding="0">

        <tr>

  

  <!--- THIS CONTROLS HEADING DATA example LETS SEE WHATS IN HERE --->

          <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>

   <!--- END CONTROLS HEADING DATA example LETS SEE WHATS IN HERE --->

 

 <!--- THIS CONTROLS HEADING IMAGE example Sign in book --->

          <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>

          <!--- END CONTROLS HEADING IMAGE example Sign in book --->

  



<!-- KINDA LEAVE THIS ALONE ------>



  </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="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.parent_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.language_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.language_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, $cPath_new) . '">' . tep_image(DIR_WS_IMAGES . $categories['categories_image'], $categories['categories_name'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_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'])) {

// create column list

  $define_list = array('PRODUCT_LIST_MODEL' => PRODUCT_LIST_MODEL,

                       'PRODUCT_LIST_NAME' => PRODUCT_LIST_NAME,

                       'PRODUCT_LIST_MANUFACTURER' => PRODUCT_LIST_MANUFACTURER,

                       'PRODUCT_LIST_PRICE' => PRODUCT_LIST_PRICE,

                       'PRODUCT_LIST_QUANTITY' => PRODUCT_LIST_QUANTITY,

                       'PRODUCT_LIST_WEIGHT' => PRODUCT_LIST_WEIGHT,

                       'PRODUCT_LIST_IMAGE' => PRODUCT_LIST_IMAGE,

                       'PRODUCT_LIST_BUY_NOW' => PRODUCT_LIST_BUY_NOW);



  asort($define_list);



  $column_list = array();

  reset($define_list);

  while (list($key, $value) = each($define_list)) {

    if ($value > 0) $column_list[] = $key;

  }



  $select_column_list = '';



  for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {

    switch ($column_list[$i]) {

      case 'PRODUCT_LIST_MODEL':

        $select_column_list .= 'p.products_model, ';

        break;

      case 'PRODUCT_LIST_NAME':

        $select_column_list .= 'pd.products_name, ';

        break;

      case 'PRODUCT_LIST_MANUFACTURER':

        $select_column_list .= 'm.manufacturers_name, ';

        break;

      case 'PRODUCT_LIST_QUANTITY':

        $select_column_list .= 'p.products_quantity, ';

        break;

      case 'PRODUCT_LIST_IMAGE':

        $select_column_list .= 'p.products_image, ';

        break;

      case 'PRODUCT_LIST_WEIGHT':

        $select_column_list .= 'p.products_weight, ';

        break;

    }

  }



// show the products of a specified manufacturer

  if (isset($HTTP_GET_VARS['manufacturers_id'])) {

    if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) {

// We are asked to show only a specific category

      $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "'";

    } else {

// We show them all

      $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'";

    }

  } else {

// show the products in a given categorie

    if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) {

// We are asked to show only specific catgeory

      $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";

    } else {

// We show them all

      $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";

    }

  }



  if ( (!isset($HTTP_GET_VARS['sort'])) || (!ereg('[1-8][ad]', $HTTP_GET_VARS['sort'])) || (substr($HTTP_GET_VARS['sort'], 0, 1) > sizeof($column_list)) ) {

    for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {

      if ($column_list[$i] == 'PRODUCT_LIST_NAME') {

        $HTTP_GET_VARS['sort'] = $i+1 . 'a';

        $listing_sql .= " order by pd.products_name";

        break;

      }

    }

  } else {

    $sort_col = substr($HTTP_GET_VARS['sort'], 0 , 1);

    $sort_order = substr($HTTP_GET_VARS['sort'], 1);

    $listing_sql .= ' order by ';

    switch ($column_list[$sort_col-1]) {

      case 'PRODUCT_LIST_MODEL':

        $listing_sql .= "p.products_model " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";

        break;

      case 'PRODUCT_LIST_NAME':

        $listing_sql .= "pd.products_name " . ($sort_order == 'd' ? 'desc' : '');

        break;

      case 'PRODUCT_LIST_MANUFACTURER':

        $listing_sql .= "m.manufacturers_name " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";

        break;

      case 'PRODUCT_LIST_QUANTITY':

        $listing_sql .= "p.products_quantity " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";

        break;

      case 'PRODUCT_LIST_IMAGE':

        $listing_sql .= "pd.products_name";

        break;

      case 'PRODUCT_LIST_WEIGHT':

        $listing_sql .= "p.products_weight " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";

        break;

      case 'PRODUCT_LIST_PRICE':

        $listing_sql .= "final_price " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";

        break;

    }

  }

?>

  <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">

    <tr>

      <td><table border="0" width="100%" cellspacing="0" cellpadding="0">

        <tr>

          <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>

<?php

// optional Product List Filter

  if (PRODUCT_LIST_FILTER > 0) {

    if (isset($HTTP_GET_VARS['manufacturers_id'])) {

      $filterlist_sql = "select distinct c.categories_id as id, cd.categories_name as name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where p.products_status = '1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and p2c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' order by cd.categories_name";

    } else {

      $filterlist_sql= "select distinct m.manufacturers_id as id, m.manufacturers_name as name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_MANUFACTURERS . " m where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and p.products_id = p2c.products_id and p2c.categories_id = '" . (int)$current_category_id . "' order by m.manufacturers_name";

    }

    $filterlist_query = tep_db_query($filterlist_sql);

    if (tep_db_num_rows($filterlist_query) > 1) {

      echo '            <td align="center" class="main">' . tep_draw_form('filter', FILENAME_DEFAULT, 'get') . TEXT_SHOW . ' ';

      if (isset($HTTP_GET_VARS['manufacturers_id'])) {

        echo tep_draw_hidden_field('manufacturers_id', $HTTP_GET_VARS['manufacturers_id']);

        $options = array(array('id' => '', 'text' => TEXT_ALL_CATEGORIES));

      } else {

        echo tep_draw_hidden_field('cPath', $cPath);

        $options = array(array('id' => '', 'text' => TEXT_ALL_MANUFACTURERS));

      }

      echo tep_draw_hidden_field('sort', $HTTP_GET_VARS['sort']);

      while ($filterlist = tep_db_fetch_array($filterlist_query)) {

        $options[] = array('id' => $filterlist['id'], 'text' => $filterlist['name']);

      }

      echo tep_draw_pull_down_menu('filter_id', $options, (isset($HTTP_GET_VARS['filter_id']) ? $HTTP_GET_VARS['filter_id'] : ''), 'onchange="this.form.submit()"');

      echo '</form></td>' . "\n";

    }

  }



// Get the right image for the top-right

  $image = DIR_WS_IMAGES . 'table_background_list.gif';

  if (isset($HTTP_GET_VARS['manufacturers_id'])) {

    $image = tep_db_query("select manufacturers_image from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'");

    $image = tep_db_fetch_array($image);

    $image = $image['manufacturers_image'];

  } elseif ($current_category_id) {

    $image = tep_db_query("select categories_image from " . TABLE_CATEGORIES . " where categories_id = '" . (int)$current_category_id . "'");

    $image = tep_db_fetch_array($image);

    $image = $image['categories_image'];

  }

?>

          <td align="right"><?php echo tep_image(DIR_WS_IMAGES . $image, 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><?php include(DIR_WS_MODULES . FILENAME_PRODUCT_LISTING); ?></td>

    </tr>

  </table></td>



<!-- END KINDA LEAVE THIS ALONE ------>







<?php

} else { // default page  

?>

  <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">

    <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>



  <!---- THIS DISPALYS THE  Welcome Guest! TEXT ----> 

         

    <td class="main"><?php echo TEXT_MAIN; ?></td>

   

   <!---- END DISPALYS THE  Welcome Guest! TEXT ----> 

 

        </tr>

        <tr>

          <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

        </tr>

        <tr>

 

  <!---- THIS SHOWS THE NEW MONTHY PRODUCTS BOX IN THE INDEX.PHP--->

        

    <td><?php include(DIR_WS_MODULES . FILENAME_NEW_PRODUCTS); ?></td>

  

  <!---- END THIS SHOWS THE NEW MONTHY PRODUCTS BOX IN THE INDEX.PHP--->

        

  </tr>

<?php

  include(DIR_WS_MODULES . FILENAME_UPCOMING_PRODUCTS);

?>

      </table></td>

    </tr>

  </table></td>

<?php

}

?>



<!--------------------------------------------------------------------------------------------------->



<!--THERE IS A LAYOUT BUG THAT NEEDS TO BE FIXED::: The bug displays the footer in the right column, 

so if you make any modifications to the width of OSCOMMERCE sometimes the footer gets stuck

in the column_right.php <table>, THE FIX IS SHOWN BELOW --->



<!--------------------------------------------------------------------------------------------------->







<!--- THIS CONTROLS DISPLAY OF COLUMN_RIGHT.PHP -------------------------->



<!-- body_text_eof //-->

<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">



<!-- right_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>

<!-- right_navigation_eof //-->



  </table></td>

</tr>

</table>

<!-- body_eof //-->



<!--- END CONTROLS DISPLAY OF COLUMN_RIGHT.PHP ----------------------------->





<!----- START LAYOUT BUG FIX OSC MS2 ---->





</table>   <!-- MUST ADD </TABLE> to close COLUMN_RIGHT.PHP TABLE --->







<tr><!-- ADD A <tr> as the LAST TABLE ROW IN **MAIN** TABLE---->



<td> <!-- ADD A <td> TO STICK THE FOOTER IN -->





<!-- BEGIN FOOTER CONTROL ---->





<!-- footer //-->

<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>

<!-- footer_eof //-->



<!-- END BEGIN FOOTER CONTROL ---->





<!--- CLOSE TAGS --->



</td>



</tr>



<!--- END CLOSE TAGS--->



</table> <!--- CLOSE **MAIN** TABLE --->



<!-- END APPLICATION-->



<br>

<!-- </center>  if you put a center under the body, you can close it here --->

</body>

</html>

<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>



<!--- NOTE EVERY FILE UNDER /catalog/ IS STRUCTURED SIMULAR TO THE INDEX.PHP, GOOD LUCK --->

Link to comment
Share on other sites

Ok OK... Now after bugging out for a couple of minutes ... it seems that if you use the INDEX.PHP code in my previous -->2<-- posts on a FRESH new OSC install. You will get one of 2 errors.

 

1) Images are broken

2) Headers are being sent out twice....

 

Now i was like :huh: ????

 

well It seems that my lovly dreamweaver likes to include file:/// paths all by itself without letting me know :angry: but i managed to fix the dumb problem and now here is the fresh working INDEX.PHP explained for the newbies that you can confidently overwrite the default index.php... well make a back anyway ;)

 

but here we go

 

<?php
/*
 $Id: index.php,v 1.1 2003/06/11 17:37:59 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 require('includes/application_top.php');

// the following cPath references come from application_top.php
 $category_depth = 'top';
 if (isset($cPath) && tep_not_null($cPath)) {
   $categories_products_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id = '" . (int)$current_category_id . "'");
   $cateqories_products = tep_db_fetch_array($categories_products_query);
   if ($cateqories_products['total'] > 0) {
     $category_depth = 'products'; // display products
   } else {
     $category_parent_query = tep_db_query("select count(*) as total from " . TABLE_CATEGORIES . " where parent_id = '" . (int)$current_category_id . "'");
     $category_parent = tep_db_fetch_array($category_parent_query);
     if ($category_parent['total'] > 0) {
       $category_depth = 'nested'; // navigate through the categories
     } else {
       $category_depth = 'products'; // category has no products, but display the 'no products' message
     }
   }
 }

 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_DEFAULT);
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> 
<title><?php echo TITLE; ?></title>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">

<!--- PUT DEFAULT LOCATION OF HEADER HERE BEFORE THE CLOSING </head> TAG makes for GOOD HTML PRACTICE--->
<!-- BEGIN HEADER-------------------------------------------------->
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- END BEGIN HEADER-------------------------------------------------->
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<!-- <center> --- // you can add a center here to center the **MAIN** TABLE  -->
<!--- MOVED DEFAULT LOCATION OF HEADER FROM HERE --->
<!-- body //-->
<!---- THIS CONTROLS **MAIN** BODY TABLE example width="646" to change width ---->
<table border="0" width="100%" cellspacing="3" cellpadding="3">
<!---- END CONTROLS **MAIN** BODY TABLE------------------------------->
<!--FIRST TABLE ROW OF **MAIN** TABLE in INDEX.PHP--->
 <tr>
<!-- END FIRST TABLE ROW OF **MAIN** TABLE in INDEX.PHP--->  
<!----- THIS CONTROLS DISPLAY OF COLUMN_LEFT.PHP -----> 
   <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
   </table></td>
<!----- END CONTROLS DISPLAY OF COLUMN_LEFT.PHP -----> 
<!-- body_text //-->
<?php
 if ($category_depth == 'nested') {
   $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);
?>
<!--- THIS CONTROLS CATEGORY DISPLAY DATA ----->
   <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
  <!--- THIS CONTROLS HEADING DATA example LETS SEE WHATS IN HERE --->
           <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
   <!--- END CONTROLS HEADING DATA example LETS SEE WHATS IN HERE --->
 <!--- THIS CONTROLS HEADING IMAGE example Sign in book --->
           <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>
          <!--- END CONTROLS HEADING IMAGE example Sign in book --->
<!-- KINDA LEAVE THIS ALONE ------>
         </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="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.parent_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.language_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.language_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, $cPath_new) . '">' . tep_image(DIR_WS_IMAGES . $categories['categories_image'], $categories['categories_name'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_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'])) {
// create column list
   $define_list = array('PRODUCT_LIST_MODEL' => PRODUCT_LIST_MODEL,
                        'PRODUCT_LIST_NAME' => PRODUCT_LIST_NAME,
                        'PRODUCT_LIST_MANUFACTURER' => PRODUCT_LIST_MANUFACTURER,
                        'PRODUCT_LIST_PRICE' => PRODUCT_LIST_PRICE,
                        'PRODUCT_LIST_QUANTITY' => PRODUCT_LIST_QUANTITY,
                        'PRODUCT_LIST_WEIGHT' => PRODUCT_LIST_WEIGHT,
                        'PRODUCT_LIST_IMAGE' => PRODUCT_LIST_IMAGE,
                        'PRODUCT_LIST_BUY_NOW' => PRODUCT_LIST_BUY_NOW);

   asort($define_list);

   $column_list = array();
   reset($define_list);
   while (list($key, $value) = each($define_list)) {
     if ($value > 0) $column_list[] = $key;
   }

   $select_column_list = '';

   for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {
     switch ($column_list[$i]) {
       case 'PRODUCT_LIST_MODEL':
         $select_column_list .= 'p.products_model, ';
         break;
       case 'PRODUCT_LIST_NAME':
         $select_column_list .= 'pd.products_name, ';
         break;
       case 'PRODUCT_LIST_MANUFACTURER':
         $select_column_list .= 'm.manufacturers_name, ';
         break;
       case 'PRODUCT_LIST_QUANTITY':
         $select_column_list .= 'p.products_quantity, ';
         break;
       case 'PRODUCT_LIST_IMAGE':
         $select_column_list .= 'p.products_image, ';
         break;
       case 'PRODUCT_LIST_WEIGHT':
         $select_column_list .= 'p.products_weight, ';
         break;
     }
   }

// show the products of a specified manufacturer
   if (isset($HTTP_GET_VARS['manufacturers_id'])) {
     if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) {
// We are asked to show only a specific category
       $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "'";
     } else {
// We show them all
       $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'";
     }
   } else {
// show the products in a given categorie
     if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) {
// We are asked to show only specific catgeory
       $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";
     } else {
// We show them all
       $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";
     }
   }

   if ( (!isset($HTTP_GET_VARS['sort'])) || (!ereg('[1-8][ad]', $HTTP_GET_VARS['sort'])) || (substr($HTTP_GET_VARS['sort'], 0, 1) > sizeof($column_list)) ) {
     for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {
       if ($column_list[$i] == 'PRODUCT_LIST_NAME') {
         $HTTP_GET_VARS['sort'] = $i+1 . 'a';
         $listing_sql .= " order by pd.products_name";
         break;
       }
     }
   } else {
     $sort_col = substr($HTTP_GET_VARS['sort'], 0 , 1);
     $sort_order = substr($HTTP_GET_VARS['sort'], 1);
     $listing_sql .= ' order by ';
     switch ($column_list[$sort_col-1]) {
       case 'PRODUCT_LIST_MODEL':
         $listing_sql .= "p.products_model " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
         break;
       case 'PRODUCT_LIST_NAME':
         $listing_sql .= "pd.products_name " . ($sort_order == 'd' ? 'desc' : '');
         break;
       case 'PRODUCT_LIST_MANUFACTURER':
         $listing_sql .= "m.manufacturers_name " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
         break;
       case 'PRODUCT_LIST_QUANTITY':
         $listing_sql .= "p.products_quantity " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
         break;
       case 'PRODUCT_LIST_IMAGE':
         $listing_sql .= "pd.products_name";
         break;
       case 'PRODUCT_LIST_WEIGHT':
         $listing_sql .= "p.products_weight " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
         break;
       case 'PRODUCT_LIST_PRICE':
         $listing_sql .= "final_price " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
         break;
     }
   }
?>
   <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
           <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
<?php
// optional Product List Filter
   if (PRODUCT_LIST_FILTER > 0) {
     if (isset($HTTP_GET_VARS['manufacturers_id'])) {
       $filterlist_sql = "select distinct c.categories_id as id, cd.categories_name as name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where p.products_status = '1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and p2c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' order by cd.categories_name";
     } else {
       $filterlist_sql= "select distinct m.manufacturers_id as id, m.manufacturers_name as name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_MANUFACTURERS . " m where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and p.products_id = p2c.products_id and p2c.categories_id = '" . (int)$current_category_id . "' order by m.manufacturers_name";
     }
     $filterlist_query = tep_db_query($filterlist_sql);
     if (tep_db_num_rows($filterlist_query) > 1) {
       echo '            <td align="center" class="main">' . tep_draw_form('filter', FILENAME_DEFAULT, 'get') . TEXT_SHOW . ' ';
       if (isset($HTTP_GET_VARS['manufacturers_id'])) {
         echo tep_draw_hidden_field('manufacturers_id', $HTTP_GET_VARS['manufacturers_id']);
         $options = array(array('id' => '', 'text' => TEXT_ALL_CATEGORIES));
       } else {
         echo tep_draw_hidden_field('cPath', $cPath);
         $options = array(array('id' => '', 'text' => TEXT_ALL_MANUFACTURERS));
       }
       echo tep_draw_hidden_field('sort', $HTTP_GET_VARS['sort']);
       while ($filterlist = tep_db_fetch_array($filterlist_query)) {
         $options[] = array('id' => $filterlist['id'], 'text' => $filterlist['name']);
       }
       echo tep_draw_pull_down_menu('filter_id', $options, (isset($HTTP_GET_VARS['filter_id']) ? $HTTP_GET_VARS['filter_id'] : ''), 'onchange="this.form.submit()"');
       echo '</form></td>' . "\n";
     }
   }

// Get the right image for the top-right
   $image = DIR_WS_IMAGES . 'table_background_list.gif';
   if (isset($HTTP_GET_VARS['manufacturers_id'])) {
     $image = tep_db_query("select manufacturers_image from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'");
     $image = tep_db_fetch_array($image);
     $image = $image['manufacturers_image'];
   } elseif ($current_category_id) {
     $image = tep_db_query("select categories_image from " . TABLE_CATEGORIES . " where categories_id = '" . (int)$current_category_id . "'");
     $image = tep_db_fetch_array($image);
     $image = $image['categories_image'];
   }
?>
           <td align="right"><?php echo tep_image(DIR_WS_IMAGES . $image, 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><?php include(DIR_WS_MODULES . FILENAME_PRODUCT_LISTING); ?></td>
     </tr>
   </table></td>
<!-- END KINDA LEAVE THIS ALONE ------>
<?php
 } else { // default page
?>
   <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
     <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>
  <!---- THIS DISPALYS THE  Welcome Guest! TEXT ----> 
           <td class="main"><?php echo TEXT_MAIN; ?></td>
   <!---- END DISPALYS THE  Welcome Guest! TEXT ----> 
         </tr>
         <tr>
           <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
         </tr>
         <tr>
  <!---- THIS SHOWS THE NEW MONTHY PRODUCTS BOX IN THE INDEX.PHP--->
           <td><?php include(DIR_WS_MODULES . FILENAME_NEW_PRODUCTS); ?></td>
  <!---- END THIS SHOWS THE NEW MONTHY PRODUCTS BOX IN THE INDEX.PHP--->
         </tr>
<?php
   include(DIR_WS_MODULES . FILENAME_UPCOMING_PRODUCTS);
?>
       </table></td>
     </tr>
   </table></td>
<?php
 }
?>
<!--------------------------------------------------------------------------------------------------->
<!--THERE IS A LAYOUT BUG THAT NEEDS TO BE FIXED::: The bug displays the footer in the right column, 
so if you make any modifications to the width of OSCOMMERCE sometimes the footer gets stuck
in the column_right.php <table>, THE FIX IS SHOWN BELOW --->
<!--------------------------------------------------------------------------------------------------->
<!--- THIS CONTROLS DISPLAY OF COLUMN_RIGHT.PHP -------------------------->
<!-- body_text_eof //-->
   <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- right_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
<!-- right_navigation_eof //-->
   </table></td>
 </tr>
</table>
<!-- body_eof //-->

<!--- END CONTROLS DISPLAY OF COLUMN_RIGHT.PHP ----------------------------->
<!----- START LAYOUT BUG FIX OSC MS2 ---->
</table>   <!-- MUST ADD </TABLE> to close COLUMN_RIGHT.PHP TABLE --->
<tr><!-- ADD A <tr> as the LAST TABLE ROW IN **MAIN** TABLE---->
<td> <!-- ADD A <td> TO STICK THE FOOTER IN -->
<!-- BEGIN FOOTER CONTROL ---->
<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<!-- END BEGIN FOOTER CONTROL ---->
<!--- CLOSE TAGS --->
</td>
</tr>
<!--- END CLOSE TAGS--->
</table> <!--- CLOSE **MAIN** TABLE --->
<br>
<!-- </center>  if you put a center under the body, you can close it here --->
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
<!--- NOTE EVERY FILE UNDER /catalog/ IS STRUCTURED SIMULAR TO THE INDEX.PHP, GOOD LUCK --->

 

Use this and disreguard my previous 2 posts with the index code B)

Link to comment
Share on other sites

Ok so I just checked and it doesnt look like my new version of php got installed.  any idea on why this might be.  Could someone help me out with the configure command so that I might actually get it installed correctly?
Configure is just the first step. Did you do make and make install (as root)? Did you install it the same place as it was previously? Try a ./configure --help to get better instructions as to changing the install paths. In particular, --prefix probably needs to be customized for your system.

 

Or you could try changing session.use_trans_sid in the php.ini or httpd.conf files (or with ini_set in something like application_top.php). Your system might not be using .htaccess files.

 

Hth,

Matt

Link to comment
Share on other sites

ok... I am like the newb of all newb's. I was going along fine until i realized that the index.php code did not look like the ones posted, but the default.php did. So, my question is HUH?? i'm confused.... well like i said newbie. So, I was getting along fine by tweaking the default page untill i came to the last posting by iiinetworks... it's like reading scandanvian when you just learned english. ok, ok... maybe i should pick up a php how-to book, but i just learned html and pretty much basic dreamweaver stuff, a little bit of templates, css, and xhtml. So, can i incorporate dramweaver with php. I have noticed that it forms (php) as tables in the design portion of dreamweaver. Can i manipulated in this way? Any and all help is greatly appreciated. Thank you all in advance -

 

BEN :unsure:

Link to comment
Share on other sites

Between MS1 and MS2, they changed the default page from default.php to index.php. If you have an older copy of the software, then what is called index.php here would be called default.php in your copy.

 

If you aren't experiencing the PHP bug under discussion, you can ignore my last post, which has nothing to do with the main thrust of this thread. Instead, it is an answer to a relatively technical question about installing PHP, which 99% of those here won't need. In fact, if you don't manage your own server, then you won't have to worry about it at all (except maybe to tell your sysadmin that you hear that PHP 4.2 has an issue and should be replaced).

 

Hth,

Matt

Link to comment
Share on other sites

Thankyou iiinetworks. That helped alot in clearing up my confusion. Is there any thread that you could link me to that covers any other questions that i had in regards to dreamweaver and php?

Link to comment
Share on other sites

Thankyou iiinetworks. That helped alot in clearing up my confusion. Is there any thread that you could link me to that covers any other questions that i had in regards to dreamweaver and php?

Well, since most of the pages are dynamically generated, and the php is not seperated from the html, there will not be a whole lot you'll be able to do in dreamweaver, in regards to changing the layout, or style of the website.

 

Dreamweaver cannot write the php for you from the html you give it (or have generated for you).

 

Unfortunatly (or fortunatly is you like programming), you will need to learn php if you with to change the design on your own.

-------------------------------------------------------------------------------------------------------------------------

NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit.

If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help.

Link to comment
Share on other sites

ok... thanks for the info. I have looked through the many past postings between dreamweaver and oscommerce. MANY MANY postings. what would be a good php editor? I'm looking to use css, though i have seen postings that say html-kit is good (huh?)... i know that it has a php/mysql plug-in but does this help? php-editor? and how do i edit the text on the shopping cart? maybe i should use something else. :(

Link to comment
Share on other sites

  • 3 weeks later...
Thankyou iiinetworks. That helped alot in clearing up my confusion. Is there any thread that you could link me to that covers any other questions that i had in regards to dreamweaver and php?

Well, since most of the pages are dynamically generated, and the php is not seperated from the html, there will not be a whole lot you'll be able to do in dreamweaver, in regards to changing the layout, or style of the website.

 

Dreamweaver cannot write the php for you from the html you give it (or have generated for you).

 

Unfortunatly (or fortunatly is you like programming), you will need to learn php if you with to change the design on your own.

If you want to be able to modify the site look and feel without having to modify all the PHP files, try out the Simple Template System (STS), which lets you create a single HTML file for all your pages and set up your look and feel in there.

 

You only need to modify or replace a few files in /catalog/includes/ and then make the site look like however you want in /catalog/includes/sts_template.html.

 

You can find links to it in my signature, below.

 

It will make you love changing the look of OSC (finally!)

 

Cheers!

 

- Brian

Simple Template System (STS)

Layout your site with 1 (or more) HTML file!

Download STS: http://www.oscommerce.com/community/contributions,1524

Support: http://www.oscommerce.com/forums/index.php?showtopic=58541

Link to comment
Share on other sites

  • 5 weeks later...

Archived

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

×
×
  • Create New...