<?php
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); 
/* Latest Products Module
*
* @version $Id: mod_phpshop_latestprod.php,v 1.4 2004/12/06 21:08:08 soeren_nb Exp $
* @package Mambo_4.5.1
* @subpackage mambo-phpShop
*
* @copyright (C) 2000 - 2004 Mr PHP
// W: www.mrphp.com.au
// E: info@mrphp.com.au
// P: +61 418 436 690
* Conversion to Mambo and the rest:
* 	@copyright (C) 2004 Soeren Eberhardt
*
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
* mambo-phpShop is Free Software.
* mambo-phpShop comes with absolute no warranty.
*
* www.mambo-phpshop.net
*/

global $mosConfig_absolute_path;
/* Load the phpshop main parse code */
require_once( $mosConfig_absolute_path.'/components/com_phpshop/phpshop_parser.php' );

$max_items=2; //maximum number of items to display

require_once( CLASSPATH . 'ps_product.php');
$ps_product = new ps_product;


  $db=new ps_DB;
  $q  = "SELECT DISTINCT product_sku FROM #__pshop_product, #__pshop_product_category_xref, #__pshop_category WHERE ";
  $q .= "product_parent_id=''";
  $q .= "AND #__pshop_product.product_id=#__pshop_product_category_xref.product_id ";
  $q .= "AND #__pshop_category.category_id=#__pshop_product_category_xref.category_id ";
  $q .= "AND #__pshop_product.product_publish='Y' ";
  $q .= "ORDER BY #__pshop_product.product_id DESC ";
  $q .= "LIMIT $max_items ";
  $db->query($q);

  if($db->num_rows()!=0){ ?>
      <table border="0" cellpadding="0" cellspacing="0" width="100%">
        <tr align="center">
          <td>
            <br>
            <?php
            while($db->next_record()){
              $ps_product->show_snapshot($db->f("product_sku"));
              echo "<br /><br />";
            }
            ?>
          </td>
        </tr>
      </table>
      <?php
  }

?>
