Thread: Newest Products
View Single Post
  #208  
Old 04-16-2008, 12:09 PM
  yamiya's Avatar 
yamiya yamiya is offline
 

Member
  
Join Date: Aug 2007
Posts: 24
 

Default Re: Newest Products

I like to modify the code such that I can display entire category in front page.

Anyone knows how to do it?

Quote:
Originally Posted by vulcan-works
PHP Code:
#
# $Id: newest.php 2007/07/22 $
#
// set variables
$daterange 7776000// 60 * 60 * 24 * 90 days in unix time
$nowtime time();
$oldtime $nowtime $daterange ;
 
# Get new products data and store it into $newproducts array
#
if ( !defined('XCART_START') ) { header("Location: home.php"); die("Access denied"); }
#
# Select from products table
#
$user_account['membershipid'] = !empty($user_account['membershipid'])?$user_account['membershipid']:0;
$old_search_data $search_data["products"];
$old_mode $mode;
$old_page $page;
$search_data["products"] = array();
$search_data["products"]["forsale"] = "Y";
$search_data["products"]["avail"] = "> 0";
$search_data["products"]["add_date"] = "> " $oldtime "";
$search_data["products"]["add_date"] = "< " $nowtime "";
$search_data["products"]["sort_condition"] = "$sql_tbl[products].add_date DESC";
$REQUEST_METHOD "GET";
$mode "search";
include 
$xcart_dir."/include/search.php";
$search_data["products"] = $old_search_data;
x_session_save("search_data");
$mode $old_mode;
$page $old_page;
unset(
$old_search_data$old_mode$old_page);
$smarty->clear_assign("newproducts");
$smarty->assign("newproducts",$products);
$search_data '';
$products = array();
unset(
$search_data$products); 


You must add:
Code:
<?php
at the very top of the file
and
Code:
?>
to the end of it for it to work
but other than that great job!
__________________
Yamiya Yam
http://www.yamiya.com.my
---------------------------------------
X-Cart Gold v4.1.8 (UNIX)
Reply With Quote