mark27uk3 Posted April 16, 2005 Posted April 16, 2005 Hi Guys, I am now on with modifying the upcoming_products module and have hit a little snag! :( I have managed to add a price column but for some reason the price shows up as 12.9900 instead of just 12.99, also does anyone know how I can get the currency symbol to show in front of the price. This is the code <?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_price, 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><br><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="comingsoon"> <b><?php echo TABLE_HEADING_UPCOMING_PRODUCTS; ?> </b></td> <td align="center" class="comingsoon"> <b><?php echo 'Price' ?> </b></td> <td align="right" class="comingsoon"> <b><?php echo TABLE_HEADING_DATE_EXPECTED; ?> </b></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="upcomingProducts-even">' . "\n"; } else { echo ' <tr class="upcomingProducts-odd">' . "\n"; } echo ' <td class="smallText"> <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $expected['products_id']) . '">' . $expected['products_name'] . '</a> </td>' . "\n" . ' <td align="center" class="smallText"> ' . $expected['products_price'] . ' </td>' . "\n" . ' <td align="right" class="smallText"> ' . tep_date_short($expected['date_expected']) . ' </td>' . "\n" . ' </tr>' . "\n"; } ?> </table></td> </tr> <!-- upcoming_products_eof //--> <?php } ?> After this is sorted I will be adding another column with a link that says 'view details >>' but one step at a time eh? Thanks Mark :thumbsup: Lifes a bitch, then you marry one, then you die!
mark27uk3 Posted April 17, 2005 Author Posted April 17, 2005 Hi, I have managed to get the price to display without the extra 00 on the end of it but now I am getting this error. Warning: Missing argument 2 for display_price() in /home2/mobiacc/public_html/includes/classes/currencies.php on line 71 This is the code I am now using to display the price echo ' <td class="smallText"> <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $expected['products_id']) . '">' . $expected['products_name'] . '</a> </td>' . "\n" . ' <td align="center" class="smallText"> ' . $currencies->display_price($expected['products_price']) . ' </td>' . "\n" . ' <td align="right" class="smallText"> ' . tep_date_short($expected['date_expected']) . ' </td>' . "\n" . ' </tr>' . "\n"; Can anyone see why I would be getting this error, maybe I have missed something off from the database query but I am just not sure. Please help chaps! :'( Thanks Mark Lifes a bitch, then you marry one, then you die!
mark27uk3 Posted April 17, 2005 Author Posted April 17, 2005 I have managed sort this one out, I should have added this line to the database query. p.products_tax_class_id and then changed the code accordingly to this. echo ' <td class="smallText"> <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $expected['products_id']) . '">' . $expected['products_name'] . '</a> </td>' . "\n" . ' <td align="center" class="smallText"> ' . $currencies->display_price($expected['products_price'], tep_get_tax_rate($expected['products_tax_class_id'])) . ' </td>' . "\n" . ' <td align="right" class="smallText"> ' . tep_date_short($expected['date_expected']) . ' </td>' . "\n" . ' </tr>' . "\n"; I am getting better at this everyday! :blink: Mark Lifes a bitch, then you marry one, then you die!
Recommended Posts
Archived
This topic is now archived and is closed to further replies.