How to properly manage VAT (Tax) in magento?

I need to show price, msrp and shipping price with or without tax depending on the currently logged in customer group in instant search results.

In order to get there, I tried to find out how you are actually managing tax. As far as I can see it, you are trying to pre-calculate the tax before upload. However, I only get non tax values in my index, so this doesn’t seem to work.

Any simple Idea how I can attac that?
My current view would be - but this seems a rather large task:

  1. Duplicate the price generation logic into price and price_with_tax
  2. Duplicate the above logic to also calculate the same for msrp/msrp_with_tax and shipping/shipping_with_tax. At least we don’t have customer groups coming in our way here.
  3. On frontend generate the template either for price or price_with_tax etc, depending on current logged in customer



answering my onw question.
Basically above was correct:

  1. This is already there in the backend, just not used in the frontend. Weird!

  2. I created an observer on algolia_after_create_product_object that does this:

     public function adjustAttributes($observer) {
         	$product = $observer->getData()['productObject'];
         	$algoliaProductData = $observer->getProductData();
         	$this->addTaxPrices($product, $algoliaProductData);
     public function addTaxPrices($product,$algoliaProductData) {
         	$msrp = $product->getMsrp();
         	if(isset($msrp)) {
         		$msrpWithTax = (double) $this->taxHelper->getPrice($product, $msrp, true, null, null, null, $product->getStore(), null);
     		$msrpWithTaxFormatted = $this->formatPrice($msrpWithTax, false, "EUR");
     		$msrpFormatted = $this->formatPrice($msrp, false, "EUR");
     		$algoliaProductData->setData("msrp_with_tax", $msrpWithTax);
     		$algoliaProductData->setData("msrp_with_tax_formatted", $msrpWithTaxFormatted);
     		$algoliaProductData->setData("msrp_formatted", $msrpFormatted);
  3. In hit.phtml, adding something like:
    $taxkey = Mage::helper(‘marketplace/marketplace’)->isB2BCustomer() ? ‘’ : ‘_with_tax’;

    <?php echo $this->__('MSRP: ') ?>{{msrp<?php echo $taxkey; ?>_formatted}}

same with prices etc.