Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Recommended Posts

Posted

Hello all!!!

All I've ever learned about coding (HTML and PHP) was "hands on" never read a book or studied lol but I kinda get away with it pretty well...

I am using the "image magic" mod, just to make it clear ( http://www.oscommerce.com/community/contributions,3770 )

anyways I modded the upcoming

catalog/includes/modules/upcoming_products.php

so it would show pictures of the products not only text :) (feel free to use it)

<?php
/*
 $Id: upcoming_products.php,v 1.24 2003/06/09 22:49:59 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 $expected_query = tep_db_query("select p.products_id, pd.products_name, products_image, products_date_available as date_expected from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where to_days(products_date_available) >= to_days(now()) and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by " . EXPECTED_PRODUCTS_FIELD . " " . EXPECTED_PRODUCTS_SORT . " limit " . MAX_DISPLAY_UPCOMING_PRODUCTS);
 if (tep_db_num_rows($expected_query) > 0) {
?>
<!-- upcoming_products //-->
	  <tr>
		<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
		  <tr>
			<td colspan="3"><?php echo tep_draw_separator(); ?></td>
		  </tr>
		  <tr>
			<td colspan="2" class="featuretitle"> <?php echo TABLE_HEADING_UPCOMING_PRODUCTS; ?> </td>
			<td align="right" class="featuretitle"> <?php echo TABLE_HEADING_DATE_EXPECTED; ?> </td>
		  </tr>
		  <tr>
			<td colspan="3"><?php echo tep_draw_separator(); ?></td>
		  </tr>
		  <tr>
<?php
$row = 0;
while ($expected = tep_db_fetch_array($expected_query)) {
  $row++;
  if (($row / 2) == floor($row / 2)) {
	echo '			  <tr class="upcome-even">' . "\n";
  } else {
	echo '			  <tr class="upcome-odd">' . "\n";
  }

  echo '				<td width="40" height="40" align="center" valign="center"><a class="featured" href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $expected['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $expected['products_image'], HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT) . '</a></td>' . "\n" .
	 '				<td class="upcome-odd"><a class="featured" href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $expected['products_id']) . '"> ' . $expected['products_name'] . ' </a></td>' . "\n" .
	   '				<td align="right" class="smallText"> ' . tep_date_short($expected['date_expected']) . ' </td>' . "\n" .
	   '			  </tr>' . "\n";
}
?>
		  <tr>
			<td colspan="3"><?php echo tep_draw_separator(); ?></td>
		  </tr>
		</table></td>
	  </tr>
<!-- upcoming_products_eof //-->
<?php
 }
?>

 

ok here is the most important part of the code (where I have trouble):

<?php
$row = 0;
while ($expected = tep_db_fetch_array($expected_query)) {
  $row++;
  if (($row / 2) == floor($row / 2)) {
	echo '			  <tr class="upcome-even">' . "\n";
  } else {
	echo '			  <tr class="upcome-odd">' . "\n";
  }

  echo '				<td width="40" height="40" align="center" valign="center"><a class="featured" href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $expected['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $expected['products_image'], HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT) . '</a></td>' . "\n" .
	 '				<td class="upcome-odd"><a class="featured" href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $expected['products_id']) . '"> ' . $expected['products_name'] . ' </a></td>' . "\n" .
	   '				<td align="right" class="smallText"> ' . tep_date_short($expected['date_expected']) . ' </td>' . "\n" .
	   '			  </tr>' . "\n";
}
?>

 

and it returns:

!-- upcoming_products //-->
	  <tr>
		<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
		  <tr>
			<td colspan="3"><img src="images/pixel_black.gif" width="100%" height="1" border="0" alt=""></td>
		  </tr>
		  <tr>

			<td colspan="2" class="featuretitle"> Upcoming Products </td>
			<td align="right" class="featuretitle"> Date Expected </td>
		  </tr>
		  <tr>
			<td colspan="3"><img src="images/pixel_black.gif" width="100%" height="1" border="0" alt=""></td>
		  </tr>
		  <tr>
		  <tr class="upcome-odd">

			<td width="40" height="40" align="center" valign="center"><a class="featured" href="http://www.brazilianhotstuff.com/product_info.php?products_id=31&osCsid=b145288071621e786250601e92658426"><img src="imagemagic.php?img=1q%2BzqL%2B8e6yiwMfV4LS7g7C2lQ%3D%3D&w=40&h=32&page=" width="40" height="32" border="0" alt="57" title="57"></a></td>
			<td class="upcome-odd"><a class="featured" href="http://www.brazilianhotstuff.com/product_info.php?products_id=31&osCsid=b145288071621e786250601e92658426"> Brazil Car Flag </a></td>
			<td align="right" class="smallText"> 03/17/2006 </td>
		  </tr>
		  <tr>
			<td colspan="3"><img src="images/pixel_black.gif" width="100%" height="1" border="0" alt=""></td>
		  </tr>

		</table></td>
	  </tr>
<!-- upcoming_products_eof //-->

the problem is that Image Magic does it's work and makes a thumbnail (wich is what I wanted) but here:

				<td width="40" height="40" align="center" valign="center"><a class="featured" href="http://www.brazilianhotstuff.com/product_info.php?products_id=31&osCsid=b145288071621e786250601e92658426"><img src="imagemagic.php?img=1q%2BzqL%2B8e6yiwMfV4LS7g7C2lQ%3D%3D&w=40&h=32&page=" width="40" height="32" border="0" alt="57" title="57"></a></td>

 

as you can see it gives me

width="40" height="32" border="0" alt="57" title="57"

where does it get all of these values from?

 

because

HEADING_IMAGE_WIDTH = 57

HEADING_IMAGE_HEIGHT = 40

 

and it uses the HEADING_IMAGE_HEIGHT (40) as width... and it figures out the width according to the image dimentions...

but than it gets even more wierd .... HEADING_IMAGE_WIDTH (57) as alt and title (alt="57" title="57")

 

what am I doing wrong? if i am not even calling an "alt" value neither a "title" and whats up with the dimmentions... I dont care much about the dimentions as they are ok being this small my main concern is leaving the "alt" and the "title" blank

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...