function saveAndSendOrder($is2checkout = false) { $user = new fpp_client_Model(); $userdata = $user->db2cls((int) @$_SESSION['conf']['client']['id']); /*Only send email to client, previously saved and send to admin store*/ if (isset($_SESSION['previos_2checkout_email'])) { basics::mail_html_utf8($userdata->mail_client, __("Confirmación de Pedido", false), $_SESSION['previos_2checkout_email'], $this->mail_store, $this->config_store_name); unset($_SESSION['previos_2checkout_email']); } else { $total = $_SESSION['conf']['cart']['subtotal_noformat'] + $_SESSION['conf']['order']['district_price']; $_SESSION['conf']['total_req'] = $total; Basic::currency($total); $_SERVER['HTTP_X_REQUESTED_WITH'] = 'xmlhttprequest'; $model = new fpp_order_Model(); $orm = $model->db2cls(); $id = (int) $_SESSION['conf']['client']['id']; $order = $_SESSION['conf']['order']; $subtotalall = $_SESSION['conf']['cart']['subtotal_noformat']; Basic::currency($subtotalall); $payment = new Paymentclass(); $paymentinfo = $payment->infomod($_SESSION['conf']['order']['payment_type']); $orm->set_fields(array('product_name_order' => $order['fname'] . ' ' . $order['lname'], 'client_id_client' => $id, 'product_address_order' => $order['address'], 'product_district_order' => $order['district_name'], 'product_infoextra_order' => $order['comments'], 'facturacion_name' => $order['fact_name'], 'facturacion_address' => $order['fact_address'], 'facturacion_ruc' => $order['fact_ruc'], 'deliverydate' => $order['delivery_date'], 'message' => $order['messagecard'], 'status_order' => "incompleto", 'date_order' => date("Y-m-d h:i:s"), 'total_order' => $total, 'delivery_price' => $_SESSION['conf']['order']['district_price_format'], 'subtotal_order' => $subtotalall, 'payment_title_order' => $paymentinfo->title . " \n " . $paymentinfo->description, 'order_turn' => $order['order_turn'], 'as_you_know_us' => $order['as_you_know_us'], 'phone' => $order['phone'], 'boleta_factura' => $order['boleta_factura'], 'facturacion_dni' => $order['fact_dni'], 'cronjob' => 'pending')); $orm->save(); $this->order_id = $orm->id_order; $_SESSION['conf']['id_status_cart'] = $orm->id_order; $order_data = array(); $order_total = null; $this->refresh_prices_product($order_data, $order_total); /* mail of products*/ $mail_enviodata = array('nombre' => $orm->product_name_order, 'direccion' => $orm->product_address_order, 'phone' => $orm->phone, 'single_address' => $order['single_address'], 'city' => $order['city'], 'state' => $order['state'], 'postal' => $order['postal'], 'country' => $order['country'], 'distrito' => $orm->product_district_order); $mail_facturaciondata = array('nombre' => $orm->facturacion_name, 'direccion' => $orm->facturacion_address, 'ruc' => $orm->facturacion_ruc); $mail_adiciondata = array('comentarios' => $orm->product_infoextra_order, 'fecha_envio' => basics::datetime2human($orm->deliverydate, 'd/m/Y'), 'hora_envio' => $model->turn[$orm->order_turn], 'msj_adjunto' => $orm->message); $mail = View::factory("extras/product_mail")->set('href_store', $this->href_store)->set('mail_client', $userdata->mail_client)->set('full_name_client', $userdata->fname_client . " " . $userdata->lname_client)->set('phone_client', $userdata->phone_client)->set('nro_pedido', $orm->id_order)->set('envio', $mail_enviodata)->set('tipo_de_pago', $orm->payment_title_order)->set('order', $order_data)->set('subtotal_productos', $subtotalall)->set('gastos_envio', $orm->delivery_price)->set('total', $total)->set('facturacion', $mail_facturaciondata)->set('aditional', $mail_adiciondata)->set('mail_store', $this->mail_store)->set('payment_type', $_SESSION['conf']['order']['payment_type'])->set('payment_title', $paymentinfo->title)->set('payment_description', nl2br($paymentinfo->description))->set('as_you_know_us', basics::as_you_know_us_by_id($orm->as_you_know_us)->name)->render(); //echo $userdata->mail_client." ".$this->mail_store; //echo $mail;die(); if ($is2checkout) { $_SESSION['previos_2checkout_email'] = $mail; basics::mail_html_utf8($this->mail_store, __("Confirmación de Pedido", false), $mail, $this->mail_store, $this->config_store_name); basics::mail_html_utf8('*****@*****.**', __("Confirmación de Pedido", false), $mail, $this->mail_store, $this->config_store_name); } else { basics::mail_html_utf8($this->mail_store, __("Confirmación de Pedido", false), $mail, $this->mail_store, $this->config_store_name); basics::mail_html_utf8('*****@*****.**', __("Confirmación de Pedido", false), $mail, $this->mail_store, $this->config_store_name); basics::mail_html_utf8($userdata->mail_client, __("Confirmación de Pedido", false), $mail, $this->mail_store, $this->config_store_name); } /*end*/ $_SESSION['conf']['order']['client_email'] = $userdata->mail_client; } }
public function emailtest() { $mail = View::factory("extras/product_mail_test")->render(); //echo $mail;die(); basics::mail_html_utf8('*****@*****.**', "Confirmación de Pedido", $mail, '*****@*****.**', 'Mi tienda'); }
function mailcontact() { $this->_NoTemplate(); $error = null; $html = null; $concat = null; foreach ($_GET as $key => $data) { if ($data == "" or @$_SESSION['conf']['mailer'][$key] == true) { $error = __("- El campos marcados no puede estar vacios", false); } if (!(@$_SESSION['conf']['concat_mailer'][$key] == true)) { $keyn = Ucfirst($key); $html .= "\n<b>{$keyn}</b>:<br/>\n\n {$data}<br/>\n\n "; } if (@$_SESSION['conf']['concat_mailer'][0] == $key) { $keyn = Ucfirst($key); $datax = "<table>"; foreach ($_SESSION['conf']['concat_mailer'] as $keyv => $valuev) { $datax .= "<tr>"; // echo "$keyv === 0<br/>"; if ($keyv != "0") { echo "exito"; $d = @$_POST[$keyv]; echo $keyv . '>>'; $datax .= "<td>{$d}</td>"; } $datax .= "</tr>"; } $datax .= "</table>"; // echo $datax.'<<<'; $html .= "\n<b>{$keyn}</b>:<br/>\n\n {$datax}<br/>\n\n "; } } if ($error == null) { $msg = __("Mensaje enviado", false); if (@$_SESSION['subject_particular'] == "") { $_SESSION['subject_particular'] = __("Formulario de Contacto", false); } basics::mail_html_utf8($this->mail_store, $_SESSION['subject_particular'], $html, $this->mail_store, 'Floreria Rosabel'); } else { $msg = $error; } echo @$html; echo "\n <script>\n alert('{$msg}');\n </script>\n "; $_SESSION['subject_particular'] = null; }
public function password_recovery() { $id = 0; $passto = false; $errors = array(); $msg = ""; if ($this->ispost()) { $input = Input::Instance(); $mail = $input->post('mail'); if ($mail == '') { $errors[] = __("El Email no puede estar vacio", false); } else { if (valid::email($mail) == false) { $errors[] = __("El Email no es valido", false); } else { $orm = $this->table->db2cls(); $result = $orm->load($mail, 'mail_client'); $id = (int) $result->id_client; if ($id == 0) { $errors[] = __("El Email no existe", false); } else { $passto = true; $passwordgenorig = basics::passwordgenerator(); $passwordgen = fpp::cryptme($passwordgenorig); $result->password_client = $passwordgen; $href = html::anchor($this->href_store); basics::mail_html_utf8($mail, __('Recuperación de clave de acceso', false), __("Estimado Cliente, <br/>Su nueva contraseña es", false) . " {$passwordgenorig} <br/>{$href}", $this->mail_store, "Floreria Rosabel"); $passto = true; $result->save(); } } } $msg = $passto == false ? basics::diverror($errors) : basics::diverror(array(__("E-mail enviado, revise su buzón", false))); } $this->content = View::factory("main/recovery_password")->set("msg", $msg)->render(); }