Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Newest Products

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #211  
Old 04-23-2008, 01:14 PM
 
flawfulfibers flawfulfibers is offline
 

Member
  
Join Date: Mar 2008
Posts: 10
 

Default Re: Newest Products

Anyone have any ideas? PLEASE???

here's one of the messages that I get:

[22-Apr-2008 23:46:20] (shop: 23-Apr-2008 00:46:20) SQL error:
Site :
http://www.flawfulfibers.com
Remote IP : 82.165.28.150
Logged as :
SQL query : SELECT xcart_products.productid, IF(xcart_products_lng.productid != '', xcart_products_lng.product, xcart_products.product) as product, xcart_products.productcode, xcart_products.avail, xcart_products.min_amount, xcart_pricing.price, xcart_quick_prices.variantid, IFNULL(xcart_variants.avail, xcart_products.avail) as avail, IFNULL(xcart_variants.weight, xcart_products.weight) as weight, IFNULL(xcart_variants.productcode, xcart_products.productcode) as productcode, IF(xcart_classes.classid IS NULL,'','Y') as is_product_options, IF(xcart_variants.variantid IS NULL,'','Y') as is_variant, IF(xcart_images_T.id IS NULL, '', 'Y') as is_thumbnail, xcart_images_T.image_path, xcart_product_taxes.taxid FROM xcart_pricing, xcart_products LEFT JOIN xcart_products_lng ON xcart_products.productid = xcart_products_lng.productid AND code = 'US' LEFT JOIN xcart_quick_prices ON xcart_quick_prices.productid = xcart_products.productid AND xcart_quick_prices.membershipid = '0' LEFT JOIN xcart_product_memberships ON xcart_product_memberships.productid = xcart_products.productid LEFT JOIN xcart_classes ON xcart_classes.productid = xcart_products.productid LEFT JOIN xcart_variants ON xcart_variants.productid = xcart_products.productid AND xcart_quick_prices.variantid = xcart_variants.variantid LEFT JOIN xcart_images_T ON xcart_images_T.id = xcart_products.productid LEFT JOIN xcart_product_taxes ON xcart_product_taxes.productid = xcart_products.productid INNER JOIN xcart_products_categories ON xcart_products_categories.productid = xcart_products.productid INNER JOIN xcart_categories ON xcart_categories.categoryid = xcart_products_categories.categoryid AND xcart_categories.avail = 'Y' LEFT JOIN xcart_category_memberships ON xcart_category_memberships.categoryid = xcart_categories.categoryid WHERE (xcart_category_memberships.membershipid = '' OR xcart_category_memberships.membershipid IS NULL) AND xcart_products.forsale='Y' AND (xcart_product_memberships.membershipid = '' OR xcart_product_memberships.membershipid IS NULL) AND xcart_quick_prices.priceid = xcart_pricing.priceid AND xcart_products.productid = xcart_products_categories.productid AND xcart_products_categories.categoryid = xcart_categories.categoryid AND xcart_products.productid = xcart_pricing.productid AND xcart_pricing.quantity = '1' AND xcart_pricing.membershipid = '0' AND xcart_products.product_type <> 'C' AND xcart_products.forsale <> 'B' AND (xcart_pricing.variantid = '0' OR xcart_variants.variantid = xcart_pricing.variantid) AND (IFNULL(xcart_variants.avail, xcart_products.avail) > '0' OR xcart_products.product_type NOT IN ('','N')) AND xcart_products.avail > 0 AND add_date > 1208321180 AND add_date < 1208925980 GROUP BY xcart_products.productid ORDER BY xcart_products.http://www.thoseguysfilms.com/forums/templates/subSilver/images/timuji/ogu/ asc LIMIT 600
Error code : 1064
Description : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '://www.thoseguysfilms.com/forums/templates/subSilver/images/timuji/ogu/ asc LIMI' at line 1 Request URI: /newproducts.php?days=7&sortby=http%3A%2F%2Fwww.tho seguysfilms.com%2Fforums%2Ftemplates%2FsubSilver%2 Fimages%2Ftimuji%2Fogu%2F&sortdirection=1
Backtrace: /home/flawfulf/public_html/include/func/func.db.php:180
/home/flawfulf/public_html/include/func/func.db.php:106
/home/flawfulf/public_html/include/func/func.db.php:322
/home/flawfulf/public_html/include/func/func.product.php:579
/home/flawfulf/public_html/newproducts.php:113
-------------------------------------------------

and here's the newproducts.php file that I have:

Code:
<? #+-----------------------------------------------------------------------------+ #| New Products add-on | #| Copyright (c) 2007 James Carpenter <jamesc@unconventionallapidarist.com> | #| All rights reserved. | #+-----------------------------------------------------------------------------+ # # $Id: newproducts.php,v 2.0.1 2007/07/07 12:30:00 jfc Exp $ # define('OFFERS_DONT_SHOW_NEW',1); require "./auth.php"; # This sets the default number of days to search for new products $default_days = 7; # WCM - CDSEO Links # include WebsiteCM CDSEO if it exists if (file_exists($xcart_dir."/modules/cdseolinks/cdseo_cat.php")) { include $xcart_dir."/modules/cdseolinks/cdseo_cat.php"; } require $xcart_dir."/include/categories.php"; if ($active_modules["Manufacturers"]) include $xcart_dir."/modules/Manufacturers/customer_manufacturers.php"; if ($active_modules["Bestsellers"]) include $xcart_dir."/modules/Bestsellers/bestsellers.php"; # Load the search functions x_load('product'); # Debugging help # function print_debug($aString) { # comment out to stop debug info # print $aString; return ; } # this could be set as a config option if (!$days || $days == 0) {$days = $default_days;} # default sorting if needed. This could be a config option. if (!$sortby || $sortby == "") { $sortby = "add_date"; } # This array is used to determine the from/to date range # in the WHERE clause. It is also used for the labels # for the range. $newproducts_dayrange = array( 1 => func_get_langvar_by_name("lbl_newproducts_24hrs"), 3 => func_get_langvar_by_name("lbl_newproducts_3days"), 7 => func_get_langvar_by_name("lbl_newproducts_7days"), 30 => func_get_langvar_by_name("lbl_newproducts_30days") ); # This array is used to determine the order by clause and labels # used for sorting $sort_fields = array( "add_date" => func_get_langvar_by_name("lbl_newproducts_adddate"), "productcode" => func_get_langvar_by_name("lbl_newproducts_sku"), "product" => func_get_langvar_by_name("lbl_newproducts_product"), "price" => func_get_langvar_by_name("lbl_newproducts_price") ); # set date ranges $date_range = 86400 * (integer)$days; // 60(sec) * 60(min) * 24(hrs) * $days in unix time $now_time = time(); $from_time = $now_time - $date_range; # Don't show new products that are not available. $avail_condition = " AND $sql_tbl[products].avail > 0 "; $query = "$avail_condition AND add_date > $from_time AND add_date < $now_time "; # determine how many products fit the query criteria. # limit the maximum number of pages in the query ** optimization ** $max_ret_pages = $config["Appearance"]["products_per_page"] * $config["Appearance"]["max_nav_pages"]; print_debug("MAX_RET_PAGES: $max_ret_pages <BR>"); # # SORT DIRECTION # if ($sortby == "price") { $sortorder = "$sql_tbl[pricing].$sortby"; } else { $sortorder = "$sql_tbl[products].$sortby"; } if (!sortdirection || ($sortdirection == "") || ($sortdirection == "0")) { $sort_dir = "desc"; $sortdirection = "0"; } else { $sort_dir = "asc"; $sortdirection = "1"; } print_debug("QUERY: $query <BR />"); $temp_products = func_search_products($query, @$user_account["membershipid"], $orderby="$sortorder $sort_dir", $limit="$max_ret_pages"); # if we don't get anything back.. create an empty array if (is_array($temp_products)){ # get the total items new products. $total_items = count($temp_products); } else { $total_items = 0; } print_debug("TOTAL ITEMS: $total_items <BR>"); if ($total_items > 0) { # # Prepare the page navigation # if(!isset($objects_per_page)) { if ($current_area == "C" || $current_area == "B") $objects_per_page = $config["Appearance"]["products_per_page"]; else $objects_per_page = $config["Appearance"]["products_per_page_admin"]; } $total_nav_pages = ceil($total_items/$objects_per_page)+1; print_debug("Object per PAGE: $objects_per_page <BR>"); print_debug("TOTAL NAV PAGES: $total_nav_pages <BR>"); # calculate the upper and lower LIMIT for the SQL statement if (($page == 1) || $page == "") { $lowerLimit = 0; } else { $lowerLimit = (($page - 1) * $objects_per_page); } $upperLimit = ($lowerLimit + $objects_per_page); } # if we have items to show.. go get them.. if not it will default to empty string "". if ($total_items > 0) { # get the product list that is limited to the page we need to display. print_debug("temp_products count: " . count($temp_products) . "<br />"); print_debug("lowerLimit: $lowerLimit upperLimit: $upperLimit <br>"); $newproducts = array_slice($temp_products, $lowerLimit, ($upperLimit - $lowerLimit)); print_debug("newproducts count: " . count($newproducts) . "<br />"); } else { $newproducts = array(); } include $xcart_dir."/include/navigation.php"; # flag set that is used in home_main.tpl $smarty->assign("main","newproducts"); $smarty->assign("newproducts_dayrange", $newproducts_dayrange); $smarty->assign("sort_fields", $sort_fields); $smarty->assign("days",$days); $smarty->assign("sortby",$sortby); $smarty->assign("sortdirection",$sortdirection); # give the product array to smarty to make it available sitewide. $smarty->assign("products",$newproducts); $smarty->assign("first_item", $first_page+1); $smarty->assign("last_item", min($first_page+$objects_per_page, $total_items)); $smarty->assign("total_items",$total_items); $smarty->assign("navigation_script","newproducts.php?days=$days&sortby=$sortby&sortdirection=$sort_direction"); # create the location bar xxx :: New Products $location[] = array(func_get_langvar_by_name("lbl_newproducts"), "newproducts.php"); $smarty->assign("location",$location); # This function will start the display of the .tpl's func_display("customer/home.tpl",$smarty); ?>
__________________
xcart Gold Ver. 4.1.9
Reply With Quote
  #212  
Old 05-08-2008, 07:10 AM
 
mltriebe mltriebe is offline
 

Senior Member
  
Join Date: Mar 2006
Posts: 137
 

Default Re: Newest Products

Quote:
Originally Posted by yages

The first mod (zip file) works Ok but does not show product short description and standard sale price / actual sale price

Anyone get the short description thing sorted out yet? I have the same problem.

Mike
__________________
X-Cart 4.3.1
Buy Together Module, AlteredCart
CDSEO Pro
One Page Checkout, AlteredCart
Smart Search, AlteredCart
On Sale, AlteredCart
Reply With Quote
  #213  
Old 05-14-2008, 11:26 AM
 
shanda shanda is offline
 

Member
  
Join Date: May 2008
Posts: 10
 

Default Re: Newest Products

I think it's awful that the only way this can be fixed is through a purchase.

I have it working properly on the newproducts.php page, but can't get it to import onto the homepage. If anyone can come up with a FREE fix, I'd greatly appreciate it.
__________________
http://www.eBookAd.com
X-Cart Pro 4.1.10
Reply With Quote
  #214  
Old 05-21-2008, 06:57 PM
 
MBA MBA is offline
 

eXpert
  
Join Date: Apr 2006
Posts: 245
 

Default Re: Newest Products

This works great in v4.1.10. Very customizable too.

Everyone with questions - COMPARE THE NEWEST.TPL file with your recommends.tpl, products.tpl, product.tpl, products_t.tpl, featured.tpl, etc... You can grab/borrow/steal code from any or all of these files to get your Newest products looking the way you want.
__________________
xCart Pro Version 4.0.17, 4.0.19, 4.1.8, 4.1.10, 4.1.11, 4.1.12 - retired
xCart Pro Version 4.3.1 - production
xCart Pro Version 4.5.1 - testing
RHEL Platform
Reply With Quote
  #215  
Old 05-25-2008, 08:03 PM
 
Lingerieblowout Lingerieblowout is offline
 

X-Adept
  
Join Date: Sep 2003
Location: Annapolis, MD
Posts: 415
 

Default Re: Newest Products

Post 185 works well in XC Version 4.1.9

Example: http://www.lingerieblowout.com/newproducts.php
__________________
http://www.lingerieblowout.com
Version 4.1.10

http://www.topnichewebsites.com
Version 4.4.5

Michael
Reply With Quote
  #216  
Old 05-26-2008, 09:51 AM
 
MBA MBA is offline
 

eXpert
  
Join Date: Apr 2006
Posts: 245
 

Default Re: Newest Products

Oh... I thought Lingerie Blowout was a verb. I was expecting heavy lifting and ripping noises. My bad! :P
__________________
xCart Pro Version 4.0.17, 4.0.19, 4.1.8, 4.1.10, 4.1.11, 4.1.12 - retired
xCart Pro Version 4.3.1 - production
xCart Pro Version 4.5.1 - testing
RHEL Platform
Reply With Quote
  #217  
Old 05-26-2008, 10:15 AM
 
Lingerieblowout Lingerieblowout is offline
 

X-Adept
  
Join Date: Sep 2003
Location: Annapolis, MD
Posts: 415
 

Smile Re: Newest Products

LOL MBA ... Funny
__________________
http://www.lingerieblowout.com
Version 4.1.10

http://www.topnichewebsites.com
Version 4.4.5

Michael
Reply With Quote
  #218  
Old 05-27-2008, 09:30 AM
 
Lingerieblowout Lingerieblowout is offline
 

X-Adept
  
Join Date: Sep 2003
Location: Annapolis, MD
Posts: 415
 

Default Re: Newest Products

Looks like the post i said last works for ONLY the last newest product and then is replaced by the next newest one.... Not getting all the newest one in the list

Modified .. I got it to work ... Must of been a fluke - All OK
__________________
http://www.lingerieblowout.com
Version 4.1.10

http://www.topnichewebsites.com
Version 4.4.5

Michael
Reply With Quote
  #219  
Old 05-27-2008, 11:48 AM
 
toolexperts toolexperts is offline
 

eXpert
  
Join Date: Feb 2008
Location: Knoxville, TN
Posts: 288
 

Default Re: Newest Products

I am trying to add this mod per instructions, i can pull up the newproducts.php....however in step six it says

6.
Edit $xcart_dir/skin1/customer/home_main.php
Find:
{else}
{include file="common_templates.tpl"}
{/if}
Insert BEFORE:
{elseif $main eq "newproducts"}
{include file="customer/main/newproducts.tpl"}

Now I didn't see a .php file in there and I am assuming they mean the .tpl file, in which case when I added said code, it made my site go blank....do i need to proceed with step7 to make it work?(ex bring back pics?)
__________________
Tool Experts
X-Cart DB Version: 4.1.12 GOLD
Reply With Quote
  #220  
Old 05-27-2008, 12:23 PM
  JWait's Avatar 
JWait JWait is offline
 

X-Man
  
Join Date: Nov 2005
Location: California
Posts: 2,440
 

Default Re: Newest Products

Quote:
Originally Posted by toolexperts


Now I didn't see a .php file in there and I am assuming they mean the .tpl file, in which case when I added said code, it made my site go blank....do i need to proceed with step7 to make it work?(ex bring back pics?)

Yes, it is {xcart_dir}/skin1/customer/home_main.tpl, not home_main.php (there is no such thing). I've corrected it in my notes but not in the zip file (see post #185).

You need to complete step 7 for it to work correctly.
7.

Edit $xcart_dir/include/func/func.product.php

FIND (approx line 363):

$fields[] = "$sql_tbl[products].productcode";
$fields[] = "$sql_tbl[products].avail";


Add AFTER:

// newproducts .. needed for quantity to work on newproducts module
$fields[] = "$sql_tbl[products].min_amount";

Step 8 is optional. By default it should be set for 7 days.

Also, as many people have noticed, 4.1.x sorts products by the title by default. X-cart has no provisions for sorting by Add Date. The thread at http://forum.x-cart.com/showthread.php?t=38263 deals with this issue, but if you read the last post I am personally having a conflict with Add_Date and recommended products.
__________________
Two Separate X-Cart Stores
Version 4.4.4 Gold - X-AOM - Vivid Dreams Aquamarine (modified) - Linux
Mods - Newest Products - View All -, and a few others. Numerous upgrades from 4.0.x series.
Integrated with Stone Edge Order Manager + POS

Version 4.1.12 Gold (fresh install) - X-AOM - Linux
Mods - XCSEO free
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 06:37 AM.

   

 
X-Cart forums © 2001-2020