Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Front page: module "new products" problem with 100% width in browser


MishaB

Recommended Posts

Hi guys,

 

I really searched the internet and this forum, with no success so far and I hope somebody can help me out here.

 

I am building a new shop right now (NEWBIE !!!) and still have got a couple of questions ...

 

My problem for now:

 

- I changed the images size for an item to 240x220 pixel

- I changed a lot in my stylesheets, have a fluid 960gs grid (100% width of the shop) and re-designed the jquery /ui /redmond stylesheets for boxes, etc.

 

Now: the front page module "NEW PRODUCTS OF THE MONTH" shows 3 columns at browser size 100%. When I change the browser size, the size of the content container does not change, which means the info boxes on the right hand site overlap the products in the middle.

 

I also changed the view of my product listing in a category to columns and here it works fine. The products are in a kind of table and this changes its size dynamically according to the screen resolution.

 

So, I tried now to implement some code fragments of "product_listing.php" to "index.php" (where the module new products is mentioned) - but I don't have enough experience ...

 

Here is the code of the product_listing.php:

$prod_list_contents = '<div class="ui-widget infoBoxContainer">' .

' <div class="ui-widget-header ui-corner-top">' .

' <table border="0" width="100%" cellspacing="0" cellpadding="2">' .

' <tr>';

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

$lc_align = '';

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);

}

$prod_list_contents .= ' <td' . (tep_not_null($lc_align) ? ' align="' . $lc_align . '"' : '') . '>' . $lc_text . '</td>';

}

$prod_list_contents .= ' </tr>' .

' </table>' .

' </div>';

if ($listing_split->number_of_rows > 0) {

$rows = 0;

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

 

$prod_list_contents .= ' <div class="ui-widget-content ui-corner-bottom productListTable">' .

' <table border="0" width="100%" cellspacing="0" cellpadding="0" class="productListingData">'.

' <tr>'.

' <td>'.

' <ul class="column">';

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

$rows++;

$prod_list_contents .= ' <li><div class="block"><table border="0" width="100%" cellspacing="0" cellpadding="2">';

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

switch ($column_list[$col]) {

case 'PRODUCT_LIST_MODEL':

$prod_list_contents .= ' <tr><td align="center" >' . $listing['products_model'] . '</td></tr>';

break;

case 'PRODUCT_LIST_NAME':

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

$prod_list_contents .= ' <tr><td align="center"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '" class="product_name">' . $listing['products_name'] . '</a><p/>'. strip_tags($listing['products_description']) . '...<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '" class="read_more">' . LINK_READ_MORE . '</a></td></tr>';

} else {

$prod_list_contents .= ' <tr><td><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '" class="product_name">' . $listing['products_name'] . '</a><br />'. strip_tags($listing['products_description']) . '...<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '" class="read_more">' . LINK_READ_MORE . '</a></td></tr>';

}

break;

case 'PRODUCT_LIST_MANUFACTURER':

$prod_list_contents .= ' <tr><td align="center"><a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing['manufacturers_id']) . '">' . $listing['manufacturers_name'] . '</a><tr><td>';

break;

case 'PRODUCT_LIST_PRICE':

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

$prod_list_contents .= ' <tr><td align="center"><del>' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</del>  <span class="productSpecialPrice">' . $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span><tr><td>';

} else {

$prod_list_contents .= ' <tr><td align="center"><b>' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</b><tr><td>';

}

break;

case 'PRODUCT_LIST_QUANTITY':

$prod_list_contents .= ' <tr><td align="right">' . $listing['products_quantity'] . '<tr><td>';

break;

case 'PRODUCT_LIST_WEIGHT':

$prod_list_contents .= ' <tr><td align="right">' . $listing['products_weight'] . '<tr><td>';

break;

case 'PRODUCT_LIST_IMAGE':

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

$prod_list_contents .= ' <tr><td align="center"><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><tr><td>';

} else {

$prod_list_contents .= ' <tr><td align="center"><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><tr><td>';

}

break;

case 'PRODUCT_LIST_BUY_NOW':

$prod_list_contents .= ' <tr><td align="center">' . tep_draw_button(IMAGE_BUTTON_BUY_NOW, 'cart', tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id'])) . '<tr><td>';

break;

}//swich

}//for

$prod_list_contents .= ' </table></div></li>';

}//while

$prod_list_contents .= ' </ul>' .

' </td></tr>' .

' </table>' .

' </div>' .

'</div>';

echo $prod_list_contents;

} else {

?>

 

And here the piece of index.php which I guess is relavent:

// needed for the new products module shown below

$new_products_category_id = $current_category_id;

?>

</tr>

</table>

<br />

<?php include(DIR_WS_MODULES . FILENAME_NEW_PRODUCTS); ?>

</div>

</div>

<?php

} elseif ($category_depth == 'products' || isset($HTTP_GET_VARS['manufacturers_id'])) {

// create column list

$define_list = array('PRODUCT_LIST_MODEL' => PRODUCT_LIST_MODEL,

'PRODUCT_LIST_NAME' => PRODUCT_LIST_NAME,

'PRODUCT_LIST_MANUFACTURER' => PRODUCT_LIST_MANUFACTURER,

'PRODUCT_LIST_PRICE' => PRODUCT_LIST_PRICE,

'PRODUCT_LIST_QUANTITY' => PRODUCT_LIST_QUANTITY,

'PRODUCT_LIST_WEIGHT' => PRODUCT_LIST_WEIGHT,

'PRODUCT_LIST_IMAGE' => PRODUCT_LIST_IMAGE,

'PRODUCT_LIST_BUY_NOW' => PRODUCT_LIST_BUY_NOW);

asort($define_list);

$column_list = array();

reset($define_list);

while (list($key, $value) = each($define_list)) {

if ($value > 0) $column_list[] = $key;

}

$select_column_list = '';

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

switch ($column_list[$i]) {

case 'PRODUCT_LIST_MODEL':

$select_column_list .= 'p.products_model, ';

break;

case 'PRODUCT_LIST_NAME':

$select_column_list .= 'pd.products_name, ';

break;

case 'PRODUCT_LIST_MANUFACTURER':

$select_column_list .= 'm.manufacturers_name, ';

break;

case 'PRODUCT_LIST_QUANTITY':

$select_column_list .= 'p.products_quantity, ';

break;

case 'PRODUCT_LIST_IMAGE':

$select_column_list .= 'p.products_image, ';

break;

case 'PRODUCT_LIST_WEIGHT':

$select_column_list .= 'p.products_weight, ';

break;

}

}

// show the products of a specified manufacturer

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

if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) {

// We are asked to show only a specific category

$listing_sql = "select " . $select_column_list . " p.products_id, trim(substring(pd.products_description, 1, 150)) as products_description, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "'";

} else {

// We show them all

$listing_sql = "select " . $select_column_list . " p.products_id, trim(substring(pd.products_description, 1, 150)) as products_description, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m where p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'";

}

} else {

// show the products in a given categorie

if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) {

// We are asked to show only specific catgeory

$listing_sql = "select " . $select_column_list . " p.products_id, trim(substring(pd.products_description, 1, 150)) as products_description, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";

} else {

// We show them all

$listing_sql = "select " . $select_column_list . " p.products_id, trim(substring(pd.products_description, 1, 150)) as products_description, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";

}

}

if ( (!isset($HTTP_GET_VARS['sort'])) || (!preg_match('/^[1-8][ad]$/', $HTTP_GET_VARS['sort'])) || (substr($HTTP_GET_VARS['sort'], 0, 1) > sizeof($column_list)) ) {

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

if ($column_list[$i] == 'PRODUCT_LIST_MODEL') {

$HTTP_GET_VARS['sort'] = $i+1 . 'a';

$listing_sql .= " order by pd.products_model";

break;

}

}

} else {

$sort_col = substr($HTTP_GET_VARS['sort'], 0 , 1);

$sort_order = substr($HTTP_GET_VARS['sort'], 1);

switch ($column_list[$sort_col-1]) {

case 'PRODUCT_LIST_MODEL':

$listing_sql .= " order by p.products_model " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";

break;

case 'PRODUCT_LIST_NAME':

$listing_sql .= " order by pd.products_name " . ($sort_order == 'd' ? 'desc' : '');

break;

case 'PRODUCT_LIST_MANUFACTURER':

$listing_sql .= " order by m.manufacturers_name " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";

break;

case 'PRODUCT_LIST_QUANTITY':

$listing_sql .= " order by p.products_quantity " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";

break;

case 'PRODUCT_LIST_IMAGE':

$listing_sql .= " order by pd.products_name";

break;

case 'PRODUCT_LIST_WEIGHT':

$listing_sql .= " order by p.products_weight " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";

break;

case 'PRODUCT_LIST_PRICE':

$listing_sql .= " order by final_price " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";

break;

}

}

$catname = HEADING_TITLE;

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

$image = tep_db_query("select manufacturers_image, manufacturers_name as catname from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'");

$image = tep_db_fetch_array($image);

$catname = $image['catname'];

} elseif ($current_category_id) {

$image = tep_db_query("select c.categories_image, cd.categories_name as catname from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = '" . (int)$current_category_id . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "'");

$image = tep_db_fetch_array($image);

$catname = $image['catname'];

}

?>

 

How do I wrap the last code in a table with width =100% ???

 

Many thanks in advance!

Misha

Link to comment
Share on other sites

Or do I need to change something in the new_products.php ??? Im pretty desperate by now ... really tried a lot ... and still: I know I "just" need to build a table around it or something and I am frustrated that I don't know how ... Please help! :)

Link to comment
Share on other sites

To change anything in the display of the "new products" module, you need to work on file catalog/includes/modules/new_products.php

 

This one is getting included into index and has nothing to do with product listing.

Link to comment
Share on other sites

Thanks George. I was often on your website, you offer great manuals! :)

 

Do you have any idea, what I need to change in the new_products.php ??? To achieve what I described in my first post???

 

Now: the front page module "NEW PRODUCTS OF THE MONTH" shows 3 columns at browser size 100%. When I change the browser size, the size of the content container does not change, which means the info boxes on the right hand site overlap the products in the middle.

 

I also changed the view of my product listing in a category to columns and here it works fine. The products are in a kind of table and this changes its size dynamically according to the screen resolution.

 

How can I do this for the new_products.php?

 

I am not sure, if I can explain it good enough ... sorry ...

Link to comment
Share on other sites

Misha, to ne honest, it is not 100% clear to me what ou need and/or what the issue is

 

It would be good to know

- what you mean with "cahnging the browser size". To you mean resizing the browser window or "zooming"?

- What addon you installed to get the product listing in columns

 

The new products module with the 3 columns is a table and each <td> is 33%. This table is embedded into a container that has either a fixed width in pixels or a "fluid" in % depending the on 960 css you use. On the same level, there is an other container holding the columns, again either fixed or fluid width. Both containers are inside an other container, that is either 960 pixels wide (or any other value) or 100% in your case

 

Anyway, it would help to see the site, you can post or pm the url if you want

Link to comment
Share on other sites

Thank you so much for your help. Really appreciated! I did as you said. It looks a bit odd (my fault probably), but it still didn't do the trick.

 

I will have a look at it again this afternoon and give it a fresh start then ...

 

Here is what you advised me:

 

First some corrections

- remove any styles you have added to #bodyContent in your css, most important any margins. They are set by the 960 css and any change to that cause confusion

- in file includes/modules/new_products.php make the first table to be 100% (not 50% as now) and the cellpadding to be eg 5 and not 20

Now things are correct again.

Next step to apply the script that creates the columns on the listing pages, to the module too

Right now you have a structure like this <table>

<tr>

<td>Content</td>

<td>Content</td>

<td>Content</td>

</tr>

</table>

This you need to change to something like this

 

<table>

<tr>

<td>

<ul class="column">

<!-- start php loop -->

<li>Content</li>

<li>Content</li>

<li>Content</li>

<!-- end php loop-->

</ul>

</td>

</tr>

</table>

 

I did as best as I could and here is my piece of code (new_products.php)

 

<?php

/*

$Id$

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

Copyright © 2010 osCommerce

Released under the GNU General Public License

*/

 

if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {

$new_products_query = tep_db_query("select p.products_id, p.products_image,trim(substring(pd.products_description, 1, 150)) as products_description, 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_model desc limit " . MAX_DISPLAY_NEW_PRODUCTS);

} else {

$new_products_query = tep_db_query("select distinct p.products_id, p.products_image, trim(substring(pd.products_description, 1, 150)) as products_description, 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_model desc limit " . MAX_DISPLAY_NEW_PRODUCTS);

}

$num_new_products = tep_db_num_rows($new_products_query);

if ($new_products_query > 0) {

$counter = 0;

$col = 0;

$new_prods_content = '<td align="center"><table border="0" width="100%" cellspacing="0" cellpadding="5">';

while ($new_products = tep_db_fetch_array($new_products_query)) {

$counter++;

if ($col === 0) {

$new_prods_content .= '<tr>';

}

$new_prods_content .= '<td width="33%" align="center" valign="top">

<ul class="column"><li>

<p align="justify"><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></li><br /><li><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '" class="product_name">' . $new_products['products_name'] . '</a></li><br />'. substr(strip_tags($new_products['products_description']), 0, 150). '... <li><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']). '" class="read_more">' . LINK_READ_MORE . '</a></li><br />

' . $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])) . '</p></ul></td>';

$col ++;

if (($col > 2) || ($counter == $num_new_products)) {

$new_prods_content .= '</tr>';

$col = 0;

}

}

$new_prods_content .= '</table>';

?>

<h2><?php echo sprintf(TABLE_HEADING_NEW_PRODUCTS, strftime('%B')); ?></h2>

<div class="contentText">

<?php echo $new_prods_content; ?>

</div>

<?php

}

?>

 

As said before: When zooming in with different browsers, my front page with the new products module isn't changing its size (result: overlapping content). But its working on the product listing site (in a category).

 

How strange is this? Especially for me now, after I pulled an "all-nighter" ;-)

Link to comment
Share on other sites

No, that's not correct, because you have the <ul> starting within the loop and also some other table stuff that is not necessary anymore

 

I would do as follows (on a default includes/modules/new_products.php)

 

Find

$new_prods_content = '<table border="0" width="100%" cellspacing="0" cellpadding="2">';
while ($new_products = tep_db_fetch_array($new_products_query)) {
  $counter++;
  if ($col === 0) {
	$new_prods_content .= '<tr>';
  }
  $new_prods_content .= '<td width="33%" align="center" valign="top"><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><br /><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a><br />' . $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])) . '</td>';
  $col ++;
  if (($col > 2) || ($counter == $num_new_products)) {
	$new_prods_content .= '</tr>';
	$col = 0;
  }
}
$new_prods_content .= '</table>';

 

Replace with

$new_prods_content = '<table border="0" width="100%" cellspacing="0" cellpadding="2"><tr><td>' . PHP_EOL;
$new_prods_content .= '  <ul class="column">' . PHP_EOL;

while ($new_products = tep_db_fetch_array($new_products_query)) { // start loop

$new_prods_content .= '	<li>';
   // the actual content start
  $new_prods_content .= '<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><br /><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a><br />' . $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id']));
         // the actual content end
$new_prods_content .= '	</li>' . PHP_EOL;

} // end loop

$new_prods_content .= '  </ul>';
$new_prods_content .= '</td></tr></table>';

 

You could leave the table out completely maybe, so it would look like this

$new_prods_content = '<ul class="column">' . PHP_EOL;

while ($new_products = tep_db_fetch_array($new_products_query)) { // start loop

$new_prods_content .= '	<li>';
  // the actual content start
  $new_prods_content .= '<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><br /><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a><br />' . $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id']));
         // the actual content end
$new_prods_content .= '</li>' . PHP_EOL;

} // end loop

$new_prods_content .= '</ul>';

 

What you need to do now is, to change the "actual content" part with whatever you want to display, just be careful to make a correct html, you have some not closing tags etc

Link to comment
Share on other sites

  • 1 month later...

thank you this simple comprehensive post, luckily I already wrapped the generation of these blocks in a function call, easy change, I only needed to add the column class to the li element too

KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...