Post by karlpers » Sun Jan 15, 2012 5:19 am

I have some doubts on how the bestseller list are presented. Is it how many times a product has been sold, or is it the total amount sold? I dont really understand how the module works.

Eg. My reports>products>purchased:
The product name 8 - 210 sales - $8,389.50 total
The product name 2 - 4 sales - $539.80 total
The product name 1 - 1 sale - $39.95 total

My bestseller list:
The product name 2
The product name 8
The product name 1

If I purchase the Product name 8, it goes up on top, but the same with Product 2. For me it looks like it shows "latest sold products"

Does my catche has something to do with this? Its a fresh installed store.. Anyone with the same problem?

Active Member

Posts

Joined
Tue Jun 09, 2009 10:35 pm

Post by Molok » Mon Jan 30, 2012 6:49 pm

Hi,

I have the same question.
It doesn't make sense if the Bestseller list is in fact generated as a list of last sold items.

Like the name says the Bestseller module should generate a list of the best selling items in terms of numbers of items sold.

Newbie

Posts

Joined
Mon Jan 30, 2012 6:44 pm

Post by Qphoria » Mon Jan 30, 2012 10:19 pm

It is "Best" sellers. It is sorted by MOST sold item, not most recent.
If you sold
5x ipods
2x hp laptops
4x Ipads
6x TV's

it would list them in this order, greatest to least:
1. TV
2. ipods
3. ipads
4. hp laptops

This is and has always been.

There is a mod for "Recently Purchased" here if you want that:
http://www.opencart.com/index.php?route ... ion_id=444

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by karlpers » Mon Jan 30, 2012 11:27 pm

Well, not a big issue any more though, but as Qphoria says is how I expected the list to be. But it doesnt, as I describe in the first post the list in my case is a bit wierd where the most sold (both in Quantity and Total isnt at position 1 in the list.

Maybe there is some circumstances which makes my store shows the bestseller a bit different..

Active Member

Posts

Joined
Tue Jun 09, 2009 10:35 pm

Post by PinkPearl » Tue Mar 13, 2012 5:05 am

Qphoria wrote:It is "Best" sellers. It is sorted by MOST sold item, not most recent.
If you sold
5x ipods
2x hp laptops
4x Ipads
6x TV's

it would list them in this order, greatest to least:
1. TV
2. ipods
3. ipads
4. hp laptops

This is and has always been.

There is a mod for "Recently Purchased" here if you want that:
http://www.opencart.com/index.php?route ... ion_id=444
I would like to follow up on this because my "Best sellers" list certainly isn't sorted by the most items sold. In fact it doesn't seem to be sorted by anything at all. Is this a glitch? I am using Version 1.5.1.3

Thanks for your attention.

New member

Posts

Joined
Sun Oct 09, 2011 5:35 am

Post by rph » Tue Mar 13, 2012 5:56 am

I was just looking at this the other day. Whether it's wrong is probably debatable (it's number of customers who bought a product versus the number of the product sold) but the issue comes from doing a COUNT instead of a SUM.

To alter it in the getBestSellerProducts function in /catalog/model/catalog/product.php change:

Code: Select all

$query = $this->db->query("SELECT op.product_id, COUNT(*) AS total FROM " . DB_PREFIX . "order_product op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id) LEFT JOIN `" . DB_PREFIX . "product` p ON (op.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE o.order_status_id > '0' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' GROUP BY op.product_id ORDER BY total DESC LIMIT " . (int)$limit); 
to:

Code: Select all

$query = $this->db->query("SELECT op.product_id, SUM(op.quantity) AS total FROM " . DB_PREFIX . "order_product op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id) LEFT JOIN `" . DB_PREFIX . "product` p ON (op.product_id = p.product_id) LEFT JOIN " . DB_PREFIX . "product_to_store p2s ON (p.product_id = p2s.product_id) WHERE o.order_status_id > '0' AND p.status = '1' AND p.date_available <= NOW() AND p2s.store_id = '" . (int)$this->config->get('config_store_id') . "' GROUP BY op.product_id ORDER BY total DESC LIMIT " . (int)$limit); 
I haven't tested the changes for query speed so keep that in mind.

-Ryan


rph
Expert Member

Posts

Joined
Fri Jan 08, 2010 5:05 am
Location - Lincoln, Nebraska

Post by PinkPearl » Wed Mar 14, 2012 12:44 am

Thanks RPH, I will give this a try.

New member

Posts

Joined
Sun Oct 09, 2011 5:35 am

Post by ultraburner » Sat Aug 18, 2012 5:09 am

I tried this code on my store and it didnt change the order of the items displayed.

Is there something wrong with this code?

Cheers Simon

Newbie

Posts

Joined
Wed Jul 18, 2012 7:32 am

Post by rph » Sat Aug 18, 2012 5:25 am

You'll need to clear out your cache files in /system/cache before there are changes (or wait a couple hours for it to happen automatically).

On a semi-related note I've released Bestsellers Advanced which allows bestselling products to be shown by category.

-Ryan


rph
Expert Member

Posts

Joined
Fri Jan 08, 2010 5:05 am
Location - Lincoln, Nebraska
Who is online

Users browsing this forum: No registered users and 1 guest