This extension will get you what you need. I just purchased it and installed it, it works great but if you have a large amount of SKU's I wouldn't recommend it.
Magento 1 Report: Which products have never been ordered, or haven't been ordered after date X and disable
-
28-06-2022 - |
Question
So.. Native Magento only exports data if a product has been sold. We all know this, we all have used it, dealt with it, loathed it at some point in time..
I need to be able to generate a report that shows ALL items by quantity sold, to include those that have never sold ( 0, or zero quantity sold ). We're doing this so that I can pull some items off of the website that rarely sell, or never sell, so that we aren't manufacturing onsies and twosies.
I understand data needs to be populated to run the report and the search query bases it off whatever items have a '1' or greater - BUT the data is still present there just is not an order associated with it, thus never setting it within the applicable limits of the report query.
Is there a way to modify the search query to include these "never-sold" items, or any other method?
I am on Magento Enterprise 1.12.02, but the report templates/methods should be similar across the board - if not i've managed to replicate them in the past.
No correct solution
OTHER TIPS
Using this MySQL query, you can get a list of products that never sold.
select entity_id, sku, (SELECT value FROM catalog_product_entity_varchar WHERE entity_id = catalog_product_entity.entity_id AND attribute_id = 72) as name
from catalog_product_entity
where entity_id not in (select product_id from sales_flat_order_item group by product_id)
To get your site's attribute id for "name", run this query and replace the 72 on the above query
SELECT attribute_id FROM eav_attribute
WHERE entity_type_id=4 AND attribute_code='name'
Check out this query where you can edit
- product
created_at
date to include only products added before a certain date usingcat.created_at < "2019-07-01 00:00:00"
- include products that were never sold (NULL) or only sold last before a certain date using
sale.created_at IS NULL OR sale.created_at < "2020-01-01 00:00:00"
- include ony products that have no stock using
stock.qty = 0
- filter out products matching someS SKU match using multiple
cat.sku not like 'SOH%'
SELECT cat.entity_id, cat.sku, cat.created_at as product_created, sale.created_at as last_sold
FROM catalog_product_entity AS cat
LEFT JOIN sales_flat_order_item AS sale ON cat.entity_id = sale.product_id
INNER JOIN cataloginventory_stock_item as stock ON cat.entity_id = stock.product_id
WHERE (sale.created_at IS NULL OR sale.created_at < "2020-01-01 00:00:00")
AND (cat.sku not like 'SOH%' and cat.sku not like 'ML7%' and cat.sku not like 'SOC%' and cat.sku not like 'LL%' and cat.sku not like 'ALG%')
AND cat.created_at < "2019-07-01 00:00:00"
AND cat.entity_id = stock.product_id
AND stock.qty = 0
group by cat.entity_id
and if you are 100% sure you could feed this to an update statement
guys BACKUP BACKUP Before
UPDATE catalog_product_entity_int
SET value = 2
WHERE attribute_id = (SELECT attribute_id FROM eav_attribute WHERE attribute_code = "status" and entity_type_id = 4)
AND entity_id IN (
SELECT cat.entity_id
FROM catalog_product_entity AS cat
LEFT JOIN sales_flat_order_item AS sale ON cat.entity_id = sale.product_id
INNER JOIN cataloginventory_stock_item as stock ON cat.entity_id = stock.product_id
WHERE (sale.created_at IS NULL OR sale.created_at < "2020-01-01 00:00:00")
AND (cat.sku not like 'SOH%' and cat.sku not like 'ML7%' and cat.sku not like 'SOC%' and cat.sku not like 'LL%' and cat.sku not like 'ALG%')
AND cat.created_at < "2019-07-01 00:00:00"
AND cat.entity_id = stock.product_id
AND stock.qty = 0
group by cat.entity_id
)
Feedback appreciated