TEF Posted September 8, 2006 Posted September 8, 2006 sup guys, i'm a newbie to os commerce and also not a php coder, i know may a=way around a bit but not enough... my question is, i have a store set up, with a template layout, but the tmplate layout shows 3 new or special products in the front of the store, one row with 3 colums... all i want to know is how do i make tht display 6 products total instead of just 3 basicaly adding one more row... if anyone can help be mucj=h apreciated, here is the current code <!-- 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:106px; border:1px 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:#FF00AD; 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</a></div></form></td></tr></table>'); $col ++; if ($col > 2) { break; } } $dop_col=$col; if($dop_col<3) { 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:106px; border:1px 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:#FF00AD;">' . $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</a></div></form></td></tr></table>'); $col ++; if ($col >=3) { break; } } } new contentBox($info_box_contents, 0); ?> </td> </tr> </table> <!-- specials_eof //-->
digbydo Posted September 8, 2006 Posted September 8, 2006 Check the numbers in: admin -> Configuration -> Maximum Values -> Special Products admin -> Configuration -> Maximum Values -> New Products Module admin -> Configuration -> Maximum Values -> New Products Listing etc... one-click installation.. Dave's info
TEF Posted September 8, 2006 Author Posted September 8, 2006 Check the numbers in: admin -> Configuration -> Maximum Values -> Special Products admin -> Configuration -> Maximum Values -> New Products Module admin -> Configuration -> Maximum Values -> New Products Listing etc... thanks but i tried messing with that didnt really make a difference in this case...
TEF Posted September 8, 2006 Author Posted September 8, 2006 can anyone help? i'm sure its something simple, by repeating the code i posted above i can see the 2 rows, but obviously it just shows the same products twice, so there has to be something simple that i can change to the code, do display the next 3 products as opossed to the same 3, but i tried messing with it for hours, but just could not find the trick...so if anyone out there knows a bit more coding then me should not be hard... again thanks in advanced...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.