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

Best Sellers for the Month Only

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #11  
Old 05-20-2005, 12:05 AM
 
IndieDepot IndieDepot is offline
 

Advanced Member
  
Join Date: May 2005
Posts: 30
 

Default

THis sure would have been a nice mod. Too bad it doesn't work on the latest versions of X-Cart. *sad face*

- Shannon
__________________
- www.TheShotList.com
X-Cart version 4.0.13
PHP 4.3.10
MySQL 4.0.23
Web server Apache
Operation system Linux
Perl 5.008004
XML parser (expat) 1.95.6
Reply With Quote
  #12  
Old 05-20-2005, 04:38 AM
 
Online Michael Online Michael is offline
 

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

Default

Hi Jon,

Nice mod. However, I'm sorry for going off-topic for a moment, but I noticed something while visiting the mixtapemp3.com site that I want to ask you about. This site uses tabs to display information, and since my store uses them too, I was wondering how you managed to stop the page from jumping around (making the tabs appear at the top of the page) when clicking on them. Mine always go to the top of the page for some strange reason. How did you stop this from happening?
__________________
X-Cart 5.3.5.4
Reply With Quote
  #13  
Old 05-20-2005, 04:48 AM
  Jon's Avatar 
Jon Jon is offline
 

X-Guru
  
Join Date: Oct 2002
Location: Vancouver, Canada
Posts: 4,200
 

Default

If somebody is interested you can PM me for a quote for 4.x, but I don't have the time to make it without necessity to do so.

You can prevent your page from jumping to the type by adding this code to your <a href tag:

Code:
onclick="return false;"

Prevents the link from doing what it's supposed to.
Reply With Quote
  #14  
Old 05-20-2005, 06:42 AM
 
Online Michael Online Michael is offline
 

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

Default

Thanks Jon, love your work mate! Oh, and btw, worked great too!
__________________
X-Cart 5.3.5.4
Reply With Quote
  #15  
Old 09-16-2005, 09:09 AM
 
Lucent88 Lucent88 is offline
 

Senior Member
  
Join Date: Aug 2005
Posts: 147
 

Default

yages,

I think the reason why you see that error is because ...

On v4.0.x.. you need

Code:
require $xcart_dir."/bestsellers_month.php";

instead of

Code:
require "./bestsellers_month.php";

After I corrected to that, I don't see the error message no more.
My site is still at testing stage, and there is no product sold, so I don't see any change this MOD does to my site just yet.

Let me know if anyone has a working demo site with standard template.
__________________
X-Cart Gold 4.0.17
Reply With Quote
  #16  
Old 09-23-2005, 06:22 PM
 
yages yages is offline
 

eXpert
  
Join Date: Sep 2004
Location: Australia
Posts: 332
 

Default

I tried to install this mod but it would not work

Maybe this could be the problem
My home.php looks like this

#
# $Id: home.php,v 1.44.2.2 2005/01/12 07:41:51 svowl Exp $
#

header("Location: ../home.php".(!empty($QUERY_STRING) ? "?".$QUERY_STRING : ""));
?>

where do I put the code
require $xcart_dir."/bestsellers_month.php";
__________________
yages
x-cart version 4.5.5
Reply With Quote
  #17  
Old 07-13-2006, 09:51 AM
 
sbkp sbkp is offline
 

Advanced Member
  
Join Date: Jul 2005
Posts: 83
 

Default

Thanks! This is excellent.

I made one change so it's the last month's bestsellers, not just since the first of the current month:

Code:
$start_date = strtotime("-1 month"); $end_date = strtotime("now");

I removed the month_cat, since I want all categories included. I also checked orders' status (for Processed or Completed in my case):

Code:
$query = "SELECT $sql_tbl[products].*,$sql_tbl[pricing].*,$sql_tbl[order_details].productid,$sql_tbl[order_details].orderid,$sql_tbl[orders].orderid,$sql_tbl[orders].date, count($sql_tbl[order_details].productid) as sold FROM $sql_tbl[pricing],$sql_tbl[products],$sql_tbl[orders],$sql_tbl[order_details] WHERE ($sql_tbl[orders].status='C' OR $sql_tbl[orders].status='P') AND $sql_tbl[orders].date > '$start_date' AND $sql_tbl[orders].date < '$end_date' AND $sql_tbl[order_details].orderid=$sql_tbl[orders].orderid AND $sql_tbl[products].productid=$sql_tbl[order_details].productid AND $sql_tbl[pricing].productid=$sql_tbl[products].productid AND $sql_tbl[products].forsale='Y' AND $sql_tbl[products].avail>0 GROUP BY $sql_tbl[order_details].productid ORDER BY sold DESC LIMIT $month_limit";

And finally, I modified skin1/modules/Bestsellers/menu_bestsellers.tpl, rather than changing welcome.tpl.

Just change all instances of $bestsellers to $month_bestsellers.

Best,
Stefan
__________________
Gold 4.0.17
On Sale, Smart Search, X-AOM, X-SpecialOffers, XNews, DSEFU, and custom mods/tweaks
Reply With Quote
  #18  
Old 10-23-2006, 03:17 PM
  ShishaPipeUK's Avatar 
ShishaPipeUK ShishaPipeUK is offline
 

Senior Member
  
Join Date: Jul 2005
Location: London, England.
Posts: 118
 

Default Re: Best Sellers for the Month Only

I changed this for xcart 4.1.3

shopcart/bestsellers_month.php

<?
$start_date = strtotime("-1 month"); # LAST MONTH PRODUCTS
$end_date = strtotime("now"); # TODAY - NOW
$amount_prod_to_show = '6'; # AMOUNT OF PRODUCTS TO SHOW
$query = "SELECT $sql_tbl[products].*, $sql_tbl[pricing].*, $sql_tbl[order_details].productid, $sql_tbl[order_details].orderid, $sql_tbl[orders].orderid, $sql_tbl[orders].date, count($sql_tbl[order_details].productid) as sold FROM $sql_tbl[pricing], $sql_tbl[products], $sql_tbl[orders], $sql_tbl[order_details] WHERE ($sql_tbl[orders].status='C' OR $sql_tbl[orders].status='P') AND $sql_tbl[orders].date > '$start_date' AND $sql_tbl[orders].date < '$end_date' AND $sql_tbl[order_details].orderid=$sql_tbl[orders].orderid AND $sql_tbl[products].productid=$sql_tbl[order_details].productid AND $sql_tbl[pricing].productid=$sql_tbl[products].productid AND $sql_tbl[products].forsale='Y' AND $sql_tbl[products].avail>0 GROUP BY $sql_tbl[order_details].productid ORDER BY sold DESC LIMIT $amount_prod_to_show";
$month_sellers = func_query($query);
$smarty->assign("month_sellers",$month_sellers);
?>

In the shopcart/home.php add

require "./bestsellers_month.php";

In the shopcart/skin1/customer/main/welcome.tpl add

{if $month_sellers ne ""}
{include file="modules/Bestsellers/bestsellers_month.tpl" products=$month_sellers featured="Y"}
<br />{/if}

Also add the above if you want it to be displayed in your subcategories to shopcart/skin1/customer/main/subcategories.tpl

I also made in shopcart/skin1/modules/bestsellers/bestsellers_month.tpl file which is:

bestsellers_month.tpl

{if $month_sellers}
{capture name=bestsellers}
<TABLE border="0" cellpadding="0" cellspacing="0">
<tr>
{foreach from=$month_sellers item=bestseller}
<TD width="100" align="center" valign="top">
<div align="center">{if $config.Bestsellers.bestsellers_thumbnails eq "Y"} <a href="product.php?productid={$bestseller.productid }&cat={$cat}&bestseller">{include file="product_thumbnail.tpl" productid=$bestseller.productid image_x=50 product=$bestseller.product alt=$bestseller.fulldescr|replace:"":""}</a>
<br />
{/if}
<b><a href="product.php?productid={$bestseller.productid }&amp;cat={$cat}&amp;bestseller">{$bestseller.prod uct}</a></b><br />
{$lng.lbl_our_price}: {include file="currency.tpl" value=$bestseller.price}<br />
</div></td>
<TD width="10"></TD>
{/foreach}
</tr>
</table>
{/capture}
{include file="dialog.tpl" title="This Months Hottest Sellers!" content=$smarty.capture.bestsellers extra='width="100%"'}
{/if}

You can see the finished product at http://www.theshisha.com/shopcart/home.php?cat=255

It will also display at the top of every categories, to see this go to http://www.theshisha.com/shopcart/home.php?cat=272
__________________
Apache/2.0.55 (Red Hat) & MYSQL Server: 5.0.24
PERL: 5.008005 / PHP: 4.4.4 - 4.3.1 X-CART

Shop carts at
http://www.nightscene.co.uk/shop/home.php
http://www.theshisha.net/shopcart/home.php
http://www.system-maintenance.com/maint/home.php
http://www.tabac4u.com
Reply With Quote
  #19  
Old 09-03-2007, 10:06 AM
 
blakekr blakekr is offline
 

Senior Member
  
Join Date: Apr 2007
Posts: 99
 

Default Re: Best Sellers for the Month Only

Thank you so much for sharing the original, and everyone who posted 4x revisions. I haven't tried this yet, so may come back with questions -- but it's very kind of you.
__________________
Starting again with XCart 4.1.6 gold ...
Reply With Quote
  #20  
Old 09-03-2007, 04:25 PM
  Jon's Avatar 
Jon Jon is offline
 

X-Guru
  
Join Date: Oct 2002
Location: Vancouver, Canada
Posts: 4,200
 

Default Re: Best Sellers for the Month Only

Glad to see people are still benefiting from this, thanks for posting the updates
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 11:45 PM.

   

 
X-Cart forums © 2001-2020