Guest Posted July 3, 2004 Posted July 3, 2004 I have just noticed a little problem which I am stuck with, is anyone able to see the problem, here is a link to get familiar: http://www.eurorep.net/retail this is work in progress and I have almost sorted all the scripts I need, but I have just noticed this in the new products for month on front I have name of product price pic and description also buy button in a box k, this is great needs a little work to make 100% but I have just noticed the product name and description dont match? Here is the code: I have highlighted the bits that make them random which is what I need, but they are too random <_< <?php $limit = 170; /* $Id: new_products.php,v 1.34 2003/06/09 22:49:58 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright ? 2003 osCommerce Released under the GNU General Public License */ ?> <!-- new_products //--> <?php if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) { $new_products_query = tep_db_query("select pd.products_id, pd.products_description, p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where products_status = '1' order by RAND() limit " . MAX_DISPLAY_NEW_PRODUCTS); } else { $new_products_query = tep_db_query("select distinct p.products_id, p.products_image, pd.products_id, pd.products_description, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . (int)$new_products_category_id . "' and p.products_status = '1' and p.products_id = pd.products_id order by RAND() limit " . MAX_DISPLAY_NEW_PRODUCTS); } echo ' <table width="100%" border="0" cellspacing="0" cellpadding="0" class="greetinguser"> <tr> <td> <table width="100%" border="0" cellspacing="3" cellpadding="3"> <tr> <td> <table width="100%" border="0" cellspacing="1" cellpadding="1" class="greetinguserwhite"> <tr> <td><font size="2"><font color="#000000"><center><b>'.sprintf(TABLE_HEADING_NEW_PRODUCTS,'').'</center></font></b></td> </tr> </table> </td> </tr> </table> </td> </tr> <tr> <td>'; while ($new_products = tep_db_fetch_array($new_products_query)) { $new_products['products_name'] = tep_get_products_name($new_products['products_id']); $products_description = $new_products['products_description']; $description_length = strlen($products_description); if ($description_length > $limit) { $products_description = substr($products_description,0,$limit) . ""; } echo ' <table width="100%" border="0" cellspacing="3" cellpadding="3"> <tr> <td width="50%" valign="top"><table width="100%" height="100%" border="0" cellspacing="1" cellpadding="1" class="greetinguserwhite"> <tr> <td colspan="2"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td class="ourtexthere" width="90%"><b><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a></b></td> <td class="ourtexthere" align="right" width="10%"><font color="red"><b>'.$currencies->display_price($new_products['products_price'],tep_get_tax_rate($new_products['products_tax_class_id'])).'</b></font></td> </tr> </table> </td> </tr> <tr> <td colspan="2"></td> </tr> <tr> <td class="ourtexthere"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">'. tep_image(DIR_WS_IMAGES . $new_products['products_image'],$new_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT). '</a></td> <td class="ourtexthere">'.$products_description.'<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '"><br><font color="red"><b> More..</b></font></a><br><a href="' . tep_href_link(FILENAME_DEFAULT, tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $new_products['products_id'], 'NONSSL') . '">' . tep_image_button('button_buy_now.gif', TEXT_BUY . $new_products['products_name'] . TEXT_NOW). '</a></td> </tr> <tr> <td colspan="2">'. tep_draw_separator('pixel_trans.gif', '100%', '10'). '</td> </tr> </table></td>' ?> <?php $new_products = tep_db_fetch_array($new_products_query); $new_products['products_name'] = tep_get_products_name($new_products['products_id']); $products_description = $new_products['products_description']; $description_length = strlen($products_description); if ($description_length > $limit) { $products_description = substr($products_description,0,$limit) . ""; } // if(empty($new_products['products_name'])) // { // exit; // }else{ if (empty($new_products['products_name'])){ echo ' <td width="50%" valign="top"> <table width="100%" height="100%" border="0" cellspacing="1" cellpadding="1"> <tr> <td colspan="2"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td class="ourtexthere" width="90%"></td> <td class="ourtexthere" align="right" width="10%"></td> </tr> </table> </td> </tr> <tr> <td colspan="2">'.tep_draw_separator('pixel_trans.gif', '100%', '10').'</td> </tr> <tr> <td class="ourtexthere">'.tep_draw_separator('pixel_trans.gif', '100%', '10').'</td> <td class="ourtexthere">'.tep_draw_separator('pixel_trans.gif', '100%', '10').'</td> </tr> <tr> <td colspan="2" align="right">'.tep_draw_separator('pixel_trans.gif', '100%', '10').'</td> </tr> <tr> <td colspan="2">'.tep_draw_separator('pixel_trans.gif', '100%', '10').'</td> </tr> </table></td> </tr> </table>'; } else{ ?> <?php echo ' <td width="50%" valign="top"><table width="100%" height="100%" border="0" cellspacing="1" cellpadding="1" class="greetinguserwhite"> <tr> <td colspan="2"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td class="ourtexthere" width="90%"><b><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a></b></td> <td class="ourtexthere" align="right" width="10%"><font color="red"><b>'.$currencies->display_price($new_products['products_price'],tep_get_tax_rate($new_products['products_tax_class_id'])).'</b></font></td> </tr> </table> </td> </tr> <tr> <td colspan="2"></td> </tr> <tr> <td class="ourtexthere"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">'. tep_image(DIR_WS_IMAGES . $new_products['products_image'],$new_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT). '</a></td> <td class="ourtexthere">'.$products_description.'<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '"><br><font color="red"><b> More..</b></font></a><br><a href="' . tep_href_link(FILENAME_DEFAULT, tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $new_products['products_id'], 'NONSSL') . '">' . tep_image_button('button_buy_now.gif', TEXT_BUY . $new_products['products_name'] . TEXT_NOW). '</a></td> </tr> <tr> <td colspan="2">'.tep_draw_separator('pixel_trans.gif', '100%', '10').'</td> </tr> </table></td> </tr> </table>'; } } echo '</td> </tr> </table>'; ?> <!-- new_products_eof //--> Any help most gratefull. :unsure:
Recommended Posts
Archived
This topic is now archived and is closed to further replies.