Qty on the database tables cataloginventory_stock and cataloginventory_stock_item are different from Magento admin page. I'm assuming there is a problem to load qty from the database.

I want to know how to load qty information from database to Magento admin page.

Thank you

2 Answers 2

$products = Mage::getModel('catalog/product')
    ->addAttributeToSelect(array('name', 'thumbnail', 'weight' ,'price','description'))

foreach ($products as $product) {
    $p['products'][] = array(
        'id'            => $product->getId(),
        'sku'           => $product->getSku(),
        'name'          => $product->getName(),
        'description'   => $product->getDescription(),
        'weight'        => $product->getWeight(),
        'created at'    => $product->getCreatedAt(),
        'pirce'         => Mage::helper('core')->currency($product->getPrice(), true, false), //." ".$currencyCode,
        'qty'           => $product->getQty(),

Check this link for more Get product stock quantity in magento

  • can you tell me the path of this code?
    – Diny Na
    Commented Jun 6, 2017 at 18:30
  • Which admin page do you want to load? Commented Jun 6, 2017 at 18:44
  • on magento admin page....what do you mean which admin?
    – Diny Na
    Commented Jun 6, 2017 at 18:46
  • Sorry , this code can help you to get product stock. You can use it for your problem . This is snippet of code. Commented Jun 6, 2017 at 19:18
  • Which part of adming page , the qty is not right? Catalog grid? Admin Edit product ? Commented Jun 6, 2017 at 19:19

3 tables are mainly used to manage the stock : cataloginventory_stock, cataloginventory_stock_item and cataloginventory_stock_status

If you need to get or update a product's stock quantity you will need to find the relevant line in the cataloginventory_stock_item table It's not normal that quantity show in Magento Admin page is different, do you use third party extension to manage stock like ERP ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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