Ordering Products
adamdemerlis <[email protected]>
| Newsgroups | gmane.comp.web.oscommerce.features |
|---|---|
| Message-ID | <e534955d22a14f3c7ffbd54641c64cc3@osCommerce-Forums> |
This message was sent from: Features
http://forums.oscommerce.com/viewtopic.php?p=194914#194914
----------------------------------------------------------------
I am trying to order a set of random images (3 by 3) in a box on my main page. As of now it seems that one random image is being displayed but I can't make it work in 3 by 3 fashion. This is what I have so far -
[code]<?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' limit " . MAX_RANDOM_SELECT_NEW)) {
$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'));
if ($random_product['specials_new_products_price']) {
$rprod_price = '<s>' . $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</s><br>';
$rprod_price .= '<span class="productSpecialPrice">' . $currencies->display_price($random_product['specials_new_products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</span>';
} else {
$rprod_price = $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id']));
}
$row = 0;
$col = 0;
$info_box_contents = array();
$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);
$col ++;
if ($col > 2) {
$col = 3;
$row ++;
}
new infoBox($info_box_contents);
}
?>
[/code]
If any one knows how to fix this I would appreciate it.
Thanks,