Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

I need help with product listing.php


Isiah

Recommended Posts

Ok so i figured out how to change the way my items are viewed. I kinda got it looking the way i wanted them to but there still is a problem that i cant figure out on my own im no pro yet. but i have pics attached on what it looks like now and what i want it to look like. On the left side of the pic that's what it looks like when you view a category and on the right side of the pic that is what it looks like when you select new products link on my website and i just want the categories to look the same as it does on "New Products" link that when you click on a category to view products. If you cant understand im sorry its kinda hard to explain. I also have the code for the new products link. If that's necessary for this to be fixed please let me know. thanks for anyone who can help me.

 

here is the link to the pic.

http://i11.photobucket.com/albums/a193/Sha...pg?t=1231706126

 

I dont know if you need to see the whole thing but here is the code for product_listing.php

 

<?php

/*

$Id: product_listing.php,v 1.44 2003/06/09 22:49:59 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

?>

 

<?php echo tep_draw_title_top();?>

 

<?php echo $breadcrumb->trail(' » ')?>

 

<?php echo tep_draw_title_bottom();?>

 

<?php tep_draw_heading_top_3();?>

 

<?php

$listing_split = new splitPageResults($listing_sql, MAX_DISPLAY_SEARCH_RESULTS, 'p.products_id');

 

if ( ($listing_split->number_of_rows > 0) && ( (PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '2') ) ) {

?>

<?php echo tep_draw_result_top_1(); ?>

<table border="0" width="100%" cellspacing="0" cellpadding="0" class="result">

<tr>

<td><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td>

<td class="result_right" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>

</tr>

</table>

<?php echo tep_draw_result_bottom_1(); ?>

<?php echo tep_draw_result_top(); ?>

 

<?php

}

 

$info_box_contents = array();

$list_box_contents = array();

$my_row = 0;

$my_col = 0;

 

 

for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {

switch ($column_list[$col]) {

case 'PRODUCT_LIST_MODEL':

$lc_text = TABLE_HEADING_MODEL;

$lc_align = '';

break;

case 'PRODUCT_LIST_NAME':

$lc_text = TABLE_HEADING_PRODUCTS;

$lc_align = '';

break;

case 'PRODUCT_LIST_MANUFACTURER':

$lc_text = TABLE_HEADING_MANUFACTURER;

$lc_align = '';

break;

case 'PRODUCT_LIST_PRICE':

$lc_text = TABLE_HEADING_PRICE;

$lc_align = 'right';

break;

case 'PRODUCT_LIST_QUANTITY':

$lc_text = TABLE_HEADING_QUANTITY;

$lc_align = 'right';

break;

case 'PRODUCT_LIST_WEIGHT':

$lc_text = TABLE_HEADING_WEIGHT;

$lc_align = 'right';

break;

case 'PRODUCT_LIST_IMAGE':

$lc_text = TABLE_HEADING_IMAGE;

$lc_align = 'center';

break;

case 'PRODUCT_LIST_BUY_NOW':

$lc_text = TABLE_HEADING_BUY_NOW;

$lc_align = 'center';

break;

}

 

if ( ($column_list[$col] != 'PRODUCT_LIST_BUY_NOW') && ($column_list[$col] != 'PRODUCT_LIST_IMAGE') ) {

$lc_text = tep_create_sort_heading($HTTP_GET_VARS['sort'], $col+1, $lc_text);

}

 

$list_box_contents[0][] = array('align' => $lc_align,

'params' => 'class="productListing-heading"',

'text' => ' ' . $lc_text . ' ');

}

 

if ($listing_split->number_of_rows > 0) {

$rows = 0;

$listing_query = tep_db_query($listing_split->sql_query);

while ($listing = tep_db_fetch_array($listing_query)) {

$rows++;

 

if (($rows/2) == floor($rows/2)) {

$list_box_contents[] = array('params' => 'class="productListing-even"');

} else {

$list_box_contents[] = array('params' => 'class="productListing-odd"');

}

 

$cur_row = sizeof($list_box_contents) - 1;

 

for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {

$lc_align = '';

 

switch ($column_list[$col]) {

case 'PRODUCT_LIST_MODEL':

$lc_align = '';

 

$p_model = '<tr>

<td><b><font>'.TABLE_HEADING_MODEL.' :</font></b></td>

<td align="right">' . $listing['products_model'] . '</td>

</tr>';

break;

case 'PRODUCT_LIST_NAME':

$lc_align = '';

if (isset($HTTP_GET_VARS['manufacturers_id'])) {

$p_name = $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a>';

} else {

$p_name = $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a>';

}

break;

case 'PRODUCT_LIST_MANUFACTURER':

$lc_align = '';

$p_manufact = '<tr>

<td><b><font>'.TABLE_HEADING_MANUFACTURER.' :</font></b></td>

<td align="right"><b><font><a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing['manufacturers_id']) . '">' . $listing['manufacturers_name'] . '</a></b></font></td>

</tr>';

break;

case 'PRODUCT_LIST_PRICE':

$lc_align = 'right';

if (tep_not_null($listing['specials_new_products_price'])) {

$p_price = $lc_text = '<s>' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</s>  <span class="productSpecialPrice">' . $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span>';

} else {

$p_price = $lc_text = '<span class="productSpecialPrice">' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span>';

}

break;

case 'PRODUCT_LIST_QUANTITY':

$lc_align = 'right';

$p_qty = '<tr>

<td><b><font>'.TABLE_HEADING_QUANTITY.' :</font></b></td>

<td align="right">' . $listing['products_quantity'] . '</td>

</tr>';

break;

case 'PRODUCT_LIST_WEIGHT':

$lc_align = 'right';

$p_weight = '<tr>

<td><b><font>'.TABLE_HEADING_WEIGHT.' :</font></b></td>

<td align="right">' . $listing['products_weight'] . '</td>

</tr>';

break;

case 'PRODUCT_LIST_IMAGE':

$lc_align = 'center';

if (isset($HTTP_GET_VARS['manufacturers_id'])) {

$p_pic = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>';

} else {

$p_pic = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>';

}

break;

case 'PRODUCT_LIST_BUY_NOW':

$lc_align = 'center';

$lc_text = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> ';

break;

}

 

$product_query = tep_db_query("select products_description, products_id from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$listing['products_id'] . "' and language_id = '" . (int)$languages_id . "'");

$product = tep_db_fetch_array($product_query);

$p_desc = substr(strip_tags($product['products_description']), 0, MAX_DESCR_1).'...<br>';

 

if (PRODUCT_LIST_MODEL != 0 || PRODUCT_LIST_MANUFACTURER != 0 || PRODUCT_LIST_QUANTITY != 0 || PRODUCT_LIST_WEIGHT != 0) {

$p_listing = '<table cellpadding="0" cellspacing="0" border="0" class="listing">'.$p_model.''.$p_manufact.'' . ''.$p_qty.'' . ''.$p_weight.'</table>';

}

 

$p_id = $product['products_id'];

 

/* $list_box_contents[$cur_row][] = array('align' => $lc_align,

'params' => '',

'text' => $lc_text); */

 

}

 

$p_details = '<a href="' . tep_href_link('product_info.php?products_id='.$p_id) . '">'.tep_image_button("button_details.gif").'</a>';

$p_buy_now = '<a href="'.tep_href_link("products_new.php","action=buy_now&products_id=".$p_id).'">'.tep_image_button('button_add_to_cart1.gif').'</a>';

 

 

$info_box_contents[$my_row][$my_col] = array('align' => 'center',

'params' => ' style="width:50%"',

'text' =>

tep_draw_title_top1()

 

.$p_name.

 

tep_draw_title_bottom1().

tep_draw_prod_top().

 

'<table cellpadding="0" cellspacing="0" border="0">

<tr><td style="padding:10px 0px 0px 0px;">'.tep_draw_prod_pic_top().''.$p_pic.''.tep_draw_prod_pic_bottom().'</td></tr>

<tr><td class="vam tac" style="height:37px;padding:5px 0px 5px 0px;">'.$p_price.'</td></tr>

 

<tr><td style="padding:5px 0px 5px 0px;border-top:1px solid #7e7e7e;border-bottom:1px solid #7e7e7e">'.$p_desc.$p_listing.'</td></tr>

<tr><td style="padding:5px 0px 0px 0px;">

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

<tr>

<td class="vam " style="padding:0px 0px 0px 0px;width:50%;">'.$p_details.'</td>

<td class="vam" style="padding:0px 0px 0px 0px;width:50%;" align="right">'.$p_buy_now.'</td>

</tr>

</table></td></tr>

 

</table>'.tep_draw_prod_bottom().'');

 

$my_col ++;

if ($my_col > 0) {

$my_col = 0;

$my_row ++;

}

}

 

new contentBox1($info_box_contents);

// new productListingBox($list_box_contents);

} else { ?>

 

<br style="line-height:11px;">

 

<?php /* echo tep_draw_infoBox_top(); */ ?>

 

 

<table cellpadding="0" cellspacing="0" class="product">

<tr><td class="padd_22"><?php echo TEXT_NO_PRODUCTS ?></td></tr>

</table>

 

 

<br style="line-height:1px;"><br style="line-height:10px;">

<?php

 

/* echo tep_draw_infoBox_bottom(); */

 

 

}

if ( ($listing_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3')) ) {

?>

 

<?php echo tep_draw_result_bottom(); ?>

<?php echo tep_draw_result_top_2(); ?>

<table border="0" width="100%" cellspacing="0" cellpadding="0" class="result">

<tr>

<td><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td>

<td class="result_right" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>

</tr>

</table>

<?php echo tep_draw_result_bottom_2(); ?>

<?php

}

?>

Link to comment
Share on other sites

Heres the new_product.php code just in case

 

<?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 © 2003 osCommerce

 

Released under the GNU General Public License

*/

?>

<!-- new_products //-->

<?php

$info_box_contents = array();

$info_box_contents[] = array('text' => sprintf(TABLE_HEADING_NEW_PRODUCTS, strftime('%B')));

 

// new contentBoxHeading($info_box_contents);

 

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, pd.products_name, 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_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 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, pd.products_name, 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_DESCRIPTION . " pd, " . 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 and pd.language_id = '" . (int)$languages_id . "' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);

}

 

$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']);

 

// ----------

$product_query = tep_db_query("select products_description, products_id 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);

$p_id = $product['products_id'];

 

$p_pic = '<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>';

 

$p_name = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a>';

 

$p_desc = ''.substr(strip_tags($product['products_description']), 0, MAX_DESCR_1).' ...';

 

$p_price = '<span class="productSpecialPrice">'.$currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])).'</span>';

 

$p_details = '<a href="' . tep_href_link('product_info.php?products_id='.$p_id) . '">'.tep_image_button("button_details.gif").'</a>';

$p_buy_now = '<a href="'.tep_href_link("products_new.php","action=buy_now&products_id=".$p_id).'">'.tep_image_button('button_add_to_cart2.gif').'</a>';

 

$info_box_contents[$row][$col] = array('align' => 'center',

'params' => '',

'text' =>

tep_draw_title_top1()

 

.$p_name.

 

tep_draw_title_bottom1().

tep_draw_prod_top().

'<table cellpadding="0" cellspacing="0" border="0" style="margin:16px 0px 0px 0px;">

<tr>

<td>'.tep_draw_prod_pic_top().''.$p_pic.''.tep_draw_prod_pic_bottom().'</td>

<td>'.tep_draw_separator('spacer.gif', '12', '1').'</td>

<td style="width:100%">

<table cellpadding="0" cellspacing="0" border="0" style="height:155px;">

<tr>

<td class="price vam" style="height:100%;padding:0px 0px 15px 0px;">'.$p_price.'</td>

</tr>

<tr>

<td class="vam padd77">'.$p_details.'<br />'.$p_buy_now.'</td>

</tr>

</table>

</td>

</tr>

</table>'.tep_draw_prod_bottom().'');

 

$col ++;

if ($col > 1) {

$col = 0;

$row ++;

}

}

 

new contentBox($info_box_contents);

?>

<!-- new_products_eof //-->

Link to comment
Share on other sites

Please do not PM me, I can not help via PM.

 

Have you tried changing the way the products are displayed in your admin. Configuration, then product listing.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...