RE: Ordering Products
adamdemerlis <[email protected]>
| Newsgroups | gmane.comp.web.oscommerce.features |
|---|---|
| Message-ID | <da55022dac189cf1d3874e7546e248b7@osCommerce-Forums> |
This message was sent from: Features
http://forums.oscommerce.com/viewtopic.php?p=194996#194996
----------------------------------------------------------------
[code]
<!-- show_random //-->
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
<td>
<?php
if ($random_product = tep_random_select("select products_id, products_image, products_tax_class_id, products_price from " . TABLE_PRODUCTS . " where products_status='1'")) {
$random_product['products_name'] = tep_get_products_name($random_product['products_id']);
$random_product['specials_new_products_price'] = tep_get_products_special_price($random_product['products_id']);
$info_box_contents = array();
$info_box_contents[] = array('align' => 'left',
'text' => 'BOX_HEADING_MAIN_PRODUCTS'
);
new infoBoxHeading($info_box_contents, true, false, tep_href_link(FILENAME_DEFAULT, '', 'NONSSL'));
$random_query = tep_db_query("select products_id, products_image, products_tax_class_id, products_price from " . TABLE_PRODUCTS . " where products_status='1' order by rand() limit 9");
for ($row=0, $info_box_contents = array(); $row < 3;$row++ ) {
for ($col=0; $col < 3; $col++) {
$random_product = tep_db_fetch_array($random_query);
$random_product['products_name'] = tep_get_products_name($random_product['products_id']);
$random_product['specials_new_products_price'] = tep_get_products_special_price($random_product['products_id']);
$info_box_contents[$row][$col] = array('align' => 'center',
'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $random_product['products_image'], $random_product['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id'], 'NONSSL') . '">' . $random_product['products_name'] . '</a><br>' . $rprod_price);
}
}
new contentBoxHeading($info_box_contents);
?>
</td>
</tr>
</table>
<!-- show_random_eof //-->
[/code]
it seems that it says that in line
[code]
$random_query = tep_db_query("select products_id, products_image, products_tax_class_id, products_price from " . TABLE_PRODUCTS . " where products_status='1' order by rand() limit 9");
[/code]
it doesn't expect the '$' and when I take it out is doesn't like that = sign,
any ideas, and thanks so much for this help