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 8863319
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T15:56:52+00:00 2026-06-14T15:56:52+00:00

Magento CE ver. 1.7.0.2 I’m trying to grab some order data from our Magento

  • 0

Magento CE ver. 1.7.0.2

I’m trying to grab some order data from our Magento store to integrate into our other business software. In my case I need to compute the price plus tax on individual items. The below code only works if Display Product Prices In Catalog is set to Include or Both (in System > Configuration > Sales > Tax). How can I calculate the tax on an item while still having the website display prices excluding tax?

$customer_tax_class = Mage::getModel('tax/calculation')->getRateRequest()->getCustomerClassId();
$_product = Mage::getModel('catalog/product')->loadByAttribute('sku',$skunumber);
$my_price = Mage::helper('tax')->getPrice($_product, $_product->getPrice(), true, $shippingAddress, $billingAddress, $customer_tax_class);

I also tried using this instead, but I still get prices without tax (unless I change display settings mentioned above):

$_finalPriceInclTax = Mage::helper('tax')->getPrice($_product, $_product->getFinalPrice(), true, $shippingAddress, $billingAddress, $customer_tax_class); 

I know it must be possible, as Magento figures out the tax when you place the order. Any help would be greatly appreciated.

  • 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-06-14T15:56:53+00:00Added an answer on June 14, 2026 at 3:56 pm

    It took a while to get all the parameters I needed, as we are using a highly customized checkout, but here’s what eventually worked for me

        $my_quote = Mage::getSingleton('checkout/session')->getQuote();             
        $my_customer = Mage::getSingleton('customer/session')->getCustomer();
        $my_items = $quote->getAllItems();
        $taxClassId = $qty = $price = array();
        foreach ($my_items as $key => $my_item) {
          //get the price plus tax for this item
          // get the product tax id for this item first.
          $my_sku = $my_item->getSku();
          $qty[$my_sku] = $my_item->getQty(); 
          $taxClassId[$my_sku] = Mage::getModel('catalog/product')->load(
                      $my_item->getProductID())->getData("tax_class_id");
          $price[$my_sku] = Mage::getModel('catalog/product')->load(
                      $my_item->getProductID())->getData("price");
        }
        $my_store = Mage::app()->getStore($my_quote->getStoreId());
        $ctc = $my_customer->getTaxClassId();
        $tax_calc = Mage::getSingleton('tax/calculation');
        $tax_rate_req = $tax_calc->getRateRequest(
            $shippingAddress,
            $billingAddress,
            $ctc,
            $my_store);
        if(is_Array($taxClassId)){
        foreach($taxClassId as $key => $value){
          $my_rate[$key] = Mage::getSingleton('tax/calculation')->getRate(
                     $tax_rate_req->setProductClassId($value));
        }    
        foreach($my_rate as $key => $value){
          foreach($split_filter as $my_key => $my_value){
             //This is used because we split orders based on their shipping method
            if($my_value == $key){
            // This code might malfunction if tax rate is an integer (i.e. 8%)
            if(is_float($value)){
              $my_price = $price[$key];
              $my_qty = $qty[$key];
              $taxy = Mage::getModel('tax/calculation')->calcTaxAmount(
                 $my_price, 
                 $value
              );
              $price_withtax = $my_price + $taxy;
              // still need to multiply times qty ordered to get row totals
              $row_total = ($price_withtax * $my_qty);
            } else {// $value is not a float.
              $row_total = ($price[$key] * $qty[$key]);
            }
              // then add to other rows to get subtotal
              $subtotal_with_tax += $row_total;
          }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to change the price format in Magento ver. 1.5.1.0 from €8.49 to
I'm trying to append complex data to my database products in Magento ver. 1.7.0.2,
I'm using Magento Community Edition ver. 1.6.2.0. I’m trying to add a Simple product
Magento Orders->Google Sitemap ... since recently a blank page?!!!! Hi since some weeks our
Magento 1.6.1 I am trying to get form data on my observer. I tried
I am currently working on a Magento store (ver. 1.6.2.0) however when i click
I’m trying to program Magento from c#. In the first step I added Service
I'm using Magento ver. 1.6.1.0 I'd like to add 8lbs to each order (packing
Magento 1.3 I'm trying to filter out of stock items from the productCollection. Using:
I am new to Magento and i am using Magento Ver. 1.6.1.0 - Custom

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.