Exemplo n.º 1
0
 /**
  *     calculate taxes
  * @access        private
  * @return        array
  */
 private function _calculate_taxes()
 {
     $tax_totals = array();
     foreach ($this->_taxes as $taxes) {
         foreach ($taxes as $tax) {
             if ($tax instanceof EE_Price) {
                 // create ticket price object from tax data
                 $tax_object = new EE_Price_Composite($tax, $this->PRC_MDL()->get_one_by_ID($tax->type()));
                 $this->_grand_total = new EE_Ticket_Price_Modifier($this->_grand_total, $tax_object);
                 // template args
                 $this->_calculated_taxes[$tax->ID()] = array('name' => $tax->name(), 'percent' => $tax->amount(), 'amount' => $this->_grand_total->mod_amount());
                 $tax_totals[$tax->ID()] = $this->_grand_total->mod_amount();
             }
         }
     }
     // add tax data to session
     EE_Registry::instance()->SSN->set_session_data(array('taxes' => $this->_calculated_taxes, 'tax_totals' => $tax_totals, 'grand_total_price_object' => $this->_grand_total, '_cart_grand_total_amount' => $this->_grand_total->price()));
 }