Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Resize image on New product section only


Duket

Recommended Posts

Hi dose anyone know how to resized the image in the New Product section only?; I do not wish to change all the small image size so the admin panel option is out; try to change the new_product.php scrip but can't get it right; anyone can help on this?

Link to comment
Share on other sites

Are you talking about the pic in the box or the listing displayed on the index page by default?

 

But either way, the function that displays the image is always tep_image() and there are added two parameters SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT. If you replace them with the values for height and witdh you should be good to go. Omit one of the values and the aspect ratio of the pics will remain intact.

Link to comment
Share on other sites

Are you talking about the pic in the box or the listing displayed on the index page by default?

 

But either way, the function that displays the image is always tep_image() and there are added two parameters SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT. If you replace them with the values for height and witdh you should be good to go. Omit one of the values and the aspect ratio of the pics will remain intact.

 

 

I did it on the include/modules/new_product.php on line 33 where I change from SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT to width="xx" height= "xx" but I got an error msgs. I'm talking about the pic right below the welcom msgs in the new product section. have any idea where I went wrong?

Link to comment
Share on other sites

Those constant are just numbers when they are translated. The function tep_image awaits just numbers there, since internally the width= and height= are already set. Just the number are added to it. Give it a try.

 

 

Well; here is what I did maybe you can tell me where I went wrong; again I mod the catalog/include/module/new_product.php to this : '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'], IMAGE_WIDTH= "300", 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'])));

 

upload it and this is what I get: Parse error: syntax error, unexpected '=' in /home/thephoen/public_html/store/catalog/includes/modules/new_products.php on line 33

 

I'd left the height open; usually that shouldn't matter. because it's the width I want to control.

Link to comment
Share on other sites

As I said, just numbers....

 

tep_image(DIR_WS_IMAGES . $new_products['products_image'], $new_products['products_name'], "300", "")

 

Maybe without the double quotes, don't know just out of the pocket.

 

No; try that didn't work; the error msgs indicate the problem is "=" sign; so the scrip must be wrong. anyone knows how to write a right scrip on this?

Link to comment
Share on other sites

I can only repeat it. I've modded this function calls myself dozens of times. The supplied arguments are just numbers. If you made the changes the way I mentioned, there can't be an error message pointing to a '=' cause there is none...

 

Show me the whole part of code again that you tried.

Link to comment
Share on other sites

I can only repeat it. I've modded this function calls myself dozens of times. The supplied arguments are just numbers. If you made the changes the way I mentioned, there can't be an error message pointing to a '=' cause there is none...

 

Show me the whole part of code again that you tried.

 

 

here is the code

 

// 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, 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.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();

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

$new_products['products_name'] = tep_get_products_name($new_products['products_id']);

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

'params' => 'class="smallText" width="33%" 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'], WIDTH = '300', 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 > 2) {

$col = 0;

$row ++;

}

}

 

new contentBox($info_box_contents);

?>

 

and here is the site: https://host483.ipowerweb.com/~thephoen/sto...1ea966870a21cb6

as you can see the image is pretty small; I'd like to enlarge it but just this one alone without changing any others.

Thanks!

Link to comment
Share on other sites

I said just put the numbers in there instead of the constants. No WIDTH= or HEIGHT=. The function automatically generates those parameters.

 

// 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, 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.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();
while ($new_products = tep_db_fetch_array($new_products_query)) {
$new_products['products_name'] = tep_get_products_name($new_products['products_id']);
$info_box_contents[$row][$col] = array('align' => 'center',
'params' => 'class="smallText" width="33%" 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'], '300', '') . '</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 > 2) {
$col = 0;
$row ++;
}
}

new contentBox($info_box_contents);
?>

Link to comment
Share on other sites

I said just put the numbers in there instead of the constants. No WIDTH= or HEIGHT=. The function automatically generates those parameters.

 

// 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, 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.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();
while ($new_products = tep_db_fetch_array($new_products_query)) {
$new_products['products_name'] = tep_get_products_name($new_products['products_id']);
$info_box_contents[$row][$col] = array('align' => 'center',
'params' => 'class="smallText" width="33%" 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'], '300', '') . '</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 > 2) {
$col = 0;
$row ++;
}
}

new contentBox($info_box_contents);
?>

 

 

How stupid of me; thanks; still having the habit of html. thanks again.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...