1

We override the Mage_Tax_Model_Config to have different tax settings for specific customer groups. Everything went well except for the PDF documents.

We checked the current customer group ID with $customer->getGroupId() where $customer is Mage::helper('customer')->getCustomer();

Why this is don't work on the PDF documents? Please see the override class in detail:

public function displaySalesPricesInclTax($store = null)
{
    $customer = Mage::helper('customer')->getCustomer();
    if ($customer->getGroupId() > 1) {
        return false;       
    } else {
        return true;
    }
}

public function displaySalesPricesExclTax($store = null)
{
    $customer = Mage::helper('customer')->getCustomer();
    if ($customer->getGroupId() > 1) {
        return true;        
    } else {
        return false;
    }
}

1 Answer 1

3

The customer helper class method is

public function getCustomer()
{
    if (empty($this->_customer)) {
        $this->_customer = Mage::getSingleton('customer/session')->getCustomer();
    }
    return $this->_customer;
}

The pdfs are normally only created in the back-end so you would not be working with a customer session. And if I am not mistaken the default Magento pdfs simply do not provide a way to change the price display to be tax inclusive or tax exclusive to start with.

1
  • I was going to mention the same thing about the customer session not being available in the backend where PDFs are created. If the PDFs are not updated when adjusting config settings at tax/sales/display then that should be something I would hope would be fixed, or a separate section in tax/sales for PDF settings.
    – pspahn
    Commented Aug 29, 2013 at 6:26

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.