Home | Store | osCommerce Tutorials

osCommerce New Products Display Module Customization Tips (1)

In previous osCommerce New Products Module tutorials, we already learned the web layout and file structure of the New Products Display. We should be able to customize the look and feel of the osCommerce New Products web page.

We will only disucess some general customization tips here.

Change Maximum Number of osCommerce New Products Display

Take a look at the default osCommerce New Products Display area:

osCommerce file structure and New Products web layout

We discussed in previous osCommerce tutorial that the default value of MAX_DISPLAY_NEW_PRODUCTS is 9 and can be modified in the osCommerce Admin area.

Sometimes this is quite tiring to login to osCommerce Adim area to change the data when we are focusing on studying the code structure. We can then define a new variable (MAX_DISPLAY_NEW_PRODUCTS_2) and assign a new value (e.g. 6) to this new variable:

//new contentBoxHeading($info_box_contents);

define ('MAX_DISPLAY_NEW_PRODUCTS_2', 6);

The changing the query criterias to:

order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS_2);

The output of osCommerce New Products Display should look like:

osCommerce New Products customization

PHP example filenew_products_customization_example-1-1.php

Change osCommerce New Products Display Column

The default number of osCommerce New Products Display column is 3. We can change it easily:

1. Change the width from 33% to 50%

2. Change if ($col > 2) { to if ($col > 1) {

$row = 0;
$col = 0;
$info_box_contents = array();
while ($new_products = tep_db_fetch_array($new_products_query)) {

$info_box_contents[$row][$col] = array(

'align' => 'center',

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

$col ++;
if ($col > 1) {
$col = 0;
$row ++;
}
}

The output of osCommerce New Products should display in 2 columns look like:

oscommerce new products customization

PHP example filenew_products_customization_example-1-2.php

This is the end of the osCommerce New Products Display customization tips.