PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, February 8, 2022

[FIXED] How to get subtotal from order items collection in magento 1.9.2 community edition

 February 08, 2022     magento, magento-1.9, php     No comments   

Issue

I am trying to show order details on frontend just like backend enter image description here

Here is my code

$orderData = Mage::getSingleton('sales/order')->loadByIncrementId($incrementId);
$itemCollection = $orderData->getItemsCollection();

foreach($itemsCollection as $_items) {
    echo $_items->getName();
    echo $_items->getStatus();
    echo $_items->getOriginalPrice();
    echo $_items->getPrice();
    echo $_items->getQtyOrdered();
    echo $_items->getSubTotal();
    echo $_items->getTaxAmount();
    echo $_items->getPercent();
    echo $_items->getDiscountAmount();
    echo $_items->getRowTotal();
}

Apart from Subtotal I am getting Everything I tried this too:

echo $_items->getBaseSubtotal();

But I am still getting null value.


Solution

From Amit Bera's answer on Magento.SE:

base_subtotal is field of Order table.

it is not field to sales order item table..So you did not get data from $_items->getBaseSubtotal()

In order to get a sales item base total try below code:

$items->getBaseRowTotal();


Answered By - krishna singh
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home
View mobile version

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing