Jonojamesmac Posted January 26, 2008 Share Posted January 26, 2008 Hey, i've got a test shop running and looking at having 8 products on the index page, now i know the file i need to edit is special_products.php for making more products showing on the first page. Currently the code looks like this: <!-- specials //--> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td> <?php if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) { $new_products_query = tep_db_query("select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_status = '1' and p.products_id = s.products_id and pd.products_id = s.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' order by s.specials_date_added desc limit " . MAX_RANDOM_SELECT_SPECIALS); } // $info_box_contents = array(); // $info_box_contents[] = array('text' => "<div style='height:20px; padding-right:10px;color:#E80377; font-weight:bold; font-size:14px; text-align:right;'><img src='images/sign_what_newg.gif' width='21' height='17' style='margin-top:1px;'> WHAT WE OFFER</div>"); // new contentBoxHeading($info_box_contents); ?> </td> </tr> <tr> <td> <?php $row = 0; $col = 0; $info_box_contents = array(); while ($new_products = tep_db_fetch_array($new_products_query)) { $new_products['products_name'] = tep_get_products_name($new_products['products_id']); $sql = 'SELECT `products_description` FROM `products_description` WHERE products_id ='.$new_products['products_id'].' && language_id='.(int)$languages_id; $description_query = tep_db_query($sql); $description = mysql_fetch_array($description_query, MYSQL_ASSOC); $description['products_description'] = substr($description['products_description'], 0, 65); $desc_len = strlen($description['products_description']); $description['products_description'][$desc_len-1] = '.'; $description['products_description'][$desc_len-2] = '.'; $description['products_description'][$desc_len-3] = '.'; $info_box_contents[$row][$col] = array('align' => 'center', 'params' => 'width="33%" style="padding-top:7px;" valign="top"', 'text' => '<table border="0" cellpadding="0" cellspacing="0"><tr><td align="center" style="padding-bottom:8px; padding-top:4px;"><div style=" width:140px; height:120px; border:0px solid #3A3236;"><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></div><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a><div style="width:140px; height:50px;">'.$description['products_description'].'</div>Price: <span style="text-decoration:line-through">'. $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])).'</span> <span style="color:#000000; font-weight:bold;"> '.$currencies->display_price($new_products['specials_new_products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])). '</span>'.tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product')).'<div style="width:140px; height:18px; background-color:#3A3336; color:#FFFFFF; padding-top:2px;">'.tep_draw_hidden_field('products_id', $new_products['products_id']) . tep_image_submit('add.gif', IMAGE_BUTTON_IN_CART).' | <a class="more" href="'.tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']).'">more info</a></div></form></td></tr></table>'); $col ++; if ($col > 5) { break; } } $dop_col=$col; if($dop_col<6) { if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) { $new_products_query = tep_db_query("select 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 . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where products_status = '1' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS); } else { $new_products_query = tep_db_query("select distinct 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 . " p 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' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS); } $row = 0; $col = $dop_col; // $info_box_contents = array(); while ($new_products = tep_db_fetch_array($new_products_query)) { $new_products['products_name'] = tep_get_products_name($new_products['products_id']); $sql = 'SELECT `products_description` FROM `products_description` WHERE products_id ='.$new_products['products_id'].' && language_id='.(int)$languages_id; $description_query = tep_db_query($sql); $description = mysql_fetch_array($description_query, MYSQL_ASSOC); $description['products_description'] = substr($description['products_description'], 0, 65); $desc_len = strlen($description['products_description']); $description['products_description'][$desc_len-1] = '.'; $description['products_description'][$desc_len-2] = '.'; $description['products_description'][$desc_len-3] = '.'; $info_box_contents[$row][$col] = array('align' => 'center', 'params' => 'width="33%" style="padding-top:9px;" valign="top"', 'text' => '<table border="0" cellpadding="0" cellspacing="0"><tr><td align="center" style="padding-bottom:8px;"><div style=" width:140px; height:120px; border:0px solid #3A3236;"><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></div><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a><div style="width:140px; height:50px;">'.$description['products_description'].'</div>Price: <span style="font:bold 100% Arial, Helvetica, sans-serif;color:#000000;">' . $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])).'</span>'.tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product')).'<div style="width:140px; height:18px; background-color:#3A3336; color:#FFFFFF; padding-top:2px;">'.tep_draw_hidden_field('products_id', $new_products['products_id']) . tep_image_submit('add.gif', IMAGE_BUTTON_IN_CART).' | <a class="more" href="'.tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']).'">more info</a></div></form></td></tr></table>'); $col ++; if ($col >=8) { break; } } } new contentBox($info_box_contents, 0); ?> </td> </tr> </table> <!-- specials_eof //--> What needs changing in order to show 8 products over two rows? Help would be much appreciated! :-) Shop is over at http://www.tussypats.com/store as you can see i've currently got 5 test products in which is causing the problem with the 2 rows :-( Link to comment Share on other sites More sharing options...
chipshot Posted January 26, 2008 Share Posted January 26, 2008 no you don't need to edit any pages you have that control from the admin panel Admin ---> Configuration ---->Maximum Values Link to comment Share on other sites More sharing options...
Jonojamesmac Posted January 26, 2008 Author Share Posted January 26, 2008 no you don't need to edit any pages you have that control from the admin panel Admin ---> Configuration ---->Maximum Values Hey thanks! I didnt see that there, however it still didnt show the amount of images i wanted it to show. so i changed the code at the bottom from $col ++; if ($col >=3) { break; } to $col ++; if ($col >=3) { $col=0; $row ++; if ($row >=3) { break; } } and it worked :-) Thanks for the help Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.