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
  #61  
Old 09-29-2004, 07:50 PM
 
BHMedia BHMedia is offline
 

Advanced Member
  
Join Date: Sep 2003
Posts: 71
 

Default

you know what would make this a killer mod - we have a site that ads over 500 products a week - so this mod would just pull out X amount - to eaither make it have it so it can have XXXXX Products but if it is over 10 on a page it will show the 1 2 3 4 5 6 on top or just have like RANDOM newest products... how would i do that?
Reply With Quote
  #62  
Old 09-29-2004, 08:05 PM
 
BHMedia BHMedia is offline
 

Advanced Member
  
Join Date: Sep 2003
Posts: 71
 

Default

Im not sure if this part is even worth posting but I figured it out..

I wanted to make it so it will just RANDOM the 6 products i had there... Because my client has so many updated products...

here goes

all you have to do is change the query from


Code:
$query = "SELECT * FROM $sql_tbl[products],$sql_tbl[pricing] WHERE forsale='Y' AND avail>0 AND $sql_tbl[products].productid=$sql_tbl[pricing].productid AND add_date > " . $oldtime . " AND add_date < " . $nowtime . " ORDER BY xcart_products.productID DESC LIMIT 0,5 ";

to

Code:
// the database query $query = "SELECT * FROM $sql_tbl[products],$sql_tbl[pricing] WHERE forsale='Y' AND avail>0 AND $sql_tbl[products].productid=$sql_tbl[pricing].productid AND add_date > " . $oldtime . " AND add_date < " . $nowtime . " ORDER BY RAND() LIMIT 6 ";


Hope this helps... This works for 4.03...
Reply With Quote
  #63  
Old 09-30-2004, 09:28 AM
 
mizzlewillz mizzlewillz is offline
 

Advanced Member
  
Join Date: Apr 2004
Posts: 45
 

Default

This is a nice mod. After playing around with the settings I was able to limit the choices to a certain category, but is there a way to make it so there are more than one page similar to the products.tpl. We will be adding lots of products each week and would like to list them 10 to 15 items to a page rather than all the new products at once. I thought X-cart would break them into pages but it doesn't.

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.

Any comments is appreciated.

-Mike
Reply With Quote
  #64  
Old 09-30-2004, 07:15 PM
 
BHMedia BHMedia is offline
 

Advanced Member
  
Join Date: Sep 2003
Posts: 71
 

Default

I just cleared out the label so it reads nothing... I cant figure it out tho...
Reply With Quote
  #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
  #66  
Old 10-22-2004, 01:49 AM
 
hobbyhandig hobbyhandig is offline
 

Advanced Member
  
Join Date: Sep 2004
Posts: 76
 

Default

Using 4.0.5, newest.php gives an parse error on line 23

http://hobbyhandig.webfontein.nl

What did I do wrong?
__________________
Karin Horton
X-Cart Gold 4.1.11
Reply With Quote
  #67  
Old 11-01-2004, 02:01 AM
 
hobbyhandig hobbyhandig is offline
 

Advanced Member
  
Join Date: Sep 2004
Posts: 76
 

Default

Anyone? I really want this mod, but it doesn't work!
__________________
Karin Horton
X-Cart Gold 4.1.11
Reply With Quote
  #68  
Old 11-01-2004, 05:40 AM
  B00MER's Avatar 
B00MER B00MER is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Keller, TX (Cart-Lab.com)
Posts: 3,165
 

Default

http://www.cart-lab.com/Newest_Products-p-53.html Easier to use and setup
__________________
Cart-Lab - 100+ Social Bookmarks for X-Cart.
Reply With Quote
  #69  
Old 11-01-2004, 06:00 AM
 
hobbyhandig hobbyhandig is offline
 

Advanced Member
  
Join Date: Sep 2004
Posts: 76
 

Default

Hi Boomer,

If it were my money I would buy it!

But my boss has to pay, so I would really like if I can get the free version to work for me, like all these people in this topic before me!
__________________
Karin Horton
X-Cart Gold 4.1.11
Reply With Quote
  #70  
Old 11-17-2004, 12:40 PM
 
StitchClix StitchClix is offline
 

Member
  
Join Date: Sep 2004
Posts: 11
 

Default

OK, I hate to be a newbie. I've gotten this to work on the home page, but how do you make an independent page displaying only the new items. I've read this whole section several times, and maybe I just don't know what I'm looking for, but I can't figure it out. Any help would be hugely appreciated.

Mike
StitchClix.com
__________________
StitchClix.com
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



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 03:57 PM.

   

 
X-Cart forums © 2001-2020