Thread: Newest Products
View Single Post
  #65  
Old 10-01-2004, 05:22 PM
  finestshops's Avatar 
finestshops finestshops is offline
 

eXpert
  
Join Date: Oct 2002
Location: Toronto, Canada
Posts: 335
 

Default

Quote:
Originally Posted by mizzlewillz
Also, when working with this mod in 4.0.4 instead of a price it says "enter a price!" I know someone besides me has had this problem, but did anyone find a solution to that.
-Mike

Hi there,

Here is modified newest.php which works in 4.0.4 and shows the price and loads images from server, not via image.php

Code:
<? # # $Id: newest.php by FS (based on featured_products.php and newest.php by funkydunk), v 1.2.2.3m 2004/10/01 Exp $ // set variables $daterange = 604800; // 60 * 60 * 24 * 7 days in unix time $nowtime = time(); $oldtime = $nowtime - $daterange ; # # Get newest products data and store it into $newproducts array # if ( !defined('XCART_START') ) { header("Location: home.php"); die("Access denied"); } # # select from products table # $membership = !empty($user_account['membership'])?$user_account['membership']:""; $f_cat = (empty ($cat) ? "0" : $cat); if ($config["General"]["unlimited_products"]=="N" && $config["General"]["disable_outofstock_products"]) $avail_condition = "($sql_tbl[products].avail>0 OR $sql_tbl[products].product_type='C') and "; else $avail_condition = ""; // $newproducts = func_query("SELECT $sql_tbl[products].*, min($sql_tbl[pricing].price) as price FROM $sql_tbl[products], $sql_tbl[products] USE INDEX (pacpo), $sql_tbl[pricing] WHERE $sql_tbl[products].productid=$sql_tbl[featured_products].productid and $sql_tbl[pricing].productid=$sql_tbl[products].productid and $sql_tbl[products].forsale='Y' and $avail_condition $sql_tbl[featured_products].avail='Y' and $sql_tbl[pricing].quantity=1 AND $sql_tbl[pricing].variantid = 0 AND $sql_tbl[featured_products].categoryid='$f_cat' and ($sql_tbl[pricing].membership='$membership' or $sql_tbl[pricing].membership='') GROUP BY $sql_tbl[products].productid ORDER BY $sql_tbl[featured_products].product_order"); $query = "SELECT * FROM $sql_tbl[products],$sql_tbl[pricing] WHERE forsale='Y' AND avail>0 AND $sql_tbl[pricing].productid=$sql_tbl[products].productid AND add_date > " . $oldtime . " AND add_date < " . $nowtime . " ORDER BY xcart_products.productID DESC LIMIT 0,6 "; $newproducts = func_query($query); if(is_array($newproducts)){ foreach($newproducts as $f_v => $f_k){ $int_res = ''; if(is_array($f_k)){ if(!empty($active_modules['Product_Options'])) { $tmp_price = func_get_price_default_variant($newproducts[$f_v]['productid'], @$user_account['membership']); if ($tmp_price) $newproducts[$f_v]["price"] = $tmp_price; } # # Get thumbnail's URL (uses only if images stored in FS) # $newproducts[$f_v]["tmbn_url"] = func_get_thumbnail_url($newproducts[$f_v]["productid"]); # # Recalculate prices if VAT is enabled and prices do not includes VAT # $newproducts[$f_v]["taxes"] = func_get_product_taxes($newproducts[$f_v], $login); # # Check if product have product options # if(!empty($active_modules['Product_Options'])) { $newproducts[$f_v]["product_options"] = func_query_first_cell("SELECT COUNT(*) FROM $sql_tbl[classes] WHERE productid='".$f_k["productid"]."'"); } # # Replace descr and fulldescr on international (if defined) # $int_res = func_query_first("SELECT * FROM $sql_tbl[products_lng] WHERE code='$store_language' AND productid='".$f_k['productid']."'"); if (!empty($int_res["product"])) { $newproducts[$f_v]["product"] = stripslashes($int_res["product"]); } if (!empty($int_res["descr"])) { $newproducts[$f_v]["descr"] = str_replace("\n"," ", stripslashes($int_res["descr"])); } if (!empty($int_res["full_descr"])) { $newproducts[$f_v]["fulldescr"] = str_replace("\n"," ", stripslashes($int_res["full_descr"])); } if ($newproducts[$f_v]["descr"] == strip_tags($newproducts[$f_v]["descr"])) $newproducts[$f_v]["descr"] = str_replace("\n", " ", $newproducts[$f_v]["descr"]); if ($newproducts[$f_v]["fulldescr"] == strip_tags($newproducts[$f_v]["fulldescr"])) $newproducts[$f_v]["fulldescr"] = str_replace("\n", " ", $newproducts[$f_v]["fulldescr"]); } } }; if (!empty($active_modules["Subscriptions"])) { include_once $xcart_dir."/modules/Subscriptions/subscription.php"; } $smarty->assign("newproducts",$newproducts); // give the product array to smarty to make it available sitewide. $smarty->assign("newproducts",$newproducts); ?>

Example is here:

http://www.shopping-carts-upgrades.com/store/



Enjoy,
__________________
Best regards,

Anton Pachkine
finestshops.com/x-cart
Reply With Quote