Quote:
Originally Posted by enge919
Have any idea what to change in the script to get it to work properly with 4.0.3?
|
Change specials.php to this one:
Code:
<?
#
# $Id: specials.php by FS based on featured_products.php,v 1.2.2.3 2004/09/09 12:12:41 max Exp $
# specials mod idea by funkydunk
# Get featured products data and store it into $specials 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 = "";
$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 price < list_price ORDER BY RAND() LIMIT 6 ";
$specials = func_query($query);
if(is_array($specials)){
foreach($specials 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($specials[$f_v]['productid'], @$user_account['membership']);
if ($tmp_price)
$specials[$f_v]["price"] = $tmp_price;
}
#
# Get thumbnail's URL (uses only if images stored in FS)
#
$specials[$f_v]["tmbn_url"] = func_get_thumbnail_url($specials[$f_v]["productid"]);
#
# Recalculate prices if VAT is enabled and prices do not includes VAT
#
$specials[$f_v]["taxes"] = func_get_product_taxes($specials[$f_v], $login);
#
# Check if product have product options
#
if(!empty($active_modules['Product_Options'])) {
$specials[$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"])) {
$specials[$f_v]["product"] = stripslashes($int_res["product"]);
}
if (!empty($int_res["descr"])) {
$specials[$f_v]["descr"] = str_replace("\n","
", stripslashes($int_res["descr"]));
}
if (!empty($int_res["full_descr"])) {
$specials[$f_v]["fulldescr"] = str_replace("\n","
", stripslashes($int_res["full_descr"]));
}
if ($specials[$f_v]["descr"] == strip_tags($specials[$f_v]["descr"]))
$specials[$f_v]["descr"] = str_replace("\n", "
", $specials[$f_v]["descr"]);
if ($specials[$f_v]["fulldescr"] == strip_tags($specials[$f_v]["fulldescr"]))
$specials[$f_v]["fulldescr"] = str_replace("\n", "
", $specials[$f_v]["fulldescr"]);
}
}
};
if (!empty($active_modules["Subscriptions"])) {
include_once $xcart_dir."/modules/Subscriptions/subscription.php";
}
$smarty->assign("specials",$specials);
?>
Example:
http://www.shopping-carts-upgrades.com/
