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

Set the time period for Bestsellers

 
Reply
   X-Cart forums > X-Cart 4 > Third Party Add-Ons for X-Cart 4
 
Thread Tools
  #1  
Old 12-07-2008, 10:40 PM
 
sparrowdog sparrowdog is offline
 

eXpert
  
Join Date: Jan 2007
Posts: 244
 

Default Set the time period for Bestsellers

I have a client who runs an online fashion shop and I've just set up the bestsellers for her, but since their stock turns over so quickly, I only want the bestsellers displaying for the past (x) number of days and not every order in the shop.

Is there a mod out there already written to do this?
__________________
Version 4.1.6 to 4.1.11
Reply With Quote
  #2  
Old 12-08-2008, 01:03 AM
  Holub's Avatar 
Holub Holub is offline
 

X-Adept
  
Join Date: Jan 2008
Posts: 432
 

Default Re: Set the time period for Bestsellers

As you know the module Advanced statistics is very slowly but it's required for Bestsellers module.
I'd recommend you new method of "real" Bestsellers, based on purchases statistics, not views statistics.
Open file /modules/Bestsellers/bestsellers.php and remove all lines between

Code:
if (!defined('XCART_SESSION_START')) { header("Location: ../../"); die("Access denied"); }
and
Code:
$smarty->assign("bestsellers", $bestsellers);
So insert between these lines next code:
Code:
$tm = time(); if ($cat) $cat_limit = "pc.categoryid = '$cat' and"; if (!$config[Bestsellers][number_of_bestsellers] || $config[Bestsellers][number_of_bestsellers] < 0) $config[Bestsellers][number_of_bestsellers] = 0; $bestsellers = func_query("select distinct p.*, pr.price as taxed_price, (($tm-p.add_date)) as adddate from $sql_tbl[products] p inner join $sql_tbl[products_categories] pc on pc.productid = p.productid left join $sql_tbl[pricing] pr on pr.productid = p.productid where $cat_limit p.forsale='Y' and (($tm-p.add_date)/86400)<3 and p.avail > 0 order by add_date desc limit ".$config[Bestsellers][number_of_bestsellers]);

Currently this code select bestsellers which add less that 3 days. You can change it in query, find (($tm-p.add_date)/86400)<3 and change number 3 to another period in days.

It's fast and effective method of bestsellers' selection without heavy Advanced statistics module enabled and heavy queries used.

I've make small changes without testing so if you will have any problems please don't hesitate to ask any questions.
__________________
Regards,
Anthony Holub

X-Cart Skins Store
- twenty two different skins available;
- both 4.1.x and 4.2.x versions compatible;
- refresh you store now!

Smart menu X-Cart add-on
Featured Products Slide Show X-Cart add-on
"What's New?" FREE X-Cart add-on
Reply With Quote
  #3  
Old 12-08-2008, 02:54 PM
 
sparrowdog sparrowdog is offline
 

eXpert
  
Join Date: Jan 2007
Posts: 244
 

Default Re: Set the time period for Bestsellers

I will give that a run on a test site and see how I go.

Thanks for the info.
__________________
Version 4.1.6 to 4.1.11
Reply With Quote
  #4  
Old 12-13-2008, 12:17 AM
 
sparrowdog sparrowdog is offline
 

eXpert
  
Join Date: Jan 2007
Posts: 244
 

Default Re: Set the time period for Bestsellers

Hi Anthony,

Thank you.
Thank you.
Thank you.
Thank you.
Thank you.
Thank you.

Brilliant and so easy to do. I used it on 4.1.6 with no trouble whatsoever.
__________________
Version 4.1.6 to 4.1.11
Reply With Quote
  #5  
Old 02-02-2017, 12:36 PM
 
dpcompany dpcompany is online now
 

eXpert
  
Join Date: Oct 2008
Posts: 313
 

Default Re: Set the time period for Bestsellers

So sorry to try to resurrect a 10 year old thread from the grave, but we are looking to implement this type of feature on our store. Anybody have any thoughts on this for v4.6.x and/or v4.7.x? It just seems silly to look at bestseller data for the entire time the shop has been open, my customer want to know what has been selling well recently, like within the past 3-6 months. Cheers!
__________________
Michael

Development
X-Cart Gold Plus v4.7.12
- php 7.3
- reBOOT reDUX
- other goodies

X-Cart Gold v4.7.7
- reBOOT Template
- XPayments 3.0.2
- Abandoned Cart Reminder
- BCSE Reward Points
- BCSE Stock Notify
- XPDF Invoices
Reply With Quote
  #6  
Old 02-02-2017, 04:34 PM
  cherie's Avatar 
cherie cherie is offline
 

X-Wizard
  
Join Date: May 2003
Location: USA
Posts: 1,534
 

Default Re: Set the time period for Bestsellers

I don't have any new code, but I would give this old suggestion a try. You may have to tweak it a little but it might give you a good start.
__________________
redlimeweb.com
custom mods and design integration
4.7 linux
Reply With Quote
  #7  
Old 02-03-2017, 11:04 AM
 
dpcompany dpcompany is online now
 

eXpert
  
Join Date: Oct 2008
Posts: 313
 

Default Re: Set the time period for Bestsellers

It looks like the code has changed way too much for someone of my level to try to sort out. Any developers out there want to give me a quote on being able to limit bestsellers to a number of days? Maybe in addition a Bestsellers static page that lists the bestsellers for each category?

Thanks!
__________________
Michael

Development
X-Cart Gold Plus v4.7.12
- php 7.3
- reBOOT reDUX
- other goodies

X-Cart Gold v4.7.7
- reBOOT Template
- XPayments 3.0.2
- Abandoned Cart Reminder
- BCSE Reward Points
- BCSE Stock Notify
- XPDF Invoices
Reply With Quote
  #8  
Old 02-03-2017, 12:48 PM
  cherie's Avatar 
cherie cherie is offline
 

X-Wizard
  
Join Date: May 2003
Location: USA
Posts: 1,534
 

Default Re: Set the time period for Bestsellers

The query seems to still be valid and you could put this before the $smarty->assign at the end, though I would also disable the $bestsellers=func_search_products section just before. This seems to be in line with the original instructions.
__________________
redlimeweb.com
custom mods and design integration
4.7 linux
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Third Party Add-Ons for X-Cart 4


Thread Tools

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:55 AM.

   

 
X-Cart forums © 2001-2020