dtrain Posted October 20, 2009 Posted October 20, 2009 Hi, I am having trouble making my Categories section look like the 'View All Categories' section that has already been designed. I am using a template that was designed for me, and don't have any contact with the person that did it anymore. It doesn't align properly to other parts that I am happy with and I can't work out for the life of me why this would be the case. The code for the Categories is listed below, with the 'View All' following. If I could have any help with this it would be great as I'm fairly new at PHP and still not sure what some of the commands will do to change the layout. Cheers, Dallas <table border="0" cellspacing="0" cellpadding="0" width="<?php echo $content; ?>" style="margin-left:15px"> <?php $products_new_array = array(); $products_new_query_raw = "select p.products_id, pd.products_name, pd.products_description, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_date_added DESC, pd.products_name"; $products_new_split = new splitPageResults($products_new_query_raw, MAX_DISPLAY_PRODUCTS_NEW); if (($products_new_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3'))) { ?> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="smallText"><?php echo $products_new_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS_NEW); ?></td> <td align="right" class="smallText"><?php echo TEXT_RESULT_PAGE . ' ' . $products_new_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <?php } ?> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <?php if ($products_new_split->number_of_rows > 0) { $products_new_query = tep_db_query($products_new_split->sql_query); while ($products_new = tep_db_fetch_array($products_new_query)) { if ($new_price = tep_get_products_special_price($products_new['products_id'])) { $products_price = '<s class="zag_pr_old" style="font-size:15px;">' . $currencies->display_price($products_new['products_price'], tep_get_tax_rate($products_new['products_tax_class_id'])) . '</s> <span class="zag_pr_price" style="font-size:15px;">' . $currencies->display_price($new_price, tep_get_tax_rate($products_new['products_tax_class_id'])) . '</span>'; } else { $products_price = '<span class="zag_pr_price">'.$currencies->display_price($products_new['products_price'], tep_get_tax_rate($products_new['products_tax_class_id'])).'</span>'; } ?> <tr> <td style="padding-bottom:12px;border-bottom:1px dotted #B2B2B2;"> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '2'); ?></td> </tr> <tr> <td class="all" valign="top" width="<?php echo (SMALL_IMAGE_WIDTH+20);?>"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_new['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $products_new['products_image'], $products_new['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, ' align="left" style="margin:0 15px 0 0px" class="small_image"') . '</a>'; ?> </td> <!-- Product Name, Description, etc --> <td class="main" style="padding:0" ><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_new['products_id']) . '" class="zag_main"><b>' . $products_new['products_name'] . '</b><br><br></a>' . tep_flatten_product_description($products_new['products_description']) . '<br><b>' . '<br><div class="zag_pr_text" style="font-size:14px;">' . 'Price:' . ' ' . $products_price . '</div>'; ?> <!-- . TEXT_DATE_ADDED . ' ' . tep_date_long($products_new['products_date_added']) . '<br>' . '<br><div class="zag_pr_text" style="font-size:12px;">' . TEXT_PRICE . ' ' . $products_price . '</div>'; ?> --> <br> <!-- Shopping Cart --> <div align="left" valign="middle"> <?php echo ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_new['products_id']) . '">' . tep_image_button('button_det.gif', IMAGE_BUTTON_DET) . '</a>';?> <?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_NEW, tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $products_new['products_id']) . '">' . tep_image_button('button_in_cart.gif', IMAGE_BUTTON_IN_CART) . '</a>'; ?></div></td> </tr> </table> </td> </tr> <?php } } else { ?> <tr> <td bgcolor="#AFBCC1"> <table border="0" width="100%" cellspacing="0" cellpadding="2" bgcolor="#FFFFFF"> <tr> <td class="main"><?php echo TEXT_NO_NEW_PRODUCTS; ?></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '3'); ?></td> </tr> </table> </td> </tr> <?php } ?> </table></td> </tr> </table> <?php if (($products_new_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3'))) { ?> <table border="0" cellspacing="0" cellpadding="0"> <tr> <td> <?php echo tep_image(DIR_WS_IMAGES . 'main_line.gif'); ?> <table border="0" width="100%" cellspacing="0" cellpadding="8" class="number"> <tr> <td class="smallText"><?php echo $products_new_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS_NEW); ?></td> <td align="right" class="smallText"><?php echo TEXT_RESULT_PAGE . ' ' . $products_new_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td> </tr> </table></td> </tr> <?php } ?> </table> <?php /* $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 (c) 2003 osCommerce Released under the GNU General Public License */ $info_box_contents = array(); $info_box_contents[] = array('text' => sprintf(TABLE_HEADING_NEW_PRODUCTS, strftime('%B'))); 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.manufacturers_id, 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.manufacturers_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 = 0; $info_box_contents = array(); $arr_manuf = tep_get_manufacturers(); $list_manuf = array(); foreach ($arr_manuf as $arr_manuf_v){ $list_manuf[$arr_manuf_v['id']] = $arr_manuf_v['text'];} while ($new_products = tep_db_fetch_array($new_products_query)) { $new_products['products_name'] = tep_get_products_name($new_products['products_id']); $product_query = tep_db_query("select products_description from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$new_products['products_id'] . "' and language_id = '" . (int)$languages_id . "'"); $product = tep_db_fetch_array($product_query); $new_products['products_name'] = tep_get_products_name($new_products['products_id']); $info_box_contents[$row][$col] = array('align' => 'right', 'params' => 'class="smallText" width="50%" valign="top"', 'text' => '<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>', 'zg'=>'<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a>' , 'price'=> $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])), 'newpr'=> $currencies->display_price($new_price, tep_get_tax_rate($new_products['products_tax_class_id'])), 'id'=>$new_products['products_id'], 'des'=>$product['products_description'], 'img'=>$new_products['products_image'], 'manuf'=>$list_manuf[$new_products['manufacturers_id']], 'name'=>$new_products['products_name'] ); $col ++; if ($col > 10) { $col = 0; $row ++; } } $st_key = false; $kk=0; $max_c=1; $max_i=MAX_DISPLAY_NEW_PRODUCTS; ?> <?php echo '<table width="'.$content.'" border="0" cellpadding="0" cellspacing="0" style="padding:0; margin:0;">'. '<tr><td style="padding:0 0 0 15px">'; echo '</td></tr></table>'; echo '<table width="'.$content.'" border="0" cellpadding="0" cellspacing="2" style="padding:0; margin:0;">'. '<tr valign="top"><td style="padding:15px 0 0 0px">'; // START for ($i_=0;$i_<$max_i; $i_=$i_+=2){ $align='left'; $align2='right'; if ($st_key) { $st_key = false; $k=0; } else { $st_key = true; $k=1; } $kk++; if ($kk == 1) {$align='right';$align2='left';} if($info_box_contents[0][$i_]["zg"]!=''){ ?> <table border="0" cellpadding="0" cellspacing="0"> <tr> <td style="padding:0 0 0 15px"> <div class="goods"> <div style="padding:15px 0 0 8px"> <div class="item_zag_main zag" style="text-align:center"><?php echo $info_box_contents[0][$i_]["zg"] ;?></div> <div style="float:left;padding-left:10px; width: <?php echo SMALL_IMAGE_WIDTH; ?>px"><?php echo $info_box_contents[0][$i_]["text"];?></div> <div class="item_des" style="padding-top:25px"><?php echo substr($info_box_contents[0][$i_]["des"],0,14);?></div> <div style="height:13px"></div> <div class="item_price"><?php echo $info_box_contents [0][$i_]['price']; ?></div> <div style=" margin:0px 0 0 0px;"><?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product'),'post','') . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART,'style="margin:15px 0px 6px 0px; float:left"') . tep_draw_hidden_field('products_id', $info_box_contents[0][$i_]['id']) . '</form>'.'<a href="'.tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $info_box_contents[0][$i_]['id']).'">'.tep_image_button('button_det.gif','','style="float:left"').'</a>';?></div> </div> </div> </td> <td><?php echo tep_image(DIR_WS_IMAGES."spacer.gif",'',5,5); ?></td> <td style="padding:0 0 0 0px"> <div class="goods"> <div style="padding:15px 0 0 8px"> <div class="item_zag_main zag" style="text-align:center;"><?php echo $info_box_contents[0][$i_+1]["zg"] ;?></div> <div style="float:left;padding-left:10px; width: <?php echo SMALL_IMAGE_WIDTH; ?>px"><?php echo $info_box_contents[0][$i_+1]["text"];?></div> <div class="item_des" style="padding-top:25px"><?php echo substr($info_box_contents[0][$i_]["des"],0,14);?></div> <div style="height:13px"></div> <div class="item_price"><?php echo $info_box_contents [0][$i_+1]['price']; ?></div> <div style=" margin:0px 0 0 0px;"><?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product'),'post','') . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART,'style="margin:15px 0px 6px 0px; float:left"') . tep_draw_hidden_field('products_id', $info_box_contents[0][$i_+1]['id']) . '</form>'.'<a href="'.tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $info_box_contents[0][$i_+1]['id']).'">'.tep_image_button('button_det.gif','','style="float:left"').'</a>';?></div> </div> </div> </td> </tr> </table> <?php } if ( ($i_+2) < $max_i ) { if ( !isset($info_box_contents[0][$i_+1]['id']) ) { break; } if ( $kk == $max_c ) { $kk = 0; echo '</td></tr><tr><td></td></tr><tr valign="top">'; } else { echo '</td><td>'.tep_image(DIR_WS_IMAGES . 'hor_line.gif').'</td>'; } echo '<td>'; } } echo '<br></td></tr></table>'; ?>
Recommended Posts
Archived
This topic is now archived and is closed to further replies.