Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Streamlining featured.php contribution


betty

Recommended Posts

Hiya!

 

I hope someone can help me! I'm just having a little trouble with my featured products not quite lining up by a couple of pixels. See what I mean here - http://www.misterwolf.co.uk

 

I think it's because they're sitting inside too many tables and I'd like to remove some of these but I'm not quite sure how to do it. Basically this is my featured.php file at the moment:

 

<?php
/*
 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2002 osCommerce

 Released under the GNU General Public License
 
 Featured Products V1.1
 Displays a list of featured products, selected from admin
 For use as an Infobox instead of the "New Products" Infobox  
*/
?>
<!-- featured_products //-->
<?php
if(FEATURED_PRODUCTS_DISPLAY == 'true')
{
 $featured_products_category_id = $new_products_category_id;
 $cat_name_query = tep_db_query("select categories_name from categories_description where categories_id = '" . $featured_products_category_id . "' limit 1");
 $cat_name_fetch = tep_db_fetch_array($cat_name_query);
 $cat_name = $cat_name_fetch['categories_name'];

 if ( (!isset($featured_products_category_id)) || ($featured_products_category_id == '0') ) {
 

 list($usec, $sec) = explode(' ', microtime());
 srand( (float) $sec + ((float) $usec * 100000) );
 $mtm= rand();

$featured_products_query = tep_db_query("select p.products_id, p.products_image, pd.products_info, p.products_mediumimage, p.products_largeimage, p.products_labelimage, p.products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_FEATURED . " f on p.products_id = f.products_id left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id where p.products_status = '1' and f.status = '1' order by p.products_id DESC limit " . MAX_DISPLAY_FEATURED_PRODUCTS);
 } 
 
 /*else {                                                  
   $info_box_contents[] = array('align' => '', 'text' => '');
   $featured_products_query = tep_db_query("select distinct p.products_id, p.products_image, pd.products_info, ai.medium_images, p.products_tax_class_id, s.status as specstat, s.specials_new_products_price, p.products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id left join " . TABLE_ADDITIONAL_IMAGES . " ai on p.products_id = ai.products_id left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c left join " . TABLE_FEATURED . " f on p.products_id = f.products_id where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . $featured_products_category_id . "' and p.products_status = '1' and f.status = '1' order by p.products_id DESC limit " . MAX_DISPLAY_FEATURED_PRODUCTS);
 }*/

 $row = 0;
 $col = 0; 
 $num = 0;
 while ($featured_products = tep_db_fetch_array($featured_products_query)) {
   $num ++; if ($num == 1) 
   $featured_products['products_name'] = tep_get_products_name($featured_products['products_id']);
$featured_products['products_info'] = tep_get_products_info($featured_products['products_id']); 
$featured_products['products_image'] = tep_get_products_image($featured_products['products_id']); 
   $featured_products['products_labelimage'] = tep_get_products_labelimage($featured_products['products_id']); 
$featured_products['products_price'] = tep_get_products_price($featured_products['products_id']); 

/*if($featured_products['specstat']) {
     $info_box_contents[$row][$col] = array('align' => 'center',
                                          'params' => 'class="smallText" width="33%" valign="top"',
                                          'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $featured_products['products_image'], $featured_products['products_name']) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products['products_id']) . '">' . $featured_products['products_name'] . '</a><br><s>' . $currencies->display_price($featured_products['products_price'], tep_get_tax_rate($featured_products['products_tax_class_id'])) . '</s><br><span class="productSpecialPrice">' . 
                                          $currencies->display_price($featured_products['specials_new_products_price'], tep_get_tax_rate($featured_products['products_tax_class_id'])) . '</span>');
   
   } 

else*/

 {
     $info_box_contents[$row][$col] = array('align' => '',
                                          'params' => 'class="basic" valign="top"',
                                          'text' => '<table width="147" cellpadding="0" cellspacing="0" border="0">
   <tr>
   <td width="137" align="right" height="30" valign="top">' . 
   tep_image(DIR_WS_IMAGES . $featured_products['products_labelimage']) . '</td>
   <td bgcolor="FFFFFF" width="10" rowspan="4"> </td>
   </tr>

   <tr>
   <td width="137" align="center">
   <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $featured_products['products_image'], $featured_products['products_name']) . '</a>
   </td>
   </tr>

               <tr>
   <td width="137" align="center" class="basicbold" height="28">
   <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products['products_id']) . '">' . $featured_products['products_name'] . '</a></td>
   </tr>
   
   <tr>
   <td width="137" align="center" class="basic" height="20" valign="top">
   Mister Wolf price ' . $currencies->display_price($featured_products['products_price'], tep_get_tax_rate($featured_products['products_tax_class_id'])) . '</td>
   </tr>

   </table>');
   }    
   $col ++;
   if ($col > 3) {
     $col = 0;
     $row ++;
   }
 }
 if($num) {
     
     new contentBox($info_box_contents);
 }
}
?>
<!-- featured_products_eof //-->

 

 

I've checked and double checked all the td widths etc and they all add up, and it's not a problem with any of the styles. Would just like to try and remove the excess tables surrounding the featured products and see if this helps but not sure how to do it.

 

At the moment, as you can see in View/Source I've got this...

 

 

<!-- featured_products //-->
<table border="0" width="100%" cellspacing="0" cellpadding="0" class="infoBox">
 <tr>
   <td>

<table border="0" width="100%" cellspacing="0" cellpadding="0" class="infoBoxContents">
 <tr>
   <td class="basic" valign="top">

<table width="147" cellpadding="0" cellspacing="0" border="0">

etc etc...

 

The first 2 tables are completely unnecessary but I don't know how to modify featured.php to remove them.

 

Sorry such a long-winded question... it's just been bugging me all day! Any ideas would be greatly appreciated!

 

Betty

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...