Best way to get quantity of an eCommerce product

Permalink
I need to get the quantity of an eCommerce product for use on a single page (if a certain product is sold out, I'm going to show a notice and maybe disable site registration). Anyone know how to do this? I think I should use this:

$product->getProductQuantity()


but I'm not sure how to set $product.

Thanks!

AlbertPotato
 
AlbertPotato replied on at Permalink Best Answer Reply
AlbertPotato
I just figured this out. In case anyone else needs it, here's what I'm using:
Loader::helper('urls', 'core_commerce');
Loader::model('product/model', 'core_commerce');
$product = CoreCommerceProduct::getByID(12);
$product->getProductQuantity();
JohntheFish replied on at Permalink Reply
JohntheFish
Using Magic Data Commerce this snippet could be inserted in to a content block (or many other types of block).
[%SET "Molly Mallard" AS_PRODUCT PRODUCT_QUANTITY%]