Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Displaying random single products on the main page


mark27uk3

Recommended Posts

Hi Guys,

 

I am using a contrib to display single random products on the main page but I need the description on the left with the heading above it and the image on the right.

 

Has anyone used and/or modified it?

 

Forgot to mention that the image size is defined in the code and not pulled from osc, is it possible to change this?

 

this is the code

 

<?
?$product_info = tep_db_query("select p.products_id, 

pd.products_name, pd.products_description, p.products_model, 

p.products_quantity, p.products_image, pd.products_url, 

p.products_price, p.products_tax_class_id, p.products_date_added, 

p.products_date_available, p.manufacturers_id from " . 

TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . 

$HTTP_GET_VARS['products_id'] . "' and pd.products_id = '" . 

$HTTP_GET_VARS['products_id'] . "'and pd.language_id = '" . $languages_id . "'");
? ?$new_products_query = tep_db_query("select 

substring(pd.products_description, 1, 598) as 

products_description, ?p.products_id, p.products_image, p.manufacturers_id, p.products_tax_class_id 

from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = 

pd.products_id and p.products_status = '1' and 

pd.products_description != '' order by rand() DESC limit " . 

'2');
$new_products = tep_db_fetch_array($new_products_query);
? ? ? ? ?$new_products['products_name'] = 

tep_get_products_name($new_products['products_id']);
? ? 
?>
<div align="center">
?<center>
<table border="1" cellpadding="20" cellspacing="0" 

style="border-collapse: collapse" width="100%" 

bordercolor="#000000" id="AutoNumber1">
?<tr>
? ?<td>
<table border="0" cellpadding="0" cellspacing="0" 

style="border-collapse: collapse" bordercolor="#2799E2" 

id="AutoNumber1">
?<tr>
? ?<td>
<div align="center">
?<center>
<table border="0" cellpadding="0" cellspacing="0" 

style="border-collapse: collapse" bordercolor="#111111" 

id="AutoNumber2">
?<tr>
? ?<td align="right"><div align="right">
?<center>
? ?<table border="0" width="100%" cellpadding="0" 

cellspacing="0" style="border-collapse: collapse" 

bordercolor="#111111" id="AutoNumber1">
? ? ?<tr>
? ? ? ?<td class="main">
? ? ? ?<?
? ? ? ?echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 

'products_id=' . $new_products['products_id']) . '">' . 

$new_products['products_name'] . '</a>';
?></td>
? ? ? ?<td align="right"><table border="0" cellpadding="0" 

cellspacing="0" style="border-collapse: collapse" 

bordercolor="#111111">
? ? ? ? ? ? ? ? ? ? ? ? ? ?<tr>
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?<td><?php echo '<a href="' . 

tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . 

$new_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . 

$new_products['products_image'], 'Newest Anime', 210, 138) . 

'</a>'; ?></td>
? ? ? ? ? ? ? ? ? ? ? ? ? ?</tr>
? ? ? ? ? ? ? ? ? ? ? ? ?</table>
</td>
? ? ?</tr>
? ?</table>
? ?</center>
</div>
? ?</td>
?</tr>
?<tr>
? ?<td class="main">
<? ?echo $new_products['products_description'] 
?>

...<a href="
<?
echo tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']);
?>
"<br><br><br>More Info</a>
</td></tr></table>

</center>
</div>
</td>
? ? ?</tr>
? ?</table>
</td>
?</tr>
</table>
</center>
</div>

 

Any help would be appreciated.

 

Thanks

 

Mark

Lifes a bitch, then you marry one, then you die!

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...