This is probably a very easy question. (many of mine seem to be)
But how do you get basic product information to be echo'd on product view page. Here are the things I am trying to access:
Essentially I'm looking for something like
<?php echo $_product->getQty(); ?>
Except that would only give the in cart quantity, but it doesn't even work.
Thanks in advance!
Use this to get product quantity
<?php echo (int) Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getQty(); ?>
If you are looking to get an attribute on that product you can do it like this:
$_product->getColor() where Color is attribute name. Or you can call an attribute using this syntax:
$this->htmlEscape($_product->getData(color));
Since the restock date is a custom attribute you can simply edit it from the admin (Catalog > Attributes > Manage Attributes) and change it's "Visible on Product View Page on Front-end" to "Yes".
$_stock_data = $_product->getStockItem()->getData();
print_r($_stock_data);
So to get quantity.
$_product->getStockItem()->getQty();
Courtesy : Jagi Yadav