I am trying to find out, for a product, for a date range, the following

  1. How many times was it sold individually
  2. How many times was it sold as part of another product ( bundled or grouped ) and what that product is.

I think I can use the $collection = Mage::getModel('sales/order') but am not sure how to interrogate what I am getting back from that collection in PHPStorm. Would someone be able to help me with this?

1 Answer 1


1) For getting the details about the count of the product sold you can easily get from the sales and order related tables. 2) For group products I think you are bound and required to manage different tables and required to use join query to have combination of results.

  • Thank you for your answer. So then to get totals I'll foreach over the $collection but how can I see what columns are in that collection? I spent time yesterday trying to see what Sales/Order returns but to no avail, any suggestions?
    – thetimmer
    Sep 6, 2014 at 1:20
  • If u want to see the collection's value you can see it by using print_r. If u you are knwing then collection is always an array so by printing the values using that you will get alk the columns of the db. Try this out.
    – LR Soni
    Sep 6, 2014 at 20:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.