How to get ordered qty of product in front-end?
-
23-09-2019 - |
문제
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 QTY ? 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.
제휴하지 않습니다 StackOverflow