Ejemplo n.º 1
0
 /**
  *	Gets the total amount to be paid for the items in the cart, including taxes and other modifiers
  *	@access public
  *	@return float
  */
 public function recalculate_all_cart_totals()
 {
     $pre_tax_total = $this->get_cart_total_before_tax();
     $taxes_total = EEH_Line_Item::ensure_taxes_applied($this->_grand_total);
     $this->_grand_total->set_total($pre_tax_total + $taxes_total);
     $this->_grand_total->save_this_and_descendants_to_txn();
     return $this->get_grand_total()->total();
 }
 /**
  * Creates a bunch of registrations and returns an array of all the "approved" ones
  * @param array $ticket_quantities top-level-keys are ticket IDs,
  * next-level keys are either 'included' or 'not'.
  * @param EE_Line_Item $grand_total
  * @return a flat array of all the registrations that were for 'included'
  */
 protected function _create_regs($ticket_quantities, $grand_total)
 {
     $txn = $this->new_model_obj_with_dependencies('Transaction');
     $regs_to_include = array();
     foreach ($ticket_quantities as $ticket_id => $approved_or_not_counts) {
         foreach ($approved_or_not_counts as $key => $count) {
             for ($i = 0; $i < $count; $i++) {
                 $r = $this->new_model_obj_with_dependencies('Registration', array('TXN_ID' => $txn->ID(), 'TKT_ID' => $ticket_id));
                 if ($key == 'included') {
                     $regs_to_include[] = $r;
                 }
             }
         }
     }
     $grand_total->save_this_and_descendants_to_txn($txn->ID());
     return $regs_to_include;
 }