Update of /pack/cvsroots/oscommerce/catalog/catalog/includes/boxes
In directory sunsite.dk:/tmp/cvs-serv13263
Modified Files:
whats_new.php
Log Message:
use the new database class
Index: whats_new.php
===================================================================
RCS file:
/pack/cvsroots/oscommerce/catalog/catalog/includes/boxes/whats_new.php,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- whats_new.php 2003/12/18 23:52:14 1.33
+++ whats_new.php 2004/02/16 07:26:55 1.34
@@ -5,35 +5,38 @@
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
- Copyright (c) 2003 osCommerce
+ Copyright (c) 2004 osCommerce
Released under the GNU General Public License
*/
- if ($random_product = tep_random_select("select products_id, products_image,
products_tax_class_id, products_price from " . TABLE_PRODUCTS . " where
products_status = '1' order by products_date_added desc limit " .
MAX_RANDOM_SELECT_NEW)) {
+ $Qwhatsnew = $osC_Database->query('select products_id, products_image,
products_tax_class_id, products_price from :table_products where
products_status = 1 order by products_date_added desc limit
:max_random_select_new');
+ $Qwhatsnew->bindRaw(':table_products', TABLE_PRODUCTS);
+ $Qwhatsnew->bindInt(':max_random_select_new', MAX_RANDOM_SELECT_NEW);
+
+ if ($Qwhatsnew->executeRandomMulti()) {
?>
<!-- whats_new //-->
<tr>
<td>
<?php
- $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']);
+ $products_name =
tep_get_products_name($Qwhatsnew->valueInt('products_id'));
+ $specials_price =
tep_get_products_special_price($Qwhatsnew->valueInt('products_id'));
$info_box_contents = array();
$info_box_contents[] = array('text' => BOX_HEADING_WHATS_NEW);
new infoBoxHeading($info_box_contents, false, false,
tep_href_link(FILENAME_PRODUCTS_NEW));
- if (tep_not_null($random_product['specials_new_products_price'])) {
- $whats_new_price = '<s>' .
$osC_Currencies->displayPrice($random_product['products_price'],
$random_product['products_tax_class_id']) . '</s><br>';
- $whats_new_price .= '<span class="productSpecialPrice">' .
$osC_Currencies->displayPrice($random_product['specials_new_products_price'],
$random_product['products_tax_class_id']) . '</span>';
- } else {
- $whats_new_price =
$osC_Currencies->displayPrice($random_product['products_price'],
$random_product['products_tax_class_id']);
+ $products_price =
$osC_Currencies->displayPrice($Qwhatsnew->valueDecimal('products_price'),
$Qwhatsnew->valueInt('products_tax_class_id'));
+
+ if (tep_not_null($specials_price)) {
+ $products_price = '<s>' . $products_price . '</s> <span
class="productSpecialPrice">' . $osC_Currencies->displayPrice($specials_price,
$Qwhatsnew->valueInt('products_tax_class_id')) . '</span>';
}
$info_box_contents = array();
$info_box_contents[] = 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']) . '">' . $random_product['products_name'] .
'</a><br>' . $whats_new_price);
+ 'text' => '<a href="' .
tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' .
$Qwhatsnew->valueInt('products_id')) . '">' . tep_image(DIR_WS_IMAGES .
$Qwhatsnew->value('products_image'), $products_name, SMALL_IMAGE_WIDTH,
SMALL_IMAGE_HEIGHT) . '</a><br><a href="' .
tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' .
$Qwhatsnew->valueInt('products_id')) . '">' . $products_name . '</a><br>' .
$products_price);
new infoBox($info_box_contents);
?>
@@ -41,5 +44,6 @@
</tr>
<!-- whats_new_eof //-->
<?php
+ $Qwhatsnew->freeResult();
}
?>
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
|