Trying to get this to work, it is not return anything 🙁
$product = Mage::getResourceModel('reports/product_collection')
->addOrderedQty()
->addAttributeToFilter('sku', $_product->getSku());
echo 'Already Bought '.(int)$product->ordered_qty; ?>
magento-1ordersproductreports
Trying to get this to work, it is not return anything 🙁
$product = Mage::getResourceModel('reports/product_collection')
->addOrderedQty()
->addAttributeToFilter('sku', $_product->getSku());
echo 'Already Bought '.(int)$product->ordered_qty; ?>
Best Answer
As part of the function
addOrderedQty
it will only add product information for the simple product types. What you could to is rewrite this function so that it does not add the following to the join conditions.Then this will give you the information about all product types. Once you have this information you can simply get the first item and get the ordered_qty.