Custom Report of Product Sales

  • Posts: 176
  • Thank you received: 5
  • Hikashop Business
1 year 7 months ago #351819

What would be the best way to go about creating a report with the following?

A list of all products/variants with the following fields:

Product ID, Product Name, Product Category, Total Sales, Quantity on Hand, Published Status

Where Total Sales is the total number of individual products sold of that product.

I need to be able to export this data as a csv.

Seems like getting this data out of an Ecommerce solution should be easy. For the life of me, I can't seem to get this to work. Am I missing something?

Please Log in or Create an account to join the conversation.

  • Posts: 83022
  • Thank you received: 13403
  • MODERATOR
1 year 7 months ago #351823

Hi,

With a mass action, in System>Massactions, you can use an action "export CSV file" on the product data with the columns product_id, product_name, category_name, product_sales, product_quantity and product_published and you'll get what you want. Note however that in that case, you can't select the period for the sales data, nor the order statuses to take into account, so the product_sales value might not be what you want.
In fact, you can get this data with the press of a button with the "export" button on the products listing, so it seems pretty easy to me.

Now, if you want something accurate for the sales, you can go in the Orders>Reports menu. There, you should have a "top sales" report already precreated. That report will display the columns: product_name, sales and product_id
The data you'll get can be tweaked to take into account a certain period of time, and you can also select the order statuses to take into account with the settings of the report. Also, you can change the "limit" setting to increase the number of results to output (if you have a lot of entries, it can lead to a long processing time since everything is calculated dynamically).
Finally, if you change the "Displayed Information" setting to "orders", you'll also get the quantity sold, which will be accurate as it will be dynamically calculated based on the time period selected, the order statuses selected, etc.
It's a bit more complex than a mass action, and it doesn't have all the columns you want but it is accurate and more customizable regarding the filtering of the data. Now, if you want extra columns to be generated by the report, it should be possible with a view override and a bit of PHP coding.

Please Log in or Create an account to join the conversation.

  • Posts: 176
  • Thank you received: 5
  • Hikashop Business
1 year 7 months ago #351844

Thank you for this explanation.

On the 'export' button on the product listing. Are there any server settings you suggest? Every time we run this the server times out and generates a 500 server error.

We have about 1000 products in the database. Some with 5-10 variants.

Please Log in or Create an account to join the conversation.

  • Posts: 83022
  • Thank you received: 13403
  • MODERATOR
1 year 7 months ago #351849

Hi,

Well, if you click on the export without selecting any products, it will export all the products and variants. So it first needs to load everything from the database in the PHP memory and then generate the CSV from the data.
The server settings to recommend will depend on the total number of products / variants and the capacity of your server ( RAM and CPU ), how it is configured, etc.
So it's difficult to recommend anything precise like that. If you get a 500 timeout error, it's likely that the "max_execution_time" of your php.ini is too low. When it's a memory limitation, it's normally another error and in that case it's the "memory_limit" you need to increase in the php.ini

Please Log in or Create an account to join the conversation.

  • Posts: 176
  • Thank you received: 5
  • Hikashop Business
1 year 7 months ago #351888

Thank you. The issue was a 180 second timeout on the firewall we have on the website. We are working around it.

Please Log in or Create an account to join the conversation.

Time to create page: 0.058 seconds
Powered by Kunena Forum