I display a best-sell list in front-end,Now I also want to show the QTY that how many already sell for this product,How do I get the Q开发者_如何学编程TY ? And if the product is a "Configurable Product",How do I get the QTY ?
Your question is a little unclear. This is how to get the quantity available for a product, which actually means the STOCK.
// get the quantity for a Mage_Catalog_Model_Product $product
$productStockItem = $product->getStockItem();
$productStockItem->getQty();
If you want the number of sold items you'll have to select all your orders and search for products in there, and is a little more complicated. I dont think that the type of product and the display frontend or backend makes it different in any way.
精彩评论