Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6542243
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:12:08+00:00 2026-05-25T11:12:08+00:00

In the Order View (the main screen when viewing a customer’s order), I would

  • 0

In the Order View (the main screen when viewing a customer’s order), I would like to add a few table rows and add the Customer’s Lifetime Sales (Total Sales) and Total Amount of Orders.

The file I want to add the code is here: app/design/adminhtml/default/default/template/sales/order/view/info.phtml

In this file, below:

<?php foreach ($this->getCustomerAccountData() as $data):?>
  <tr>
    <td class="label"><label><?php echo $data['label'] ?></label></td>
    <td class="value"><strong><?php echo $data['value'] ?></strong></td>
  </tr>
<?php endforeach;?>

Is where I’d add my the rows/cells I need with the correct information. Could you please tell me how to get the necessary data?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T11:12:09+00:00Added an answer on May 25, 2026 at 11:12 am

    this is how you get the lifetime sales:

    $customer = Mage::getModel('customer/customer')->load($customerId);
    $customerTotals = Mage::getResourceModel('sales/sale_collection')
         ->setOrderStateFilter(Mage_Sales_Model_Order::STATE_CANCELED, true)
         ->setCustomerFilter($customer)
         ->load()
         ->getTotals();
    $customerLifetimeSales = $customerTotals->getLifetime();
    $customerNumberOfOrders = $customerTotals->getNumOrders();
    

    This is a var_dump of $customerTotals:

    object(Varien_Object)[662]
      protected '_data' => 
        array
         'lifetime' => float 10503.13
         'base_lifetime' => float 10503.13
         'base_avgsale' => float 92.9480530973
         'num_orders' => int 113
         'avgsale' => float 92.9480530973
      protected '_hasDataChanges' => boolean false
      protected '_origData' => null
      protected '_idFieldName' => null
      protected '_isDeleted' => boolean false
    

    You can place that code in a method on your block and call it in each row. Somthing like:

    public function getCustomerTotals(Mage_Customer_Model_Customer $customer)
    {
        // TODO: Add necessary validation...
        return Mage::getResourceModel('sales/sale_collection')
            ->setOrderStateFilter(Mage_Sales_Model_Order::STATE_CANCELED, true)
            ->setCustomerFilter($customer)
            ->load()
            ->getTotals();
    }
    

    and in your code there you can add:

    <?php $customerTotals = $this->getCustomerTotals($customer); ?>
    <td><?php echo $customerTotals->getLifetime(); ?></td>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to create my logout view for many reasons but the main
I want to rewrite core/adminthtml/block/widget/tabs.php class which is a super class for core/adminhtml/block/sales/order/view/tabs.php class.
How would I go about drawing a view offscreen in order to perform some
Lets assume I have the following 3 entities: Customer,Order,Product which interact in the View
I have a view with several buttons and an ImageView. I would like to
I'm returning JSON from my controller to my view in order to populate a
In my Django project I am using Product.objects.all().order_by('order') in a view, but it doesn't
I have a View class (OrderView.aspx) which shows the details of an order (Account
I try to set the anchorPoint property, in order to rotate a view by
Consider a normal customer-orders application based on MVC pattern using WinForms. The view part

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.