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 > Changing and adding new features
 
Thread Tools Search this Thread
  #131  
Old 04-07-2006, 07:01 AM
 
MallRomania MallRomania is offline
 

Senior Member
  
Join Date: Apr 2006
Posts: 109
 

Default

Hello.

I have some errors when acces http://mallromania.ro/newproducts.php

INVALID SQL: 0 :
SQL QUERY FAILURE: SELECT COUNT(xcart_products.productid) FROM xcart_products, xcart_categories, xcart_products_categories, xcart_pricing WHERE xcart_products.productid=xcart_products_categories .productid AND xcart_products_categories.categoryid=xcart_categor ies.categoryid AND xcart_products.productid=xcart_pricing.productid AND xcart_pricing.quantity=1 AND (xcart_pricing.membership='' OR xcart_pricing.membership='') AND (xcart_categories.membership='' OR xcart_categories.membership='') AND xcart_products.forsale='Y' AND xcart_products.avail>0 AND xcart_pricing.variantid = 0AND xcart_products.avail > 0 AND add_date > 1143817094 AND add_date < 1144421894 GROUP BY xcart_products.productid

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/mallroma/public_html/include/func.php on line 102

I added latest code and corection for it but still have this error. Also, no products are show when select 24 hours, 3 days etc

Thanks
__________________
Mircea Teleleu
Shopedia.ro-la cumparaturi
www.shopedia.ro
______________________
x-cart gold 4.1.6
Linux
Reply With Quote
  #132  
Old 04-07-2006, 10:55 AM
  cliffo4's Avatar 
cliffo4 cliffo4 is offline
 

Member
  
Join Date: Jul 2005
Location: Leicester, UK
Posts: 19
 

Default

Quote:
Originally Posted by MallRomania
INVALID SQL: 0 :
SQL QUERY FAILURE: SELECT COUNT(xcart_products.productid) FROM xcart_products, xcart_categories, xcart_products_categories, xcart_pricing WHERE xcart_products.productid=xcart_products_categories .productid AND xcart_products_categories.categoryid=xcart_categor ies.categoryid AND xcart_products.productid=xcart_pricing.productid AND xcart_pricing.quantity=1 AND (xcart_pricing.membership='' OR xcart_pricing.membership='') AND (xcart_categories.membership='' OR xcart_categories.membership='') AND xcart_products.forsale='Y' AND xcart_products.avail>0 AND xcart_pricing.variantid = 0AND xcart_products.avail > 0 AND add_date > 1143817094 AND add_date < 1144421894 GROUP BY xcart_products.productid
A quick look mayby where you have a "0AND" ahould really be "0 AND" - noting the space?
__________________
X-Cart Gold 4.0.19
http://interstellarsounds.com
Reply With Quote
  #133  
Old 04-07-2006, 11:09 AM
 
MallRomania MallRomania is offline
 

Senior Member
  
Join Date: Apr 2006
Posts: 109
 

Default

Hmm...i must clean up my oculars Thank you
__________________
Mircea Teleleu
Shopedia.ro-la cumparaturi
www.shopedia.ro
______________________
x-cart gold 4.1.6
Linux
Reply With Quote
  #134  
Old 04-07-2006, 11:33 AM
 
MallRomania MallRomania is offline
 

Senior Member
  
Join Date: Apr 2006
Posts: 109
 

Default

Ok, everything it's ok when i visit newproducts.php..but how to show newproducts in main page? I added in customer/home_main.tpl this code

{elseif $main eq "newproducts"}
{include file="customer/main/newproducts.tpl"}

and in welcome.tpl





{include file="customer/main/newest.tpl" newproducts=$newproducts}

but only new product box appear with no products in.

see here:

http://mallromania.ro/home.php?shopkey=1086
__________________
Mircea Teleleu
Shopedia.ro-la cumparaturi
www.shopedia.ro
______________________
x-cart gold 4.1.6
Linux
Reply With Quote
  #135  
Old 04-09-2006, 03:31 AM
 
MallRomania MallRomania is offline
 

Senior Member
  
Join Date: Apr 2006
Posts: 109
 

Default

Can somebody help me, please? I want to open site for users tomorow and this option will be useful for me.

Thanks
__________________
Mircea Teleleu
Shopedia.ro-la cumparaturi
www.shopedia.ro
______________________
x-cart gold 4.1.6
Linux
Reply With Quote
  #136  
Old 04-09-2006, 03:40 AM
  cliffo4's Avatar 
cliffo4 cliffo4 is offline
 

Member
  
Join Date: Jul 2005
Location: Leicester, UK
Posts: 19
 

Default

Quote:
Originally Posted by MallRomania
Can somebody help me, please? I want to open site for users tomorow and this option will be useful for me.

Thanks
Not quite sure what your trying to achieve. On site I do work for (http://interstellarsounds.com) I built a new block based on bestsellers. The code to pull out the newest items is also included into bestsellers.php - as that already gets called. In the block I built (newitems.tpl), there is a link to each product but a link at the bottom of the block to newproducts.php.

Hope that helps to give you some ideas to extend and integrate to your cart/site[/url]
__________________
X-Cart Gold 4.0.19
http://interstellarsounds.com
Reply With Quote
  #137  
Old 04-09-2006, 03:50 AM
 
MallRomania MallRomania is offline
 

Senior Member
  
Join Date: Apr 2006
Posts: 109
 

Default

All i want is to display newest products in main page, not only when press link. Something similar with featured products will be be very good. Can you send me your code please? (admin@mallromania.ro)

Thank you
__________________
Mircea Teleleu
Shopedia.ro-la cumparaturi
www.shopedia.ro
______________________
x-cart gold 4.1.6
Linux
Reply With Quote
  #138  
Old 04-09-2006, 04:49 AM
  cliffo4's Avatar 
cliffo4 cliffo4 is offline
 

Member
  
Join Date: Jul 2005
Location: Leicester, UK
Posts: 19
 

Default

Quote:
Originally Posted by MallRomania
All i want is to display newest products in main page, not only when press link. Something similar with featured products will be be very good. Can you send me your code please? (admin@mallromania.ro)

Thank you

Well in the spirit of sharing here is the basis of thing. Do take into account that I have taken out some of the more specific requirements of my development to give a basis to be working on. Code based on Xcart Gold 4.0.18

/modules/Bestsellers/bestsellers.php.

Code:
<?php /*****************************************************************************\ +-----------------------------------------------------------------------------+ | X-Cart | | Copyright (c) 2001-2005 Ruslan R. Fazliev <rrf@rrf.ru> | | All rights reserved. | +-----------------------------------------------------------------------------+ | PLEASE READ THE FULL TEXT OF SOFTWARE LICENSE AGREEMENT IN THE "COPYRIGHT" | | FILE PROVIDED WITH THIS DISTRIBUTION. THE AGREEMENT TEXT IS ALSO AVAILABLE | | AT THE FOLLOWING URL: http://www.x-cart.com/license.php | | | | THIS AGREEMENT EXPRESSES THE TERMS AND CONDITIONS ON WHICH YOU MAY USE | | THIS SOFTWARE PROGRAM AND ASSOCIATED DOCUMENTATION THAT RUSLAN R. | | FAZLIEV (hereinafter referred to as "THE AUTHOR") IS FURNISHING OR MAKING | | AVAILABLE TO YOU WITH THIS AGREEMENT (COLLECTIVELY, THE "SOFTWARE"). | | PLEASE REVIEW THE TERMS AND CONDITIONS OF THIS LICENSE AGREEMENT | | CAREFULLY BEFORE INSTALLING OR USING THE SOFTWARE. BY INSTALLING, | | COPYING OR OTHERWISE USING THE SOFTWARE, YOU AND YOUR COMPANY | | (COLLECTIVELY, "YOU") ARE ACCEPTING AND AGREEING TO THE TERMS OF THIS | | LICENSE AGREEMENT. IF YOU ARE NOT WILLING TO BE BOUND BY THIS | | AGREEMENT, DO NOT INSTALL OR USE THE SOFTWARE. VARIOUS COPYRIGHTS AND | | OTHER INTELLECTUAL PROPERTY RIGHTS PROTECT THE SOFTWARE. THIS | | AGREEMENT IS A LICENSE AGREEMENT THAT GIVES YOU LIMITED RIGHTS TO USE | | THE SOFTWARE AND NOT AN AGREEMENT FOR SALE OR FOR TRANSFER OF TITLE.| | THE AUTHOR RETAINS ALL RIGHTS NOT EXPRESSLY GRANTED BY THIS AGREEMENT. | | | | The Initial Developer of the Original Code is Ruslan R. Fazliev | | Portions created by Ruslan R. Fazliev are Copyright (C) 2001-2005 | | Ruslan R. Fazliev. All Rights Reserved. | +-----------------------------------------------------------------------------+ \*****************************************************************************/ # # $Id: bestsellers.php,v 1.24.2.4 2006/01/16 14:58:31 mclap Exp $ # # Bestsellers and now newitems at same time to save some processing # if (!defined('XCART_SESSION_START')) { header("Location: ../../"); die("Access denied"); } if ($active_modules['Bestsellers'] || $active_modules['Newitems']){ if (!is_numeric($config["Modules"]["number_of_bestsellers"])) $config["Modules"]["number_of_bestsellers"] = 0; # # Get products data for current category and store it into $products array # $avail_condition = ""; if ($config["General"]["unlimited_products"] == "N" && $config["General"]["disable_outofstock_products"] == "Y") $avail_condition = " AND $sql_tbl[products].avail>0 "; $cat = intval($cat); if ($cat) { $category_data = func_query_first("SELECT categoryid_path, threshold_bestsellers FROM $sql_tbl[categories] USE INDEX (PRIMARY) WHERE categoryid='$cat'"); $result = func_query("SELECT categoryid, threshold_bestsellers FROM $sql_tbl[categories] USE INDEX (pam) WHERE categoryid_path LIKE '$category_data[categoryid_path]/%' AND avail='Y'"); $threshold = (int)$category_data["threshold_bestsellers"]; $cat_ids = array(); if (is_array($result)) { foreach($result as $k=>$v) { $cat_ids[] = $v["categoryid"]; if ($v["threshold_bestsellers"]>0 && $threshold > $v["threshold_bestsellers"]) $threshold = $v["threshold_bestsellers"]; } } else $cat_ids[] = $cat; $str = " AND $sql_tbl[products_categories].categoryid IN (".implode(",", $cat_ids).")"; if ($threshold) $threshold -=1; $search_query1 = $str." AND $sql_tbl[products].views_stats>0 AND $sql_tbl[products].sales_stats > $threshold"; } else { $threshold = 0; $search_query1 = " AND $sql_tbl[products].sales_stats>$threshold"; } $search_query2 = " AND $sql_tbl[products].add_date>UNIX_TIMESTAMP()-(14*86400) and $sql_tbl[products].add_date >0 and $sql_tbl[products].forsale='Y'"; $order_by1 = "$sql_tbl[products].sales_stats DESC, $sql_tbl[products].views_stats DESC"; $order_by2 = "rand()"; #$order_by2 = "$sql_tbl[products].views_stats, $sql_tbl[products].newdate_until desc"; \\least viewed by youngest item # # Search the bestsellers and newitems # if ($active_modules['Bestsellers']) { $bestsellers = func_search_products($search_query1, @$user_account["membership"], $order_by1, $config["Modules"]["number_of_bestsellers"]); $smarty->assign("bestsellers",$bestsellers); } if ($active_modules['Newitems']) { $tmp_str = $str.$search_query2; $bestsellers = func_search_products($str.$search_query2, @$user_account["membership"], $order_by2, $config["Modules"]["number_of_bestsellers"]); if (empty($bestsellers) and $cat) $bestsellers = func_search_products($search_query2, @$user_account["membership"], $order_by2, $config["Modules"]["number_of_bestsellers"]); $smarty->assign("newitems",$bestsellers); } } ?>

You may want to pay attention to the query2 string above in relation to column "add_date" as my system uses a different column due to other mods I have made on cart.

skin1/modules/Newitems/newitems.tpl
Code:
{* $Id: newitems.tpl,v 1.3.2.1 2006/03/12 11:15:01 max Exp $ *} {if $newitems and $active_modules.Newitems} {capture name=newitem} <TABLE cellpadding="2" cellspacing="2" border="0"><tr valign="top"> {section name=num loop=$newitems max=5} <TD align="center" width="20%"> <A href="product.php?productid={$newitems[num].productid}">{if $config.Modules.bestsellers_thumbnails eq "Y"} {include file="product_thumbnail.tpl" productid=$newitems[num].productid image_x=90 product=$newitems[num].product} {/if} {$newitems[num].product} <FONT class="ProductPrice">{$lng.lbl_price}:</FONT> {if $newitems[num].price eq 0 and $product.avail lt 1}<FONT class="ProductDetailsTitle"><SPAN id="product_price">{$lng.lbl_TBC}</SPAN></FONT>{else} {if $newitems[num].price ne 0 || $variants ne ''} <FONT class="ProductDetailsTitle"><SPAN id="product_price">{include file="currency.tpl" value=$newitems[num].price}</SPAN></FONT><FONT class="MarketPrice"> <SPAN id="product_alt_price">{include file="customer/main/alter_currency_value.tpl" alter_currency_value=$newitems[num].price}</SPAN></FONT> {if $newitems[num].taxes} {include file="customer/main/taxed_price.tpl" taxes=$newitems[num].taxes}{/if} {else}{$lng.lbl_enter_your_price}{/if}{/if}</A> {/section}</tr><tr><td align="center" colspan="{$smarty.section.num.total}">more new items</td></tr></TABLE> {/capture} {include file="dialog.tpl" title=$lng.lbl_newproducts content=$smarty.capture.newitem extra="width=100%"} {/if}
This template may need some alteration as I test for Zero price and do some other bits - feel free to alter to fit your needs.

Edit skin1/customer/home.tpl
Code:
{include file="location.tpl"} {include file="dialog_message.tpl"} {if $active_modules.Special_Offers ne ""} {include file="modules/Special_Offers/customer/new_offers_message.tpl"} {/if} {include file="customer/home_main.tpl"} {include file="modules/NewItems/newitems.tpl"}

Upto you how and where you place the block - it should come out as a horizontol block with 5 items listed. It can be added elsewhere and will be category sensitive (like bestsellers is). Meaning it will show newest 5 items in currently selected category or if there are none, will do a global search.

Add some sql to xcart:
Code:
INSERT INTO `xcart_modules` VALUES (64, 'Newitems', 'Show Newest items added to site', 'Y');
This will result in you seeing in admin/modules a new module - obviously do activate it to enable the block on front page.

Think thats about it. Can't promise it will work as it is as I've had to pull it all out from my mods - Good luck - and the fun is when you do get it to happen
__________________
X-Cart Gold 4.0.19
http://interstellarsounds.com
Reply With Quote
  #139  
Old 04-09-2006, 05:12 AM
 
MallRomania MallRomania is offline
 

Senior Member
  
Join Date: Apr 2006
Posts: 109
 

Default

THANK YOU! You are the best!
__________________
Mircea Teleleu
Shopedia.ro-la cumparaturi
www.shopedia.ro
______________________
x-cart gold 4.1.6
Linux
Reply With Quote
  #140  
Old 04-09-2006, 05:15 AM
  cliffo4's Avatar 
cliffo4 cliffo4 is offline
 

Member
  
Join Date: Jul 2005
Location: Leicester, UK
Posts: 19
 

Default

Quote:
Originally Posted by MallRomania
THANK YOU! You are the best!
I doubt that - But I do try!
__________________
X-Cart Gold 4.0.19
http://interstellarsounds.com
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Changing and adding new features


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 08:28 AM.

   

 
X-Cart forums © 2001-2018