Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Recommended Posts

Posted

I recently started working on converting the upcoming, and what's new into infoboxes comprised of lists rather than images (dev2.districtgames.com)

 

coming soon worked fine (I used scraps from another contribution, and used the default query from the upcoming_products.php module).

 

However, my now_shipping box is kinda screwy. Basically I want to display a list of the most recently added products, link them to their product info page, and display the price. However instead of getting the most recent, it gives me random products, and some even blank. I don't want it to show products that I don't have in stock (basically any product thats "upcoming" should be excluded, since it's not shipping yet), and I don't want it to show random products (i.e. the list should be static, and only show the 10 most recently added). Another problem is the price, it's displayed as 59.990, and it's not displaying individual prices.

 

I'm kinda lost, and really need some help if possible. Heres the code:

<?php
/*
 $Id: now_shipping.php 1739 2007-12-20 00:52:16Z hpdl $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

$now_shipping_query = tep_db_query("select products_description.products_id, products_description.products_name, products_price from " . TABLE_PRODUCTS . ', ' . TABLE_PRODUCTS_DESCRIPTION . " where products_date_added <= current_date order by products_date_added desc limit 10");
?>
<!-- now_shipping //-->

<?php

$now_shipping_list = '<table border="0" width="100%" cellspacing="0" cellpadding="1">';
 	$row = 0;
   while ($nowshipping = tep_db_fetch_array($now_shipping_query)) {
     $row++;
     if (($row / 2) == floor($row / 2)) {
       $now_shipping_list .= '<tr class="nowShipping-even">' . "\n";
     } else {
       $now_shipping_list .= '<tr class="nowShipping-odd">' . "\n";
     }
	$now_shipping_list .= '<td class="supersmallText"> <a href="' 
     . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $nowshipping['products_id']) . '">' 
     . $nowshipping['products_name'] . '</a> </td>' . "\n" . '<td align="right" class="supersmallText"> ' 
     . $nowshipping['products_price'] . ' </td>' . "\n" . '</tr>' . "\n";
   }
  	$now_shipping_list .= '</table>';

   $info_box_contents = array();
   $info_box_contents[] = array('text' => $now_shipping_list);

   new infoBox($info_box_contents);
?>

<!-- now_shipping_eof //-->

 

Any help would be appreciated.

Posted

so, it appears to be trying to spit out the results 3 times

td class="boxText"><table border="0" width="100%" cellspacing="0" cellpadding="0"><tr class="nowShipping-odd">
<td class="supersmallText"> <a href="http://dev2.districtgames.com/product_info.php?products_id=34">Dragon's Age: Awakening</a> </td>
<td align="right" class="supersmallText"> 59.9900 </td>
</tr>
<tr class="nowShipping-even">
<td class="supersmallText"> <a href="http://dev2.districtgames.com/product_info.php?products_id=34"></a> </td>
<td align="right" class="supersmallText"> 59.9900 </td>
</tr>
<tr class="nowShipping-odd">
<td class="supersmallText"> <a href="http://dev2.districtgames.com/product_info.php?products_id=34"></a> </td>
<td align="right" class="supersmallText"> 59.9900 </td>

</tr>
<tr class="nowShipping-even">
<td class="supersmallText"> <a href="http://dev2.districtgames.com/product_info.php?products_id=33">God of War 3</a> </td>
<td align="right" class="supersmallText"> 49.9900 </td>
</tr>
<tr class="nowShipping-odd">
<td class="supersmallText"> <a href="http://dev2.districtgames.com/product_info.php?products_id=33"></a> </td>
<td align="right" class="supersmallText"> 49.9900 </td>
</tr>
<tr class="nowShipping-even">
<td class="supersmallText"> <a href="http://dev2.districtgames.com/product_info.php?products_id=33"></a> </td>
<td align="right" class="supersmallText"> 49.9900 </td>
</tr>

<tr class="nowShipping-odd">
<td class="supersmallText"> <a href="http://dev2.districtgames.com/product_info.php?products_id=32">Star Ocean: The Last Hope</a> </td>
<td align="right" class="supersmallText"> 59.9900 </td>
</tr>
<tr class="nowShipping-even">
<td class="supersmallText"> <a href="http://dev2.districtgames.com/product_info.php?products_id=32"></a> </td>
<td align="right" class="supersmallText"> 59.9900 </td>
</tr>
<tr class="nowShipping-odd">
<td class="supersmallText"> <a href="http://dev2.districtgames.com/product_info.php?products_id=32"></a> </td>
<td align="right" class="supersmallText"> 59.9900 </td>
</tr>
<tr class="nowShipping-even">

<td class="supersmallText"> <a href="http://dev2.districtgames.com/product_info.php?products_id=31">Demon's Souls</a> </td>
<td align="right" class="supersmallText"> 59.9900 </td>
</tr>
<tr class="nowShipping-odd">
<td class="supersmallText"> <a href="http://dev2.districtgames.com/product_info.php?products_id=31"></a> </td>
<td align="right" class="supersmallText"> 59.9900 </td>
</tr>
<tr class="nowShipping-even">
<td class="supersmallText"> <a href="http://dev2.districtgames.com/product_info.php?products_id=31"></a> </td>
<td align="right" class="supersmallText"> 59.9900 </td>
</tr>
<tr class="nowShipping-odd">
<td class="supersmallText"> <a href="http://dev2.districtgames.com/product_info.php?products_id=30">Dragon Age: Origins</a> </td>

<td align="right" class="supersmallText"> 59.9900 </td>
</tr>
<tr class="nowShipping-even">
<td class="supersmallText"> <a href="http://dev2.districtgames.com/product_info.php?products_id=30"></a> </td>
<td align="right" class="supersmallText"> 59.9900 </td>
</tr>
<tr class="nowShipping-odd">
<td class="supersmallText"> <a href="http://dev2.districtgames.com/product_info.php?products_id=30"></a> </td>
<td align="right" class="supersmallText"> 59.9900 </td>
</tr>
<tr class="nowShipping-even">
<td class="supersmallText"> <a href="http://dev2.districtgames.com/product_info.php?products_id=29">Valkyria Chronicles</a> </td>
<td align="right" class="supersmallText"> 19.9900 </td>

</tr>
<tr class="nowShipping-odd">
<td class="supersmallText"> <a href="http://dev2.districtgames.com/product_info.php?products_id=29"></a> </td>
<td align="right" class="supersmallText"> 19.9900 </td>
</tr>
<tr class="nowShipping-even">
<td class="supersmallText"> <a href="http://dev2.districtgames.com/product_info.php?products_id=29"></a> </td>
<td align="right" class="supersmallText"> 19.9900 </td>
</tr>
<tr class="nowShipping-odd">
<td class="supersmallText"> <a href="http://dev2.districtgames.com/product_info.php?products_id=28">Final Fantasy XIII</a> </td>
<td align="right" class="supersmallText"> 59.9900 </td>
</tr>

<tr class="nowShipping-even">
<td class="supersmallText"> <a href="http://dev2.districtgames.com/product_info.php?products_id=28"></a> </td>
<td align="right" class="supersmallText"> 59.9900 </td>
</tr>

 

lost ;/

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...