Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

best sellers in a time period


pars

Recommended Posts

how do I set the best seller box to show the best sold products in a certain period of time?

 

e.g. best sellers in past 4 weeks.

 

thanks :)

Link to comment
Share on other sites

The qty in products ordered is total sold since the shop opened.

 

You could zeroise the qty ordered and then recalculate the qty sold in the last x days and use that.

 

First part is

 

update products set products_ordered = 0

Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

 

Virus Threat Scanner

My Contributions

Basic install answers.

Click here for Contributions / Add Ons.

UK your site.

Site Move.

Basic design info.

 

For links mentioned in old answers that are no longer here follow this link Useful Threads.

 

If this post was useful, click the Like This button over there ======>>>>>.

Link to comment
Share on other sites

And part 2a is

 

SELECT products_id,SUM(products_quantity) FROM orders_products GROUP BY products_id

Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

 

Virus Threat Scanner

My Contributions

Basic install answers.

Click here for Contributions / Add Ons.

UK your site.

Site Move.

Basic design info.

 

For links mentioned in old answers that are no longer here follow this link Useful Threads.

 

If this post was useful, click the Like This button over there ======>>>>>.

Link to comment
Share on other sites

And this is part 2b

 

SELECT op.products_id, SUM( op.products_quantity )

FROM orders_products op, orders o

WHERE o.orders_id = op.orders_id

AND datediff(now(), o.date_purchased) < 28

GROUP BY op.products_id

 

off to dev.mysql.com again

Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

 

Virus Threat Scanner

My Contributions

Basic install answers.

Click here for Contributions / Add Ons.

UK your site.

Site Move.

Basic design info.

 

For links mentioned in old answers that are no longer here follow this link Useful Threads.

 

If this post was useful, click the Like This button over there ======>>>>>.

Link to comment
Share on other sites

This seems to do it

 

update products set products_ordered = 0

 

UPDATE products p SET products_ordered = ( SELECT SUM( op.products_quantity )

FROM orders_products op, orders o

WHERE p.products_id = op.products_id

AND o.orders_id = op.orders_id

AND datediff( now(), o.date_purchased) < 28

GROUP BY op.products_id )

 

But don't trust me, backup first.

Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

 

Virus Threat Scanner

My Contributions

Basic install answers.

Click here for Contributions / Add Ons.

UK your site.

Site Move.

Basic design info.

 

For links mentioned in old answers that are no longer here follow this link Useful Threads.

 

If this post was useful, click the Like This button over there ======>>>>>.

Link to comment
Share on other sites

thanks for your answer dear "geoffreywalton". that was great. but assume that I'm newbie! :S

would you mind explain for me in more simple words? where should make these changes in my shop and does it have modules to do such a thing?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...