Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Displaying the number of orders for a specific product?


Guest

Recommended Posts

Posted

Hey all.. Here I go again.. [night owl].... :idea:

 

I am sitting here.. trying to add some "cool" stuff to the store as I am so much struggling to build the database with all the products. OK writing is not my thing.. I know..

 

Anyways.. before I lose the train of thought.. Would it be nice if we could somehow querry the database, or somehow add the functionality to show something to the extent of "STORE_NAME sales rank" as Amazon.com has it.. for each product.. That would be kind of cool.. Any comments or suggestions?

Posted
Any comments or suggestions?

 

Shouldn't be 2 difficult :)

 

Query the products table for the field products_ordered then sort that in descending order and insert it into a new table called products_sales_rank.

 

Then just query this table on the product_info.php :)

 

The reason I suggest you do not do it dynamically is it will degrade performance. Just update the product_sales_rank table once a day / week :)

Mark Evans

osCommerce Monkey & Lead Guitarist for "Sparky + the Monkeys" (Album on sale in all good record shops)

 

---------------------------------------

Software is like sex: It's better when it's free. (Linus Torvalds)

Posted
Shouldn't be 2 difficult :)

 

Query the products table for the field products_ordered then sort that in descending order and insert it into a new table called products_sales_rank.

 

Then just query this table on the product_info.php :)

 

The reason I suggest you do not do it dynamically is it will degrade performance. Just update the product_sales_rank table once a day / week :)

 

Actually I got an even easier solution.. here is what I did...

On products_info.php a line is as follows..

 

$product_info = tep_db_query("select p.products_id, p.products_ordered, pd.products_name.........

 

As you can see I asked it to query the p.products_ordered as well. and then I echo-ed the $products_info['products_ordered'] where I wanted the total order to display.. kind of cool.. Of course.. now some tweaking would be nice.. for example add a , after a thousand 100 thousand to kind of make it look nicer...

 

Now any suggesions on how to do that.. ? :D

Archived

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

×
×
  • Create New...