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

Bestsellers on ALL pages

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #11  
Old 08-30-2004, 09:57 AM
  BCSE's Avatar 
BCSE BCSE is online now
 

X-Guru
  
Join Date: Apr 2003
Location: Ohio - bcsengineering.com
Posts: 3,063
 

Default

Post updated with the file name. Thanks for pointing that out Ricky!

Carrie
__________________
Custom Development, Custom Coding and Pre-built modules for X-cart since 2002!

We support X-cart versions 3.x through 5.x!

Home of the famous Authorize.net DPM & CIM Modules, Reward Points Module, Point of Sale module, Speed Booster modules and more!


Over 200 X-cart Mods available & Thousands of Customizations Since 2002 - bcsengineering.com

Please E-Mail us for questions/support!
Reply With Quote
  #12  
Old 08-30-2004, 10:09 AM
  rjcbear's Avatar 
rjcbear rjcbear is offline
 

X-Adept
  
Join Date: Jun 2004
Location: Alabama,U.S.A
Posts: 503
 

Default

Quote:
Originally Posted by BCSE
Post updated with the file name. Thanks for pointing that out Ricky!

Carrie

thatnk you for the update.

kind regards,
Ricky
__________________
X-CART Gold version 4.0.14 & 4.1.11
Apache Version 1.3.29 (Unix)
EWDHosting-Quality X-cart Hosting
We will always sell you the right shoe and the left one is free.
Reply With Quote
  #13  
Old 07-07-2005, 09:05 AM
 
Online Michael Online Michael is offline
 

eXpert
  
Join Date: Mar 2005
Location: Melbourne, Australia
Posts: 273
 

Default

I thought it would be a good idea to show the customer the best selling products in each category as they browse my web site. To some extent this mod does the trick but it has one major flaw. If you click on a product link inside the product page and you are taken to a different category, it doesn't show the Bestseller products for that category (keeps showing the previous Bestsellers from the last category looked at).

Also, for some reason the mod works correctly if you had selected a product link while on the home page. In other words, the Bestsellers, in the product page, will correctly show all the Bestsellers within the category if the product link was selected while on the home page and not on the product page. I hope I'm making sense ?


Anyone have any ideas on how to overcome this?
__________________
X-Cart 5.3.5.4
Reply With Quote
  #14  
Old 07-09-2005, 08:35 AM
 
Online Michael Online Michael is offline
 

eXpert
  
Join Date: Mar 2005
Location: Melbourne, Australia
Posts: 273
 

Default

Ok, disregard previous post. I must have been drunk
__________________
X-Cart 5.3.5.4
Reply With Quote
  #15  
Old 07-09-2005, 08:59 AM
  BCSE's Avatar 
BCSE BCSE is online now
 

X-Guru
  
Join Date: Apr 2003
Location: Ohio - bcsengineering.com
Posts: 3,063
 

Default

Glad you got it figured out!

Carrie
__________________
Custom Development, Custom Coding and Pre-built modules for X-cart since 2002!

We support X-cart versions 3.x through 5.x!

Home of the famous Authorize.net DPM & CIM Modules, Reward Points Module, Point of Sale module, Speed Booster modules and more!


Over 200 X-cart Mods available & Thousands of Customizations Since 2002 - bcsengineering.com

Please E-Mail us for questions/support!
Reply With Quote
  #16  
Old 07-09-2005, 09:30 AM
 
Online Michael Online Michael is offline
 

eXpert
  
Join Date: Mar 2005
Location: Melbourne, Australia
Posts: 273
 

Default

Yeh, it's amazing what a good nights sleep can do.

Overworked, underpaid, now where did that bottle go again?
__________________
X-Cart 5.3.5.4
Reply With Quote
  #17  
Old 07-09-2005, 10:59 AM
  BCSE's Avatar 
BCSE BCSE is online now
 

X-Guru
  
Join Date: Apr 2003
Location: Ohio - bcsengineering.com
Posts: 3,063
 

Default



Carrie
__________________
Custom Development, Custom Coding and Pre-built modules for X-cart since 2002!

We support X-cart versions 3.x through 5.x!

Home of the famous Authorize.net DPM & CIM Modules, Reward Points Module, Point of Sale module, Speed Booster modules and more!


Over 200 X-cart Mods available & Thousands of Customizations Since 2002 - bcsengineering.com

Please E-Mail us for questions/support!
Reply With Quote
  #18  
Old 07-31-2005, 08:15 AM
 
bardolino bardolino is offline
 

Advanced Member
  
Join Date: Jun 2005
Posts: 33
 

Default

Hi,

I tried this mod, but get the following error when i click on a categorie:

INVALID SQL: 1064 : 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 'xcart_products.forsale='Y' and xcart_products.avail>0 and xcart_products.sales_s' at line 1
SQL QUERY FAILURE: SELECT xcart_products.productid, xcart_products.product, xcart_products.productcode, xcart_products.avail, MIN(xcart_pricing.price) AS price, IF (xcart_classes.classid IS NULL,'','Y') as is_product_options, IF(xcart_variants.variantid IS NULL,'','Y') as is_variant FROM xcart_products, xcart_categories, xcart_products_categories, xcart_pricing LEFT JOIN xcart_classes ON xcart_classes.productid = xcart_products.productid LEFT JOIN xcart_variants ON xcart_variants.productid = xcart_products.productid LEFT JOIN xcart_products_lng ON xcart_products.productid=xcart_products_lng.produc tid 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_pricing.variantid = 0 AND xcart_products.product_type <> 'C' AND xcart_products.product_type <> 'B' xcart_products.forsale='Y' and xcart_products.avail>0 and xcart_products.sales_stats > 0 AND xcart_categories.avail='Y' and price>0 group by xcart_products.productid order by sales_stats DESC, views_stats DESC limit 5 GROUP BY xcart_products.productid ORDER BY xcart_products_categories.orderby

Anyone knows why this happens?
__________________
Version 4.0.14
Reply With Quote
  #19  
Old 07-31-2005, 09:38 AM
  BCSE's Avatar 
BCSE BCSE is online now
 

X-Guru
  
Join Date: Apr 2003
Location: Ohio - bcsengineering.com
Posts: 3,063
 

Default

Post the code you modified and that would also help in debugging this sql error.

Thanks,

Carrie
__________________
Custom Development, Custom Coding and Pre-built modules for X-cart since 2002!

We support X-cart versions 3.x through 5.x!

Home of the famous Authorize.net DPM & CIM Modules, Reward Points Module, Point of Sale module, Speed Booster modules and more!


Over 200 X-cart Mods available & Thousands of Customizations Since 2002 - bcsengineering.com

Please E-Mail us for questions/support!
Reply With Quote
  #20  
Old 07-31-2005, 10:32 AM
 
bardolino bardolino is offline
 

Advanced Member
  
Join Date: Jun 2005
Posts: 33
 

Default

Hi Carrie,

This is modules/bestsellers/bestsellers.php:

<?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.3 2005/01/12 07:42:08 svowl Exp $
#
# Bestsellers
#

if (!defined('XCART_SESSION_START')) { header("Location: ../../"); die("Access denied"); }

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_query = $str." AND $sql_tbl[products].views_stats>0 AND $sql_tbl[products].sales_stats > $threshold";
}
else {
$threshold = 0;
$search_query = " AND $sql_tbl[products].sales_stats>$threshold";
}

$order_by = "$sql_tbl[products].sales_stats DESC, $sql_tbl[products].views_stats DESC";

#
# Search the bestsellers
#
$bestsellers = func_search_products($search_query, @$user_account["membership"], $order_by, $config["Modules"]["number_of_bestsellers"]);
# BCSE
if(empty($bestsellers))
{
$threshold = 0;
$search_query = "$sql_tbl[products].forsale='Y' and $sql_tbl[products].avail>0 and $sql_tbl[products].sales_stats > $threshold AND $sql_tbl[categories].avail='Y' and price>0 group by $sql_tbl[products].productid order by sales_stats DESC, views_stats DESC limit ".$config["Modules"]["number_of_bestsellers"];
$bestsellers = func_search_products($search_query, !empty($user_account['membership'])?$user_account['membership']:"");
}
# BCSE
$smarty->assign("bestsellers",$bestsellers);

?>
__________________
Version 4.0.14
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 04:28 AM.

   

 
X-Cart forums © 2001-2020