News:

Looking for documentation? Take a look on our wiki

Main Menu

Format 'taxRulesBill' in Order view like in Cart view

Started by gba, October 03, 2017, 14:43:31 PM

Previous topic - Next topic

gba

Hi!

In cart view of the template I am using ('Zeus' from Olympian Themes) there are three code parts creating output of 'taxRulesBill':
<?php foreach ($this->cart->cartData['DBTaxRulesBill'] as $rule) : ?>
<li class="list-group-item clearfix">
<div class="col-xs-9 text-right"><?php echo $rule['calc_name'?> :</div>
<div class="col-xs-3 text-right">
  <?php echo $this->currencyDisplay->createPriceDiv ($rule['virtuemart_calc_id'] . 'Diff'''$this->cart->cartPrices[$rule['virtuemart_calc_id'] . 'Diff'], FALSE); ?>
  </div>
</li>
<?php endforeach; ?>

<?php foreach ($this->cart->cartData['DATaxRulesBill'] as $rule) : ?>
<li class="list-group-item clearfix">
<div class="col-xs-9 text-right"><?php echo $rule['calc_name'?> :</div>
  <div class="col-xs-3 text-right">
<?php echo $this->currencyDisplay->createPriceDiv ($rule['virtuemart_calc_id'] . 'Diff'''$this->cart->cartPrices[$rule['virtuemart_calc_id'] . 'Diff'], FALSE); ?>
  </div>
</li>
<?php endforeach; ?>

<?php foreach ($this->cart->cartData['taxRulesBill'] as $rule) : ?>
<?php if($rule['calc_value_mathop']=='avalara') continue; ?>
<li class="list-group-item clearfix">
<div class="col-xs-9 text-right"><?php echo $rule['calc_name'?> :</div>
<div class="col-xs-3 text-right">
  <?php echo $this->currencyDisplay->createPriceDiv ($rule['virtuemart_calc_id'] . 'Diff'''$this->cart->cartPrices[$rule['virtuemart_calc_id'] . 'Diff'], FALSE); ?>
  </div>
</li>
<?php endforeach; ?>


Now I want the same output in the order view using the code above in my layout override.
What changes in the code above are necessary for that? (i. e. there is no 'currencyDisplay' method in the order view object available)

Thank you very much for any help in advance!

Kind regards,
Gerald

gba

Hi again!

I will try to state the situation more precisely:
The cart object contains arrays 'DBTaxRulesBill', 'DATaxRulesBill' and 'taxRulesBill' in property 'cartData'.
So it is easy to render the rules in this sequence:
First the rules of type 'DBTaxRulesBill', then the rules of type 'DATaxRulesBill' and finally the rules of type 'taxRulesBill'.
Such structured output is very good!

The order object, on the other hand, has an array 'calc_rules' in property 'orderdetails'.
Each rule element has a property 'calc_kind' containing either "DBTaxRulesBill", "DATaxRulesBill" or "taxRulesBill".
As you can see, the structure of bill tax rules here is totally different to the structure in the cart object.

Sure, I could create three temporary arrays - each for one of the rule types and then use the temporary arrays for output.
But I am wondering 1. why there are such differences in structure at all and 2. if - potentially - there already was some equivalence to the cart arrays 'DBTaxRulesBill', 'DATaxRulesBill' and 'taxRulesBill' in the order object?

Thank you for taking part in this topic and for any useful hint in advance!

Kind regards,
Gerald