Ejemplo n.º 1
0
     }
     echo $msn;
     die;
 }
 $dif = $price2 - $price;
 if ($dif >= 0) {
     $favor = 0;
 } else {
     $favor = $dif * -1;
     $dif = 0;
 }
 try {
     $id_exchange = $inter->setExchange(array('id_customer' => $_POST['id_usuario'], 'forma_pago' => $_POST['forma_pago'], 'total_in_favor' => $favor, 'total_dif' => $dif));
     $reference = "I" . date('Ym') . sprintf('%04d', $id_exchange);
     $inter->setReferencia($reference, $id_exchange);
     $sales = $inter->setItemSales($id_exchange, $results);
     $buys = $inter->setItemBuys($id_exchange, $results2);
     if (is_array($sales)) {
         foreach ($sales as $sale) {
             $inter1 .= $sale;
         }
     }
     if (is_array($buys)) {
         foreach ($buys as $buy) {
             $inter2 .= $buy;
         }
     }
     $customer = new Customer((int) $_POST['id_usuario']);
     $configuration = Configuration::getMultiple(array('PS_LANG_DEFAULT', 'PS_SHOP_EMAIL', 'PS_SHOP_NAME'));
     $id_lang = (int) $configuration['PS_LANG_DEFAULT'];
     $template = 'intercambio';