I just noticed that the code i placed in my first post works with the tpl_tabular_display.php file:
Code:
<?php
/**
* Common Template - tpl_tabular_display.php
*
* This file is used for generating tabular output where needed, based on the supplied array of table-cell contents.
*
* @package templateSystem
* @copyright Copyright 2003-2006 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: tpl_tabular_display.php 3149 2006-03-10 07:29:34Z birdbrain $
*/
$list_box_contents = array();
$show_submit = zen_run_normal();
$listing_split = new splitPageResults($listing_sql, MAX_DISPLAY_PRODUCTS_LISTING, 'p.products_id', 'page');
if ($listing_split->number_of_rows > 0) {
$rows = 0;
$listing = $db->Execute($listing_split->sql_query);
$extra_row = 0;
$link2 = '';
while (!$listing->EOF) {
$rows++;
if ((($rows-$extra_row)/2) == floor(($rows-$extra_row)/2)) {
$list_box_contents[$rows] = array('params' => 'class="productListing-even"');
} else {
$list_box_contents[$rows] = array('params' => 'class="productListing-odd"');
}
$cur_row = sizeof($list_box_contents) - 1;
$list_box_contents[$rows] = array();
for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {
$lc_align = '';
switch ($column_list[$col]) {
case 'PRODUCT_LIST_MODEL':
$list_box_contents[$rows]['model'] = $listing->fields['products_model'];
break;
case 'PRODUCT_LIST_NAME':
if (isset($_GET['manufacturers_id'])) {
$list_box_contents[$rows]['name'] = $listing->fields['products_name'];
$list_box_contents[$rows]['but'] = zen_href_link(zen_get_info_page($listing->fields['products_id']), 'manufacturers_id=' . $_GET['manufacturers_id'] . '&products_id=' . $listing->fields['products_id']);
} else {
$list_box_contents[$rows]['name'] = $listing->fields['products_name'];
$list_box_contents[$rows]['but'] = zen_href_link(zen_get_info_page($listing->fields['products_id']), ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing->fields['products_id']);
}
$list_box_contents[$rows]['description'] = zen_trunc_string(zen_clean_html(stripslashes(zen_get_products_description($listing->fields['products_id'], $_SESSION['languages_id']))), PRODUCT_LIST_DESCRIPTION);
break;
case 'PRODUCT_LIST_MANUFACTURER':
$list_box_contents[$rows]['manufacturer'] = '<a href="' . zen_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing->fields['manufacturers_id']) . '" style="color:#00C3FB;">' . $listing->fields['manufacturers_name'] . '</a>';
break;
case 'PRODUCT_LIST_PRICE':
$list_box_contents[$rows]['price'] = zen_get_products_display_price($listing->fields['products_id']);
// more info in place of buy now
$lc_button = '';
if (zen_has_product_attributes($listing->fields['products_id']) or PRODUCT_LIST_PRICE_BUY_NOW == '0') {
$lc_button = '<a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'products_id=' . $listing->fields['products_id']) . '">' . MORE_INFO_TEXT . '</a>';
} else {
if (PRODUCT_LISTING_MULTIPLE_ADD_TO_CART != 0) {
if ($listing->fields['product_is_call'] == 0) {
if (zen_get_products_allow_add_to_cart($listing->fields['products_id']) !='N') {
if ((SHOW_PRODUCTS_SOLD_OUT_IMAGE == 1 and $listing->fields['products_quantity'] > 0) or SHOW_PRODUCTS_SOLD_OUT_IMAGE == 0) {
$how_many++;
}
}
}
$lc_button = TEXT_PRODUCT_LISTING_MULTIPLE_ADD_TO_CART . "<input type=\"text\" name=\"products_id[" . $listing->fields['products_id'] . "]\" value=\"0\" size=\"4\" />";
} else {
$lc_button = '<a href="' . zen_href_link($_GET['main_page'], zen_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing->fields['products_id']) . '">' . zen_image_button(BUTTON_IMAGE_BUY_NOW, BUTTON_BUY_NOW_ALT) . '</a>';
}
}
$the_button = $lc_button;
$products_link = '<a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'products_id=' . $listing->fields['products_id']) . '">' . MORE_INFO_TEXT . '</a>';
$list_box_contents[$rows]['button'] .= zen_get_buy_now_button($listing->fields['products_id'], $the_button, $products_link) . '<br />' . zen_get_products_quantity_min_units_display($listing->fields['products_id']);
$list_box_contents[$rows]['button'] = preg_replace('/title=/i', 'style="vertical-align:middle;" title=', $list_box_contents[$rows]['button']);
$list_box_contents[$rows]['button'] .= '<br />' . (zen_get_show_product_switch($listing->fields['products_id'], 'ALWAYS_FREE_SHIPPING_IMAGE_SWITCH') ? (zen_get_product_is_always_free_shipping($listing->fields['products_id']) ? TEXT_PRODUCT_FREE_SHIPPING_ICON . '<br />' : '') : '');
break;
case 'PRODUCT_LIST_QUANTITY':
$list_box_contents[$rows]['quantity'] = $listing->fields['products_quantity'];
break;
case 'PRODUCT_LIST_WEIGHT':
$list_box_contents[$rows]['weight'] = $listing->fields['products_weight'];
break;
case 'PRODUCT_LIST_IMAGE':
if (isset($_GET['manufacturers_id'])) {
$list_box_contents[$rows]['image'] = zen_image(DIR_WS_IMAGES . $listing->fields['products_image'], $listing->fields['products_name'], IMAGE_PRODUCT_LISTING_WIDTH, IMAGE_PRODUCT_LISTING_HEIGHT);
} else {
$list_box_contents[$rows]['image'] = zen_image(DIR_WS_IMAGES . $listing->fields['products_image'], $listing->fields['products_name'], IMAGE_PRODUCT_LISTING_WIDTH, IMAGE_PRODUCT_LISTING_HEIGHT);
}
case 'PRODUCT_LIST_IMAGE2':
if (isset($_GET['manufacturers_id'])) {
$list_box_contents[$rows]['image2'] = zen_href_link(zen_get_info_page($listing->fields['products_id']), 'manufacturers_id=' . $_GET['manufacturers_id'] . '&products_id=' . $listing->fields['products_id']);
} else {
$list_box_contents[$rows]['image2'] = zen_href_link(zen_get_info_page($listing->fields['products_id']), ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing->fields['products_id']);
}
break;
}
}
$listing->MoveNext();
}
$error_categories = false;
} else {
$list_box_contents = array();
$list_box_contents[0] = array('params' => 'class="productListing-odd"');
$list_box_contents[0][] = array('params' => 'class="productListing-data"',
'text' => TEXT_NO_PRODUCTS);
$error_categories = true;
}
foreach($list_box_contents as $product){
// print_r($product);
/*echo '<br style="line-height:8px;"/>
<div class="prod_table">
<div class="prod_table_row">
'.$product['image'].'
<div>'.$product['name'].'<br/><br style="line-height:8px;"/>'.$product['description'].'<br>
'.(strlen($product['price']) > 200 ? '<span class="p_left"><br style="line-height:5px;"/>'.$product['price'].'' : '<span class="p_left"><br style="line-height:5px;"/>Price: '.$product['price']).'<span style="margin-left:25px;">
<a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'manufacturers_id=' . $_GET['manufacturers_id'] . '&products_id=' . $listing->fields['products_id']) . '">'.zen_image_button('det.gif','','style="vertical-align:top;"').'</a></span>
</span></div>
</div>
</div>
<div class="pink_sep"></div>';
*/
if ($product[0]['text'] == 'There is no product that matches the search criteria.')
{
echo '<div class="rp2">'.$product[0]['text'].'</div>';
}
else
{
$tm_href = $product['but'];
$tm_img = $product['image'];
$tm_name = $product['name'];
$tm_desc = $product['description'];
$tm_price = $product['price'];
echo tm_listing($tm_href, $tm_img, $tm_name, $tm_desc, $tm_price);
}
}
?>