Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TopProductTypes strip non-producttype purchasables #1720

Closed
Anubarak opened this issue Sep 10, 2020 · 1 comment
Closed

TopProductTypes strip non-producttype purchasables #1720

Anubarak opened this issue Sep 10, 2020 · 1 comment
Assignees

Comments

@Anubarak
Copy link

Description
Our client created a TopProductType widget
image
and is confused because of the empty line. This is because we have purchasables that are not variants. The query

SELECT pt.id AS id, pt.name, SUM(li.qty) as qty, SUM(li.total) as revenue
FROM commerce_orders orders
INNER JOIN elements elements ON elements.id = orders.id
LEFT JOIN commerce_lineitems li ON li.orderId = orders.id
LEFT JOIN commerce_purchasables p ON p.id = li.purchasableId
LEFT JOIN commerce_variants v ON v.id = p.id
LEFT JOIN commerce_products pr ON pr.id = v.productId
LEFT JOIN commerce_producttypes pt ON pt.id = pr.typeId
LEFT JOIN content content ON (content.elementId = v.productId) AND (content.siteId=1)
WHERE (dateOrdered >= '2020-09-06 22:00:00') AND (dateOrdered <= '2020-09-13 21:59:59') AND (isCompleted=1) AND (elements.dateDeleted IS NULL)
GROUP BY pt.id
ORDER BY SUM(li.qty) DESC
LIMIT 5

currently has the following result
image

Could you eventually strip those out or write at least something like "Not a product type" please?

@nfourtythree
Copy link
Contributor

Hi @Anubarak

Thank you for bringing this to our attention.

We have pushed a fix for this that will be included in the next Commerce release.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants