3

I working to Magento 2.0.2 and i trying to call the table stock_item of the product. When i worked in Magento 1.9 i used this code:

 loadByProduct($_product)->getQty();?> 

But now the class Mage is not compatible with the new version of Magento. So how i do for call this table in my .pthml file?

Thank you very much for any help.

P.S. On other question, what is the .phtml file where is called the name of the product?

0

If you need to show quantity on Store Front then you should use \Magento\CatalogInventory\Api\StockRegistryInterface::getStockStatus method like:

$stockRegistry->getStockStatus($product->getId())->getQty()
  • Thank you man but this code is not good for my magento. This code not call the table of stock quantity of my quantity. The problem is this, i created four type of quantity for my product in my table of database and i don't know as recall any single of this data for any product and showing in front end... – Gabriel91 Feb 8 '16 at 8:29
  • In magento 1.9 existed the Class Mage for this but now? Thanks again... – Gabriel91 Feb 8 '16 at 9:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.