Ejemplo n.º 1
0
function createURLQRcodePNG($url = '', $width = '200', $path = '')
{
    if (!$url) {
        return;
    }
    require_once JPATH_SITE . DS . 'components' . DS . 'com_alphauserpoints' . DS . 'assets' . DS . 'barcode' . DS . 'BarcodeQR.php';
    $qrcode = new BarcodeQR();
    $qrcode->url($url);
    $qrcode->draw($width, $path);
}
Ejemplo n.º 2
0
 private function prepareTemplate($newsletter)
 {
     if (!$newsletter) {
         return false;
     }
     $this->load->library('url');
     $this->load->library('BarcodeQR');
     $this->load->library('Barcode39');
     $qr = new BarcodeQR();
     $barcode = new Barcode39(C_CODE);
     $qrStore = "cache/" . $this->escape($this->config->get('config_owner')) . '.png';
     $eanStore = "cache/" . $this->escape($this->config->get('config_owner')) . "_barcode_39.gif";
     if (!file_exists(DIR_IMAGE . $qrStore)) {
         $qr->url(HTTP_HOME);
         $qr->draw(150, DIR_IMAGE . $qrStore);
     }
     if (!file_exists(DIR_IMAGE . $eanStore)) {
         $barcode->draw(DIR_IMAGE . $eanStore);
     }
     $newsletter = str_replace("%7B", "{", $newsletter);
     $newsletter = str_replace("%7D", "}", $newsletter);
     $newsletter = str_replace("{%store_logo%}", '<img src="' . HTTP_IMAGE . $this->config->get('config_logo') . '" alt="' . $this->config->get('config_name') . '" />', $newsletter);
     $newsletter = str_replace("{%store_url%}", HTTP_HOME, $newsletter);
     $newsletter = str_replace("{%url_login%}", Url::createUrl("account/login"), $newsletter);
     $newsletter = str_replace("{%store_owner%}", $this->config->get('config_owner'), $newsletter);
     $newsletter = str_replace("{%store_name%}", $this->config->get('config_name'), $newsletter);
     $newsletter = str_replace("{%store_rif%}", $this->config->get('config_rif'), $newsletter);
     $newsletter = str_replace("{%store_email%}", $this->config->get('config_email'), $newsletter);
     $newsletter = str_replace("{%store_telephone%}", $this->config->get('config_telephone'), $newsletter);
     $newsletter = str_replace("{%store_address%}", $this->config->get('config_address'), $newsletter);
     /*
      $newsletter = str_replace("{%products%}",$product_html,$newsletter);
     */
     $newsletter = str_replace("{%date_added%}", date('d-m-Y h:i A'), $newsletter);
     $newsletter = str_replace("{%ip%}", $_SERVER['REMOTE_ADDR'], $newsletter);
     $newsletter = str_replace("{%qr_code_store%}", '<img src="' . HTTP_IMAGE . $qrStore . '" alt="QR Code" />', $newsletter);
     $newsletter = str_replace("{%barcode_39_order_id%}", '<img src="' . HTTP_IMAGE . $eanStore . '" alt="NT Code" />', $newsletter);
     $newsletter .= "<p style=\"text-align:center\">Powered By Necotienda&reg; " . date('Y') . "</p>";
     return html_entity_decode(htmlspecialchars_decode($newsletter));
 }
Ejemplo n.º 3
0
 public function confirm()
 {
     $this->language->load('payment/cod');
     $this->load->model('account/order');
     $this->load->model('account/payment');
     $this->load->library('email/mailer');
     if ($this->session->has('order_id')) {
         $this->data['order_id'] = $this->session->get('order_id');
     } elseif ($this->request->hasQuery('order_id')) {
         $this->data['order_id'] = $this->request->getQuery('order_id');
     } elseif ($this->request->hasPost('cod_order_id')) {
         $this->data['order_id'] = $this->request->getPost('cod_order_id');
     } else {
         $this->data['order_id'] = 0;
     }
     $order_info = $this->modelOrder->getOrder($this->data['order_id']);
     if ($order_info && $this->customer->isLogged()) {
         $total_payment = $this->modelPayment->getSumPayments(array('order_id' => $order_info['order_id'], 'limit' => 1000));
         $total = $order_info['total'] - $total_payment;
         $amount = explode(",", $this->request->getPost('cod_amount'));
         $payment = round(str_replace(".", "", $amount[0]) . "." . $amount[1], 2);
         $data['order_id'] = $order_info['order_id'];
         $data['payment_method'] = $this->language->get('text_title');
         $data['amount'] = $payment;
         $data['comment'] = $this->language->get('text_date_of_payment') . ": " . $this->request->getPost('cod_date_of_payment') . "\n";
         $data['comment'] .= $this->language->get('text_payment_method_on_delivery') . ": " . $this->request->getPost('cod_payment_method_on_delivery') . "\n";
         $data['comment'] .= "\n" . $this->request->getPost('cod_comment');
         $data['order_status_id'] = $this->config->get('cod_order_status_id');
         $data['order_payment_status_id'] = $this->config->get('config_payment_status_id');
         $json['payment_id'] = $payment_id = $this->modelPayment->add($data);
         $this->modelOrder->addOrderHistory($order_info['order_id'], $data);
         $this->modelOrder->updateStatus($order_info['order_id'], $this->config->get('cod_order_status_id'));
         $this->modelOrder->updatePaymentMethod($order_info['order_id'], $this->language->get('text_title'));
         $diff = $payment - $total;
         if ($diff < 0) {
             //falta dinero
             $diff = $diff * -1;
             $json['warning'] = 1;
             $json['msg'] = str_replace('{%payment_receipt%}', Url::createUrl("account/payment"), $this->language->get('error_moneyless'));
             $json['msg'] = str_replace('{%invoice%}', Url::createUrl("account/invoice", array('order_id' => $order_info['order_id'])), $json['msg']);
             $json['msg'] = str_replace('{%diff%}', $this->currency->format($diff), $json['msg']);
         } elseif ($diff > 0) {
             //sobra dinero
             $json['warning'] = 1;
             $json['msg'] = str_replace('{%payment_receipt%}', Url::createUrl("account/payment"), $this->language->get('error_moneymore'));
             $json['msg'] = str_replace('{%invoice%}', Url::createUrl("account/invoice", array('order_id' => $order_info['order_id'])), $json['msg']);
             $json['msg'] = str_replace('{%diff%}', $this->currency->format($diff), $json['msg']);
         } else {
             $json['success'] = 1;
             $json['msg'] = $this->language->get('text_success');
         }
         $mailer = new Mailer();
         if ($this->config->get('cod_newsletter_id')) {
             $this->load->model("marketing/newsletter");
             $this->load->library('BarcodeQR');
             $this->load->library('Barcode39');
             $qr = new BarcodeQR();
             $barcode = new Barcode39(C_CODE);
             $totals = $this->modelOrder->getOrderTotals($order_id);
             $text = $this->config->get('config_owner') . "\n";
             $text .= "Pago ID: " . $payment_id . "\n";
             $text .= "Pedido ID: " . $order_id . "\n";
             $text .= "Fecha Emision del Pedido: " . date('d-m-Y h:i A', strtotime($order_info['date_added'])) . "\n";
             $text .= "Cliente: " . $this->customer->getCompany() . "\n";
             $text .= "RIF: " . $this->customer->getRif() . "\n";
             $text .= "Direccion IP: " . $_SERVER['REMOTE_ADDR'] . "\n";
             $qrStore = "cache/" . str_replace(".", "_", $this->config->get('config_owner')) . '.jpg';
             $qrPayment = "cache/" . str_replace(" ", "_", $this->config->get('config_owner') . "_qr_code_payment_" . $payment_id) . '.jpg';
             $eanStore = "cache/" . str_replace(" ", "_", $this->config->get('config_owner') . "_barcode_39_order_id_" . $order_id) . '.gif';
             $qr->text($text);
             $qr->draw(150, DIR_IMAGE . $qrPayment);
             $qr->url(HTTP_HOME);
             $qr->draw(150, DIR_IMAGE . $qrStore);
             $barcode->draw(DIR_IMAGE . $eanStore);
             $payment_text = '<h1>' . $this->config->get('config_owner') . "</h1>";
             $payment_text .= "Pago ID: " . $payment_id . "<br />";
             $payment_text .= "Pedido ID: " . $order_id . "<br />";
             $payment_text .= "Fecha Emision del Pedido: " . date('d-m-Y h:i A', strtotime($order_info['date_added'])) . "<br />";
             $payment_text .= "Cliente: " . $this->customer->getCompany() . "<br />";
             $payment_text .= "RIF: " . $this->customer->getRif() . "<br />";
             $payment_text .= "Direccion IP: " . $_SERVER['REMOTE_ADDR'] . "<br />";
             $total_html = "<div class=\"clear:both;float:none;\"></div><br /><table>";
             foreach ($totals as $total) {
                 $total_html .= "<tr>";
                 $total_html .= "<td style=\"text-align:right;\">" . $total['title'] . "</td>";
                 $total_html .= "<td style=\"text-align:right;\">" . $total['text'] . "</td>";
                 $total_html .= "</tr>";
             }
             $total_html .= "</table>";
             $payment_text .= $total_html;
             $result = $this->modelNewsletter->getById($this->config->get('cod_newsletter_id'));
             $message = $result['htmlbody'];
             $message = str_replace("{%title%}", 'Pago N&deg; ' . $payment_id . " - " . $this->config->get('config_name'), $message);
             $message = str_replace("{%store_logo%}", '<img src="' . HTTP_IMAGE . $this->config->get('config_logo') . '" alt="' . $this->config->get('config_name') . '" />', $message);
             $message = str_replace("{%store_url%}", HTTP_HOME, $message);
             $message = str_replace("{%store_owner%}", $this->config->get('config_owner'), $message);
             $message = str_replace("{%store_name%}", $this->config->get('config_name'), $message);
             $message = str_replace("{%store_rif%}", $this->config->get('config_rif'), $message);
             $message = str_replace("{%store_email%}", $this->config->get('config_email'), $message);
             $message = str_replace("{%store_telephone%}", $this->config->get('config_telephone'), $message);
             $message = str_replace("{%store_address%}", $this->config->get('config_address'), $message);
             $message = str_replace("{%totals%}", $total_html, $message);
             $message = str_replace("{%order_id%}", $this->config->get('config_invoice_prefix') . $order_id, $message);
             $message = str_replace("{%invoice_id%}", $this->config->get('config_invoice_prefix') . $invoice_id, $message);
             $message = str_replace("{%rif%}", $this->customer->getRif(), $message);
             $message = str_replace("{%fullname%}", $this->customer->getFirstName() . " " . $this->customer->getFirstName(), $message);
             $message = str_replace("{%company%}", $this->customer->getCompany(), $message);
             $message = str_replace("{%email%}", $this->customer->getEmail(), $message);
             $message = str_replace("{%telephone%}", $this->customer->getTelephone(), $message);
             $message = str_replace("{%payment%}", $payment_text, $message);
             $message = str_replace("{%payment_method%}", $order_info['payment_method'], $message);
             $message = str_replace("{%date_added%}", date('d-m-Y h:i A', strtotime($order_info['date_added'])), $message);
             $message = str_replace("{%ip%}", $_SERVER['REMOTE_ADDR'], $message);
             $message = str_replace("{%qr_code_store%}", '<img src="' . HTTP_IMAGE . $qrStore . '" alt="QR Code" />', $message);
             $message = str_replace("{%comment%}", $order_info['comment'], $message);
             $message = str_replace("{%qr_code_payment%}", '<img src="' . HTTP_IMAGE . $qrPayment . '" alt="QR Code" />', $message);
             $message = str_replace("{%barcode_39_order_id%}", '<img src="' . HTTP_IMAGE . $eanStore . '" alt="QR Code" />', $message);
             $message .= "<p style=\"text-align:center\">Powered By Necotienda&reg; " . date('Y') . "</p>";
         } else {
             $message = $this->config->get('config_owner') . "\n";
             $message .= "Pago ID: " . $payment_id . "\n";
             $message .= "Pedido ID: " . $order_id . "\n";
             $message .= "Fecha Emision: " . date('d-m-Y h:i A', strtotime($order_info['date_added'])) . "\n";
             $message .= "Cliente: " . $this->customer->getCompany() . "\n";
             $message .= "RIF: " . $this->customer->getRif() . "\n";
             $message .= "Direccion IP: " . $_SERVER['REMOTE_ADDR'] . "\n";
             $message .= "\n" . "Powered By Necotienda&reg; " . date('Y') . "\n";
         }
         if ($message) {
             if ($this->config->get('config_smtp_method') == 'smtp') {
                 $mailer->IsSMTP();
                 $mailer->Host = $this->config->get('config_smtp_host');
                 $mailer->Username = $this->config->get('config_smtp_username');
                 $mailer->Password = base64_decode($this->config->get('config_smtp_password'));
                 $mailer->Port = $this->config->get('config_smtp_port');
                 $mailer->Timeout = $this->config->get('config_smtp_timeout');
                 $mailer->SMTPSecure = $this->config->get('config_smtp_ssl');
                 $mailer->SMTPAuth = $this->config->get('config_smtp_auth') ? true : false;
             } elseif ($this->config->get('config_smtp_method') == 'sendmail') {
                 $mailer->IsSendmail();
             } else {
                 $mailer->IsMail();
             }
             $mailer->IsHTML();
             $mailer->AddAddress($this->customer->getEmail(), $this->customer->getCompany());
             $mailer->AddBCC($this->config->get('config_email'), $this->config->get('config_name'));
             $mailer->SetFrom($this->config->get('config_email'), $this->config->get('config_name'));
             $mailer->Subject = $this->config->get('config_owner') . " " . $this->language->get('text_new_payment') . " #" . $payment_id;
             $mailer->Body = html_entity_decode(htmlspecialchars_decode($message));
             $mailer->Send();
         }
     } elseif (!$this->customer->isLogged()) {
         $json['error'] = 1;
         $json['msg'] = $this->language->get('error_not_logged');
     } else {
         $json['error'] = 1;
         $json['msg'] = $this->language->get('error_payment');
     }
     $this->load->library('json');
     $this->response->setOutput(Json::encode($json), $this->config->get('config_compression'));
 }
Ejemplo n.º 4
0
$phone = isset($_GET["phone"]) ? $_GET["phone"] : null;
$email = isset($_GET["email"]) ? $_GET["email"] : null;
$subject = isset($_GET["subject"]) ? $_GET["subject"] : null;
$message = isset($_GET["message"]) ? $_GET["message"] : null;
$lat = isset($_GET["lat"]) ? $_GET["lat"] : null;
$lon = isset($_GET["lon"]) ? $_GET["lon"] : null;
$height = isset($_GET["height"]) ? $_GET["height"] : null;
$text = isset($_GET["text"]) ? $_GET["text"] : null;
$wifi_type = isset($_GET["wifi_type"]) ? $_GET["wifi_type"] : null;
$ssid = isset($_GET["ssid"]) ? $_GET["ssid"] : null;
$password = isset($_GET["password"]) ? $_GET["password"] : null;
$size = isset($_GET["size"]) ? $_GET["size"] : null;
$qr = new BarcodeQR();
switch ($type) {
    case 'url':
        $qr->url($url);
        break;
    case 'contact':
        $qr->contact($name, $address, $phone, $email);
        break;
    case 'email':
        $qr->email($email, $subject, $message);
        break;
    case 'geo':
        $qr->geo($lat, $lon, $height);
        break;
    case 'phone':
        $qr->phone($phone);
        break;
    case 'sms':
        $qr->sms($phone, $message);
Ejemplo n.º 5
0
    require_once JPATH_SITE . DS . 'components' . DS . 'com_uddeim' . DS . 'uddeim.api.php';
    require_once JPATH_COMPONENT . DS . 'helpers' . DS . 'uddeim_alert.php';
    require_once JPATH_COMPONENT . DS . 'helpers' . DS . 'uddeim_mailbox.php';
}
// end integration Uddeim
// start About Me information
if ($_profilelink == '') {
    //echo JHtml::_('bootstrap.startAccordion', 'mySlide', array('active' => 'slide-referrees'));
    echo JHtml::_('bootstrap.startAccordion', 'mySlide', array());
    if ($this->params->get('showQRCode', 1)) {
        echo JHtml::_('bootstrap.addSlide', 'mySlide', JText::_('AUP_QRCODE'), 'slide-qrcode');
        echo '<div id="QRcodeInvite">';
        require_once JPATH_SITE . DS . 'components' . DS . 'com_alphauserpoints' . DS . 'assets' . DS . 'barcode' . DS . 'BarcodeQR.php';
        $pathQRtemp = JPATH_SITE . DS . 'tmp' . DS . $this->referreid . ".png";
        $qrcode = new BarcodeQR();
        $qrcode->url($referrer_link);
        $qrcode->draw(150, $pathQRtemp);
        echo '<img src="' . JURI::base() . 'tmp/' . $this->referreid . '.png" alt="" />';
        echo '</div>';
        echo JHtml::_('bootstrap.endSlide');
    }
    if ($this->rowsreferrees && $this->params->get('show_tab_referrees', 1)) {
        echo JHtml::_('bootstrap.addSlide', 'mySlide', JText::_('AUP_MYREFERREES'), 'slide-referrees');
        ?>
		
		<table class="category table table-striped table-bordered table-hover">
		    <thead>
				<tr>
				  <th id="categorylist_header_id">ID</th>
				  <th id="categorylist_header_username"><?php 
        echo JText::_('AUP_USERNAME');
Ejemplo n.º 6
0
 protected function notifyReply($review_id, $product_id)
 {
     if (!$review_id) {
         return false;
     }
     $this->load->auto('email/mailer');
     $this->load->auto('store/product');
     $this->load->auto('account/customer');
     $this->load->auto('store/review');
     $this->load->auto('marketing/newsletter');
     $review_info = $this->modelReview->getById($review_id);
     $product_info = $this->modelProduct->getProduct($product_id);
     if ($this->config->get('marketing_email_new_reply') && $review_info) {
         $this->load->model("marketing/newsletter");
         $this->load->library('email/mailer');
         $this->load->library('BarcodeQR');
         $this->load->library('Barcode39');
         $mailer = new Mailer();
         $qr = new BarcodeQR();
         $barcode = new Barcode39(C_CODE);
         $qrStore = "cache/" . str_replace(".", "_", $this->config->get('config_owner')) . '.png';
         $eanStore = "cache/" . str_replace(" ", "_", $this->config->get('config_owner') . "_barcode_39_order_id_" . $order_id) . '.gif';
         if (!file_exists(DIR_IMAGE . $qrStore)) {
             $qr->url(HTTP_HOME);
             $qr->draw(150, DIR_IMAGE . $qrStore);
         }
         if (!file_exists(DIR_IMAGE . $eanStore)) {
             $barcode->draw(DIR_IMAGE . $eanStore);
         }
         $customer_info = $this->modelCustomer->getCustomer($review_info['customer_id']);
         $result = $this->modelNewsletter->getById($this->config->get('marketing_email_new_reply'));
         $message = $result['htmlbody'];
         $message = str_replace("{%store_logo%}", '<img src="' . HTTP_IMAGE . $this->config->get('config_logo') . '" alt="' . $this->config->get('config_name') . '" />', $message);
         $message = str_replace("{%store_url%}", HTTP_HOME, $message);
         $message = str_replace("{%store_owner%}", $this->config->get('config_owner'), $message);
         $message = str_replace("{%store_name%}", $this->config->get('config_name'), $message);
         $message = str_replace("{%store_rif%}", $this->config->get('config_rif'), $message);
         $message = str_replace("{%store_email%}", $this->config->get('config_email'), $message);
         $message = str_replace("{%store_telephone%}", $this->config->get('config_telephone'), $message);
         $message = str_replace("{%store_address%}", $this->config->get('config_address'), $message);
         $message = str_replace("{%product_url%}", Url::createUrl('store/product', array('product_id' => $product_id)), $message);
         $message = str_replace("{%url_account%}", Url::createUrl('account/review'), $message);
         $message = str_replace("{%product_name%}", $product_info['name'], $message);
         $message = str_replace("{%fullname%}", $customer_info['firstname'] . " " . $customer_info['lastname'], $message);
         $message = str_replace("{%company%}", $customer_info['company'], $message);
         $message = str_replace("{%email%}", $customer_info['email'], $message);
         $message = str_replace("{%qr_code_store%}", '<img src="' . HTTP_IMAGE . $qrStore . '" alt="QR Code" />', $message);
         $message = str_replace("{%barcode_39_order_id%}", '<img src="' . HTTP_IMAGE . $eanStore . '" alt="QR Code" />', $message);
         $message .= "<p style=\"text-align:center\">Powered By <a href=\"http://www.necotienda.org\">Necotienda</a>&reg; " . date('Y') . "</p>";
         $subject = $this->config->get('config_owner') . " " . $this->language->get('text_new_reply');
         if ($this->config->get('config_smtp_method') == 'smtp') {
             $mailer->IsSMTP();
             $mailer->Host = $this->config->get('config_smtp_host');
             $mailer->Username = $this->config->get('config_smtp_username');
             $mailer->Password = base64_decode($this->config->get('config_smtp_password'));
             $mailer->Port = $this->config->get('config_smtp_port');
             $mailer->Timeout = $this->config->get('config_smtp_timeout');
             $mailer->SMTPSecure = $this->config->get('config_smtp_ssl');
             $mailer->SMTPAuth = $this->config->get('config_smtp_auth') ? true : false;
         } elseif ($this->config->get('config_smtp_method') == 'sendmail') {
             $mailer->IsSendmail();
         } else {
             $mailer->IsMail();
         }
         $mailer->IsHTML();
         $mailer->AddAddress($customer_info['email'], $customer_info['author']);
         $mailer->AddBCC($this->config->get('config_email'), $this->config->get('config_name'));
         $mailer->SetFrom($this->config->get('config_email'), $this->config->get('config_name'));
         $mailer->Subject = $subject;
         $mailer->Body = html_entity_decode($message);
         $mailer->Send();
     }
 }
Ejemplo n.º 7
0
 /**
  * Returns QR Code output
  *
  * @access private
  * @return string
  */
 public function getQRCode()
 {
     global $lC_Customer, $lC_Session, $lC_Language;
     $result['html'] = '';
     $BarcodeQR = new BarcodeQR();
     $qrcode_url = $_SERVER['HTTP_REFERER'];
     if ($lC_Customer->isLoggedOn() === true && $lC_Customer->getEmailAddress != NULL) {
         $qrcode_url_add = (stristr($qrcode_url, "?") ? '&' : '?') . $lC_Session->getName() . '=' . $lC_Session->getID() . '&email=' . $lC_Customer->getEmailAddress . '&qr=1';
     } else {
         $qrcode_url_add = (stristr($qrcode_url, "?") ? '&' : '?') . $lC_Session->getName() . '=' . $lC_Session->getID();
     }
     $result['html'] .= '<div id="qr-message">' . '<a class="close-qr" title="Hide message" onclick="$(\'#qr-message\').hide(\'500\');"><span style="color:#fff;">X</span></a>';
     $BarcodeQR->url($qrcode_url . $qrcode_url_add);
     if ($lC_Customer->isLoggedOn() === true) {
         $BarcodeQR->draw(230, DIR_FS_WORK . 'qrcode/c' . $lC_Customer->id . '.png');
         $result['html'] .= '<img alt="' . $lC_Language->get('text_click_and_scan') . '" src="includes/work/qrcode/c' . $lC_Customer->id . '.png" />';
     } else {
         $BarcodeQR->draw(230, DIR_FS_WORK . 'qrcode/g' . $lC_Session->getID() . '.png');
         $result['html'] .= '<img alt="' . $lC_Language->get('text_click_and_scan') . '" src="includes/work/qrcode/g' . $lC_Session->getID() . '.png" />';
     }
     $result['html'] .= '</div><script>$("#qrcode-tooltip").click(function() { $("#qr-message").show("500"); });</script>';
     return $result['html'];
 }
Ejemplo n.º 8
0
 public function index()
 {
     $Url = new Url($this->registry);
     if ($this->config->get('config_store_mode') != 'store') {
         $this->redirect(HTTP_HOME);
     }
     $this->language->load('checkout/success');
     $this->load->auto('account/address');
     $address = $this->modelAddress->getAddress($this->customer->getAddressId());
     $method_data = array();
     $results = $this->modelExtension->getExtensions('payment');
     foreach ($results as $result) {
         $this->load->model('payment/' . $result['key']);
         $this->language->load('payment/' . $result['key']);
         $method = $this->{'model_payment_' . $result['key']}->getMethod($address);
         if ($method) {
             $method_data[$result['key']] = $method;
         }
     }
     $sort_order = array();
     foreach ($method_data as $key => $value) {
         $sort_order[$key] = $value['sort_order'];
     }
     array_multisort($sort_order, SORT_ASC, $method_data);
     $this->data['payment_methods'] = $method_data;
     foreach ($method_data as $key => $value) {
         $this->children[$key] = 'payment/' . $key;
     }
     $order_id = 0;
     if ($this->session->has('order_id')) {
         $order_id = $this->session->get('order_id');
     } elseif ($this->request->hasPost('order_id')) {
         $order_id = $this->request->getPost('order_id');
     } elseif ($this->request->hasQuery('order_id')) {
         $order_id = $this->request->getQuery('order_id');
     }
     $this->data['order_id'] = $order_id;
     if ($order_id) {
         if ($this->config->get('marketing_email_new_order')) {
             $this->load->model('account/order');
             $this->load->model('account/payment');
             $this->load->model("marketing/newsletter");
             $this->load->library('email/mailer');
             $this->load->library('BarcodeQR');
             $this->load->library('Barcode39');
             $this->load->library('tcpdf/config/lang/spa');
             $this->load->library('tcpdf/tcpdf');
             $mailer = new Mailer();
             $qr = new BarcodeQR();
             $barcode = new Barcode39(C_CODE);
             $this->data['Currency'] = $this->currency;
             $this->data['order'] = $order = $this->modelOrder->getOrder($order_id);
             $this->data['products'] = $products = $this->modelOrder->getOrderProducts($order_id);
             $this->data['totals'] = $totals = $this->modelOrder->getOrderTotals($order_id);
             $this->data['payments'] = $payments = $this->modelPayment->getPayments(array('order_id' => $order_id, 'order_payment_status_id' => $this->config->get('order_payment_status_approved')));
             $shipping_address = $order['shipping_address_1'] . ", " . $order['shipping_city'] . ". " . $order['shipping_zone'] . " - " . $order['shipping_country'] . ". CP " . $order['shipping_zone_code'];
             $payment_address = $order['payment_address_1'] . ", " . $order['payment_city'] . ". " . $order['payment_zone'] . " - " . $order['payment_country'] . ". CP " . $order['payment_zone_code'];
             $text = $this->config->get('config_owner') . "\n";
             $text .= "Pedido ID: " . $order_id . "\n";
             $text .= "Fecha Emision: " . date('d-m-Y h:i A', strtotime($order['date_added'])) . "\n";
             $text .= "Cliente: " . $this->customer->getCompany() . "\n";
             $text .= "RIF: " . $this->customer->getRif() . "\n";
             $text .= "Direccion IP: " . $order['ip'] . "\n";
             $text .= "Productos (" . count($products) . ")\n";
             $text .= "Modelo\tCant.\tTotal\n";
             foreach ($products as $key => $product) {
                 $text .= $product['model'] . "\t" . $product['quantity'] . "\t" . $this->currency->format($product['total'], $order['currency'], $order['value']) . "\n";
             }
             $qrStore = "cache/" . str_replace(".", "_", $this->config->get('config_owner')) . '.jpg';
             $qrOrder = "cache/" . str_replace(" ", "_", $this->config->get('config_owner') . "_qr_code_order_" . $order_id) . '.jpg';
             $eanStore = "cache/" . str_replace(" ", "_", $this->config->get('config_owner') . "_barcode_39_order_id_" . $order_id) . '.gif';
             $qr->text($text);
             $qr->draw(150, DIR_IMAGE . $qrOrder);
             $qr->url(HTTP_HOME);
             $qr->draw(150, DIR_IMAGE . $qrStore);
             $barcode->draw(DIR_IMAGE . $eanStore);
             $product_html = "<table><thead><tr style=\"background:#ccc;color:#666;\"><th>Item</th><th>" . $this->language->get('column_description') . "</th><th>" . $this->language->get('column_model') . "</th><th>" . $this->language->get('column_quantity') . "</th><th>" . $this->language->get('column_price') . "</th><th>" . $this->language->get('column_total') . "</th></tr></thead><tbody>";
             foreach ($products as $key => $product) {
                 $options = $this->modelOrder->getOrderOptions($order_id, $product['order_product_id']);
                 $option_data = "";
                 foreach ($options as $option) {
                     $option_data .= "&nbsp;&nbsp;&nbsp;&nbsp;- " . $option['name'] . "<br />";
                 }
                 $product_html .= "<tr>";
                 $product_html .= "<td style=\"width:5%\">" . (int) ($key + 1) . "</td>";
                 $product_html .= "<td style=\"width:45%\">" . $product['name'] . "<br />" . $option_data . "</td>";
                 $product_html .= "<td style=\"width:20%\">" . $product['model'] . "</td>";
                 $product_html .= "<td style=\"width:10%\">" . $product['quantity'] . "</td>";
                 $product_html .= "<td style=\"width:10%\">" . $this->currency->format($product['price'], $order['currency'], $order['value']) . "</td>";
                 $product_html .= "<td style=\"width:10%\">" . $this->currency->format($product['total'], $order['currency'], $order['value']) . "</td>";
                 $product_html .= "</tr>";
             }
             $product_html .= "</tbody></table>";
             $total_html = "<div class=\"clear:both;float:none;\"></div><br /><table style=\"float:right;\">";
             foreach ($totals as $total) {
                 $total_html .= "<tr>";
                 $total_html .= "<td style=\"text-align:right;\">" . $total['title'] . "</td>";
                 $total_html .= "<td style=\"text-align:right;\">" . $total['text'] . "</td>";
                 $total_html .= "</tr>";
             }
             $total_html .= "</table>";
             $result = $this->modelNewsletter->getById($this->config->get('marketing_email_new_order'));
             $message = $result['htmlbody'];
             $message = str_replace("{%title%}", 'Pedido N&deg; ' . $order_id . " - " . $this->config->get('config_name'), $message);
             $message = str_replace("{%store_logo%}", '<img src="' . HTTP_IMAGE . $this->config->get('config_logo') . '" alt="' . $this->config->get('config_name') . '" />', $message);
             $message = str_replace("{%store_url%}", HTTP_HOME, $message);
             $message = str_replace("{%store_owner%}", $this->config->get('config_owner'), $message);
             $message = str_replace("{%store_name%}", $this->config->get('config_name'), $message);
             $message = str_replace("{%store_rif%}", $this->config->get('config_rif'), $message);
             $message = str_replace("{%store_email%}", $this->config->get('config_email'), $message);
             $message = str_replace("{%store_telephone%}", $this->config->get('config_telephone'), $message);
             $message = str_replace("{%store_address%}", $this->config->get('config_address'), $message);
             $message = str_replace("{%products%}", $product_html, $message);
             $message = str_replace("{%totals%}", $total_html, $message);
             $message = str_replace("{%order_id%}", $this->config->get('config_invoice_prefix') . $order_id, $message);
             $message = str_replace("{%invoice_id%}", $this->config->get('config_invoice_prefix') . $invoice_id, $message);
             $message = str_replace("{%rif%}", $this->customer->getRif(), $message);
             $message = str_replace("{%fullname%}", $this->customer->getFirstName() . " " . $this->customer->getFirstName(), $message);
             $message = str_replace("{%company%}", $this->customer->getCompany(), $message);
             $message = str_replace("{%email%}", $this->customer->getEmail(), $message);
             $message = str_replace("{%telephone%}", $this->customer->getTelephone(), $message);
             $message = str_replace("{%payment_address%}", $payment_address, $message);
             $message = str_replace("{%payment_method%}", $order['payment_method'], $message);
             $message = str_replace("{%shipping_address%}", $shipping_address, $message);
             $message = str_replace("{%shipping_method%}", $order['shipping_method'], $message);
             $message = str_replace("{%date_added%}", date('d-m-Y h:i A', strtotime($order['date_added'])), $message);
             $message = str_replace("{%ip%}", $order['ip'], $message);
             $message = str_replace("{%qr_code_store%}", '<img src="' . HTTP_IMAGE . $qrStore . '" alt="QR Code" />', $message);
             $message = str_replace("{%comment%}", $order['comment'], $message);
             $message = str_replace("{%qr_code_order%}", '<img src="' . HTTP_IMAGE . $qrOrder . '" alt="QR Code" />', $message);
             $message = str_replace("{%barcode_39_order_id%}", '<img src="' . HTTP_IMAGE . $eanStore . '" alt="QR Code" />', $message);
             $message .= "<p style=\"text-align:center\">Powered By <a href=\"http://www.necotienda.org\">Necotienda</a>&reg; " . date('Y') . "</p>";
             if ($this->config->get('marketing_email_order_pdf')) {
                 $pdfFile = DIR_CACHE . str_replace(" ", "_", $this->config->get('config_owner') . "_pedido_" . $order_id) . '.pdf';
                 $result = $this->modelNewsletter->getById($this->config->get('marketing_email_order_pdf'));
                 $pdfBody = html_entity_decode($result['htmlbody']);
                 $pdfBody = str_replace("{%store_url%}", HTTP_HOME, $pdfBody);
                 $pdfBody = str_replace("{%title%}", 'Pedido N&deg; ' . $order_id . " - " . $this->config->get('config_name'), $pdfBody);
                 $pdfBody = str_replace("{%store_owner%}", $this->config->get('config_owner'), $pdfBody);
                 $pdfBody = str_replace("{%store_name%}", $this->config->get('config_name'), $pdfBody);
                 $pdfBody = str_replace("{%store_rif%}", $this->config->get('config_rif'), $pdfBody);
                 $pdfBody = str_replace("{%store_email%}", $this->config->get('config_email'), $pdfBody);
                 $pdfBody = str_replace("{%store_telephone%}", $this->config->get('config_telephone'), $pdfBody);
                 $pdfBody = str_replace("{%store_address%}", $this->config->get('config_address'), $pdfBody);
                 $pdfBody = str_replace("{%products%}", $product_html, $pdfBody);
                 $pdfBody = str_replace("{%totals%}", $total_html, $pdfBody);
                 $pdfBody = str_replace("{%order_id%}", $this->config->get('config_invoice_prefix') . $order_id, $pdfBody);
                 $pdfBody = str_replace("{%invoice_id%}", $this->config->get('config_invoice_prefix') . $invoice_id, $pdfBody);
                 $pdfBody = str_replace("{%rif%}", $this->customer->getRif(), $pdfBody);
                 $pdfBody = str_replace("{%fullname%}", $this->customer->getFirstName() . " " . $this->customer->getFirstName(), $pdfBody);
                 $pdfBody = str_replace("{%company%}", $this->customer->getCompany(), $pdfBody);
                 $pdfBody = str_replace("{%email%}", $this->customer->getEmail(), $pdfBody);
                 $pdfBody = str_replace("{%telephone%}", $this->customer->getTelephone(), $pdfBody);
                 $pdfBody = str_replace("{%payment_address%}", $payment_address, $pdfBody);
                 $pdfBody = str_replace("{%payment_method%}", $order['payment_method'], $pdfBody);
                 $pdfBody = str_replace("{%shipping_address%}", $shipping_address, $pdfBody);
                 $pdfBody = str_replace("{%shipping_method%}", $order['shipping_method'], $pdfBody);
                 $pdfBody = str_replace("{%date_added%}", date('d-m-Y h:i A', strtotime($order['date_added'])), $pdfBody);
                 $pdfBody = str_replace("{%ip%}", $order['ip'], $pdfBody);
                 $pdfBody = str_replace("{%comment%}", $order['comment'], $pdfBody);
                 if (file_exists(DIR_IMAGE . $this->config->get('config_logo'))) {
                     $pdfBody = str_replace("{%store_logo%}", '<img src="' . HTTP_IMAGE . $this->config->get('config_logo') . '" alt="' . $this->config->get('config_name') . '" />', $pdfBody);
                 } else {
                     $pdfBody = str_replace("{%store_logo%}", '', $pdfBody);
                 }
                 if (file_exists(DIR_IMAGE . $qrStore)) {
                     $pdfBody = str_replace("{%qr_code_store%}", '<img src="' . HTTP_IMAGE . $qrStore . '" alt="QR Code" />', $pdfBody);
                 } else {
                     $pdfBody = str_replace("{%qr_code_store%}", '', $pdfBody);
                 }
                 if (file_exists(DIR_IMAGE . $qrOrder)) {
                     $pdfBody = str_replace("{%qr_code_order%}", '<img src="' . HTTP_IMAGE . $qrOrder . '" alt="QR Code" />', $pdfBody);
                 } else {
                     $pdfBody = str_replace("{%qr_code_order%}", '', $pdfBody);
                 }
                 $pdfBody = str_replace("{%barcode_39_order_id%}", '<img src="' . HTTP_IMAGE . $eanStore . '" alt="QR Code" />', $pdfBody);
                 $pdfBody .= "<p style=\"text-align:center\">Powered By Necotienda&reg; " . date('Y') . "</p>";
                 // create new PDF document
                 $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
                 // set document information
                 $pdf->SetCreator("Powered By NecoTienda&reg;");
                 $pdf->SetTitle($this->config->get('config_name'));
                 $pdf->SetAuthor($this->config->get('config_name'));
                 $pdf->SetSubject($this->config->get('config_owner') . " " . $this->language->get('text_order') . " #" . $order_id);
                 $pdf->SetKeywords($this->config->get('config_name') . ', ' . $product_tags . ',pdf');
                 // set default header data
                 $pdf->SetHeaderData($this->config->get('config_logo'), PDF_HEADER_LOGO_WIDTH, $this->config->get('config_owner'), $this->config->get('config_name'));
                 // set header and footer fonts
                 $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
                 $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
                 // set default monospaced font
                 $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
                 //set margins
                 $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
                 $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
                 $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
                 //set auto page breaks
                 $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
                 //set image scale factor
                 $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
                 //set some language-dependent strings
                 $pdf->setLanguageArray($l);
                 // set font
                 $pdf->SetFont('dejavusans', '', 10);
                 // add a page
                 $pdf->AddPage();
                 // output the HTML content
                 $pdf->writeHTML($pdfBody, true, false, true, false, '');
                 //Close and output PDF document
                 $pdf->Output($pdfFile, 'F');
             }
             $subject = $this->config->get('config_owner') . " " . $this->language->get('text_new_order') . " #" . $order_id;
             if ($this->config->get('config_smtp_method') == 'smtp') {
                 $mailer->IsSMTP();
                 $mailer->Host = $this->config->get('config_smtp_host');
                 $mailer->Username = $this->config->get('config_smtp_username');
                 $mailer->Password = base64_decode($this->config->get('config_smtp_password'));
                 $mailer->Port = $this->config->get('config_smtp_port');
                 $mailer->Timeout = $this->config->get('config_smtp_timeout');
                 $mailer->SMTPSecure = $this->config->get('config_smtp_ssl');
                 $mailer->SMTPAuth = $this->config->get('config_smtp_auth') ? true : false;
             } elseif ($this->config->get('config_smtp_method') == 'sendmail') {
                 $mailer->IsSendmail();
             } else {
                 $mailer->IsMail();
             }
             $mailer->IsHTML();
             $mailer->AddAddress($this->customer->getEmail(), $this->customer->getCompany());
             $mailer->AddBCC($this->config->get('config_email'), $this->config->get('config_name'));
             $mailer->SetFrom($this->config->get('config_email'), $this->config->get('config_name'));
             $mailer->Subject = $subject;
             $mailer->Body = html_entity_decode(htmlspecialchars_decode($message));
             if ($pdfFile && file_exists($pdfFile)) {
                 $mailer->AddAttachment($pdfFile);
             }
             $mailer->Send();
         }
         $order_id = $this->session->get('order_id');
         $this->cart->clear();
         $this->session->clear('shipping_method');
         $this->session->clear('shipping_methods');
         $this->session->clear('payment_method');
         $this->session->clear('payment_methods');
         $this->session->clear('guest');
         $this->session->clear('comment');
         $this->session->clear('order_id');
         $this->session->clear('coupon');
     }
     $this->document->title = $this->language->get('heading_title');
     $this->document->breadcrumbs = array();
     $this->document->breadcrumbs[] = array('href' => Url::createUrl("common/home"), 'text' => $this->language->get('text_home'), 'separator' => false);
     $this->document->breadcrumbs[] = array('href' => Url::createUrl("checkout/cart"), 'text' => $this->language->get('text_basket'), 'separator' => $this->language->get('text_separator'));
     $this->document->breadcrumbs[] = array('href' => Url::createUrl("checkout/success"), 'text' => $this->language->get('text_checkout_success'), 'separator' => $this->language->get('text_separator'));
     $this->data['breadcrumbs'] = $this->document->breadcrumbs;
     $this->data['heading_title'] = $this->language->get('heading_title');
     if ($this->config->get('page_order_success')) {
         $this->load->model('content/page');
         $page = $this->modelPage->getById($this->config->get('page_order_success'));
         $this->data['text_message'] = html_entity_decode($page['description']);
     } else {
         $this->data['text_message'] = sprintf($this->language->get('text_message'), Url::createUrl("account/account"), Url::createUrl("account/order"), Url::createUrl("page/contact"));
     }
     // style files
     $csspath = defined("CDN") ? CDN . CSS : HTTP_CSS;
     $styles[] = array('media' => 'all', 'href' => $csspath . 'jquery-ui/jquery-ui.min.css');
     $styles[] = array('media' => 'all', 'href' => $csspath . 'neco.form.css');
     $this->data['styles'] = $this->styles = array_merge($this->styles, $styles);
     if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/checkout/success.tpl')) {
         $this->template = $this->config->get('config_template') . '/checkout/success.tpl';
     } else {
         $this->template = 'choroni/checkout/success.tpl';
     }
     $this->children[] = 'common/nav';
     $this->children[] = 'common/footer';
     $this->children[] = 'common/header';
     $this->response->setOutput($this->render(true), $this->config->get('config_compression'));
 }
 public function index()
 {
     $Url = new Url($this->registry);
     if ($this->customer->isLogged()) {
         $this->redirect(Url::createUrl("account/account"));
     }
     $this->language->load('account/forgotten');
     $this->document->title = $this->language->get('heading_title');
     $this->load->model('account/customer');
     if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->validate()) {
         $this->load->library('email/mailer');
         $this->load->library('BarcodeQR');
         $this->load->library('Barcode39');
         $mailer = new Mailer();
         $qr = new BarcodeQR();
         $barcode = new Barcode39(C_CODE);
         $password = substr(md5(rand()), 0, 11);
         $qrStore = "cache/" . str_replace(".", "_", $this->config->get('config_owner')) . '.png';
         $eanStore = "cache/" . str_replace(" ", "_", $this->config->get('config_owner') . "_barcode_39_order_id_" . $order_id) . '.gif';
         if (!file_exists(DIR_IMAGE . $qrStore)) {
             $qr->url(HTTP_HOME);
             $qr->draw(150, DIR_IMAGE . $qrStore);
         }
         if (!file_exists(DIR_IMAGE . $eanStore)) {
             $barcode->draw(DIR_IMAGE . $eanStore);
         }
         if ($this->config->get('marketing_email_new_password')) {
             $this->load->model("marketing/newsletter");
             $result = $this->modelNewsletter->getById($this->config->get('marketing_email_new_password'));
             $message = $result['htmlbody'];
             $message = str_replace("{%store_logo%}", '<img src="' . HTTP_IMAGE . $this->config->get('config_logo') . '" alt="' . $this->config->get('config_name') . '" />', $message);
             $message = str_replace("{%store_url%}", HTTP_HOME, $message);
             $message = str_replace("{%url_login%}", Url::createUrl("account/login"), $message);
             $message = str_replace("{%url_activate%}", Url::createUrl("account/activate", array('ac' => $this->request->post['activation_code'])), $message);
             $message = str_replace("{%store_owner%}", $this->config->get('config_owner'), $message);
             $message = str_replace("{%store_name%}", $this->config->get('config_name'), $message);
             $message = str_replace("{%store_rif%}", $this->config->get('config_rif'), $message);
             $message = str_replace("{%store_email%}", $this->config->get('config_email'), $message);
             $message = str_replace("{%store_telephone%}", $this->config->get('config_telephone'), $message);
             $message = str_replace("{%store_address%}", $this->config->get('config_address'), $message);
             $message = str_replace("{%email%}", $this->request->post['email'], $message);
             $message = str_replace("{%password%}", $password, $message);
             $message = str_replace("{%date_added%}", date('d-m-Y h:i A'), $message);
             $message = str_replace("{%ip%}", $_SERVER['REMOTE_ADDR'], $message);
             $message = str_replace("{%qr_code_store%}", '<img src="' . HTTP_IMAGE . $qrStore . '" alt="QR Code" />', $message);
             $message = str_replace("{%barcode_39_order_id%}", '<img src="' . HTTP_IMAGE . $eanStore . '" alt="NT Code" />', $message);
             $message .= "<p style=\"text-align:center\">Powered By Necotienda&reg; " . date('Y') . "</p>";
         } else {
             $message = "<h1>" . $this->config->get('config_name') . "</h1>";
             $message .= "<p>" . $this->language->get('text_password_renew') . "</p>";
             $message .= "<p><b>" . $password . "</b></p><br />";
             $message .= '<img src="' . HTTP_IMAGE . $qrStore . '" alt="QR Code" />';
             $message .= '<img src="' . HTTP_IMAGE . $eanStore . '" alt="NT Code" />';
             $message .= "<br /><p style=\"text-align:center\">Powered By Necotienda&reg; " . date('Y') . "</p>";
         }
         $subject = $this->config->get('config_name') . " " . $this->language->get('text_new_password');
         if ($this->config->get('config_smtp_method') == 'smtp') {
             $mailer->IsSMTP();
             $mailer->Host = $this->config->get('config_smtp_host');
             $mailer->Username = $this->config->get('config_smtp_username');
             $mailer->Password = base64_decode($this->config->get('config_smtp_password'));
             $mailer->Port = $this->config->get('config_smtp_port');
             $mailer->Timeout = $this->config->get('config_smtp_timeout');
             $mailer->SMTPSecure = $this->config->get('config_smtp_ssl');
             $mailer->SMTPAuth = $this->config->get('config_smtp_auth') ? true : false;
         } elseif ($this->config->get('config_smtp_method') == 'sendmail') {
             $mailer->IsSendmail();
         } else {
             $mailer->IsMail();
         }
         $mailer->IsHTML();
         $mailer->AddAddress($this->request->post['email'], $this->config->get('config_name'));
         $mailer->SetFrom($this->config->get('config_email'), $this->config->get('config_name'));
         $mailer->Subject = $subject;
         $mailer->Body = html_entity_decode(htmlspecialchars_decode($message));
         $mailer->Send();
         $this->modelCustomer->editPassword($this->request->post['email'], $password);
         $this->session->set('success', $this->language->get('text_success'));
         $this->redirect(Url::createUrl("account/login"));
     }
     $this->document->breadcrumbs = array();
     $this->document->breadcrumbs[] = array('href' => Url::createUrl("common/home"), 'text' => $this->language->get('text_home'), 'separator' => false);
     $this->document->breadcrumbs[] = array('href' => Url::createUrl("account/account"), 'text' => $this->language->get('text_account'), 'separator' => $this->language->get('text_separator'));
     $this->document->breadcrumbs[] = array('href' => Url::createUrl("account/forgotten"), 'text' => $this->language->get('text_forgotten'), 'separator' => $this->language->get('text_separator'));
     $this->data['heading_title'] = $this->language->get('heading_title');
     $this->data['text_your_email'] = $this->language->get('text_your_email');
     $this->data['text_email'] = $this->language->get('text_email');
     $this->data['entry_email'] = $this->language->get('entry_email');
     $this->data['button_continue'] = $this->language->get('button_continue');
     $this->data['button_back'] = $this->language->get('button_back');
     if (isset($this->error['message'])) {
         $this->data['error'] = $this->error['message'];
     } else {
         $this->data['error'] = '';
     }
     $this->data['action'] = Url::createUrl("account/forgotten");
     $this->data['back'] = Url::createUrl("account/account");
     $this->loadWidgets();
     if ($scripts) {
         $this->scripts = array_merge($this->scripts, $scripts);
     }
     $this->children[] = 'common/column_left';
     $this->children[] = 'common/column_right';
     $this->children[] = 'common/nav';
     $this->children[] = 'common/header';
     $this->children[] = 'common/footer';
     $template = $this->config->get('default_view_account_forgotten') ? $this->config->get('default_view_account_forgotten') : 'account/forgotten.tpl';
     if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/' . $template)) {
         $this->template = $this->config->get('config_template') . '/' . $template;
     } else {
         $this->template = 'choroni/' . $template;
     }
     $this->response->setOutput($this->render(true), $this->config->get('config_compression'));
 }
Ejemplo n.º 10
0
 private function prepareTemplate($newsletter, $params = array())
 {
     if (!$newsletter) {
         return false;
     }
     $this->load->library('url');
     $this->load->library('BarcodeQR');
     $this->load->library('Barcode39');
     $qr = new BarcodeQR();
     $barcode = new Barcode39(C_CODE);
     $qrStore = "cache/" . $this->escape($this->config->get('config_owner')) . '.png';
     $eanStore = "cache/" . $this->escape($this->config->get('config_owner')) . "_barcode_39.gif";
     if (!file_exists(DIR_IMAGE . $qrStore)) {
         $qr->url(HTTP_HOME);
         $qr->draw(150, DIR_IMAGE . $qrStore);
     }
     if (!file_exists(DIR_IMAGE . $eanStore)) {
         $barcode->draw(DIR_IMAGE . $eanStore);
     }
     $newsletter = str_replace("%7B", "{", $newsletter);
     $newsletter = str_replace("%7D", "}", $newsletter);
     $newsletter = str_replace("{%store_logo%}", '<img src="' . HTTP_IMAGE . $this->config->get('config_logo') . '" alt="' . $this->config->get('config_name') . '" />', $newsletter);
     $newsletter = str_replace("{%store_url%}", HTTP_HOME, $newsletter);
     $newsletter = str_replace("{%url_login%}", Url::createUrl("account/login"), $newsletter);
     $newsletter = str_replace("{%store_owner%}", $this->config->get('config_owner'), $newsletter);
     $newsletter = str_replace("{%store_name%}", $this->config->get('config_name'), $newsletter);
     $newsletter = str_replace("{%store_rif%}", $this->config->get('config_rif'), $newsletter);
     $newsletter = str_replace("{%store_email%}", $this->config->get('config_email'), $newsletter);
     $newsletter = str_replace("{%store_telephone%}", $this->config->get('config_telephone'), $newsletter);
     $newsletter = str_replace("{%store_address%}", $this->config->get('config_address'), $newsletter);
     /*
     $newsletter = str_replace("{%products%}",$product_html,$newsletter);
     */
     $newsletter = str_replace("{%date_added%}", date('d-m-Y h:i A'), $newsletter);
     $newsletter = str_replace("{%ip%}", $_SERVER['REMOTE_ADDR'], $newsletter);
     $newsletter = str_replace("{%qr_code_store%}", '<img src="' . HTTP_IMAGE . $qrStore . '" alt="QR Code" />', $newsletter);
     $newsletter = str_replace("{%barcode_39_order_id%}", '<img src="' . HTTP_IMAGE . $eanStore . '" alt="NT Code" />', $newsletter);
     if ($params['product']) {
         $newsletter = str_replace("{%product_name%}", '<h1><a href="' . $params['product']['url'] . '">' . $params['product']['name'] . '</a></h1>', $newsletter);
         $newsletter = str_replace("{%product_model%}", '<b>' . $params['product']['model'] . '</b>', $newsletter);
         $newsletter = str_replace("{%product_price%}", '<h2>' . $params['product']['price'] . '</h2>', $newsletter);
         $newsletter = str_replace("{%product_special%}", '<h2>' . $params['product']['special'] . '</h2>', $newsletter);
         $newsletter = str_replace("{%product_image%}", '<a href="' . $params['product']['url'] . '"><img src="' . $params['product']['image'] . '" alt="' . $params['product']['name'] . '" /></a>', $newsletter);
         $newsletter = str_replace("{%product_manufacturer%}", $params['product']['manufacturer'], $newsletter);
         $newsletter = str_replace("{%product_url%}", '<a href="' . $params['product']['url'] . '">Ver Detalles</a>', $newsletter);
         foreach ($params['product']['images'] as $key => $value) {
             $product_images .= "<img src=\"" . $value . "\" alt=\"" . $product['name'] . "\" />";
         }
         $newsletter = str_replace("{%product_images%}", $product_images, $newsletter);
         if ($params['product']['discounts']) {
             $product_discounts = "<table><tr><th>Cantidad</th><th>Precio</th></tr>";
             foreach ($params['product']['discounts'] as $key => $value) {
                 $product_discounts .= "<tr>";
                 $product_discounts .= "<td>" . $value['quantity'] . "</td>";
                 $product_discounts .= "<td>" . $value['price'] . "</td>";
                 $product_discounts .= "</tr>";
             }
             $product_discounts .= "</table>";
             $newsletter = str_replace("{%product_discounts%}", discounts, $newsletter);
         }
         foreach ($params['product']['tags'] as $key => $value) {
             $product_tags .= "<a href=\"" . $value['href'] . "\">" . $value['tag'] . "</a>";
         }
         $newsletter = str_replace("{%product_tags%}", $product_tags, $newsletter);
     }
     $newsletter .= "<p style=\"text-align:center;font:normal 10px Verdana;color:#333;\">Powered By Necotienda " . date('Y') . "</p>";
     return $newsletter;
     return html_entity_decode(htmlspecialchars_decode($newsletter));
 }
Ejemplo n.º 11
0
 public function register()
 {
     if (!$this->customer->islogged()) {
         $this->load->model("account/customer");
         $this->load->model("marketing/newsletter");
         $this->load->library('email/mailer');
         $this->load->library('BarcodeQR');
         $mailer = new Mailer();
         if (!file_exists(DIR_IMAGE . "cache/" . str_replace(".", "_", $this->config->get('config_owner')) . '.png')) {
             $qr = new BarcodeQR();
             $qr->url(HTTP_HOME);
             $qr->draw(100, DIR_IMAGE . "cache/" . str_replace(".", "_", $this->config->get('config_owner')) . '.png');
         }
         $this->request->post['rif'] = $this->request->post['riftype'] . $this->request->post['rif'];
         $this->request->post['password'] = substr(md5(rand(11111111, 99999999)), 0, 8);
         if ($this->request->hasPost('referencedBy')) {
             $promotor = $this->modelCustomer->getCustomerByEmail($this->request->getPost('referencedBy'));
             $this->request->post['referenced_by'] = $promotor['customer_id'] ? $promotor['customer_id'] : 0;
         }
         if ($this->modelCustomer->addCustomer($this->request->post)) {
             $this->customer->login($this->request->post['email'], $this->request->post['password'], true);
             if ($this->request->post['session_address_var']) {
                 $this->session->set($this->request->post['session_address_var'], $this->customer->getAddressId());
             }
             $this->session->clear('guest');
             if ($this->config->get('marketing_email_register_customer')) {
                 $newsletter = $this->modelNewsletter->getById($this->config->get('marketing_email_register_customer'));
                 $message = $newsletter['htmlbody'];
                 $message = str_replace("{%store_name%}", $this->config->get('config_owner'), $message);
                 $message = str_replace("{%store_rif%}", $this->config->get('config_rif'), $message);
                 $message = str_replace("{%store_address%}", $this->config->get('config_address'), $message);
                 $message = str_replace("{%company%}", $this->customer->getCompany(), $message);
                 $message = str_replace("{%email%}", $this->customer->getEmail(), $message);
                 $message = str_replace("{%password%}", $this->request->post['password'], $message);
                 $message = str_replace("{%date_added%}", date('d-m-Y h:i A', strtotime($order['date_added'])), $message);
                 $message = str_replace("{%ip%}", $order['ip'], $message);
                 $message = str_replace("{%qr_code_store%}", HTTP_IMAGE . "cache/" . str_replace(".", "_", $this->config->get('config_owner')) . '.png', $message);
                 $subject = $this->config->get('config_owner') . " " . $this->language->get('text_welcome');
                 if ($this->config->get('config_smtp_method') == 'smtp') {
                     $mailer->IsSMTP();
                     $mailer->Host = $this->config->get('config_smtp_host');
                     $mailer->Username = $this->config->get('config_smtp_username');
                     $mailer->Password = base64_decode($this->config->get('config_smtp_password'));
                     $mailer->Port = $this->config->get('config_smtp_port');
                     $mailer->Timeout = $this->config->get('config_smtp_timeout');
                     $mailer->SMTPSecure = $this->config->get('config_smtp_ssl');
                     $mailer->SMTPAuth = $this->config->get('config_smtp_auth') ? true : false;
                 } elseif ($this->config->get('config_smtp_method') == 'sendmail') {
                     $mailer->IsSendmail();
                 } else {
                     $mailer->IsMail();
                 }
                 $mailer->IsHTML();
                 $mailer->AddAddress($this->customer->getEmail(), $this->customer->getCompany());
                 $mailer->AddBCC($this->config->get('config_email'), $this->config->get('config_name'));
                 $mailer->SetFrom($this->config->get('config_email'), $this->config->get('config_name'));
                 $mailer->Subject = $subject;
                 $mailer->Body = html_entity_decode(htmlspecialchars_decode($message));
                 $mailer->Send();
             }
         }
     }
 }
 protected function renderHtml($results)
 {
     $this->language->load('module/catalog2pdf');
     $this->load->model('store/product');
     $this->load->model('store/review');
     $this->load->library('BarcodeQR');
     $qr = new BarcodeQR();
     $html = "<table>";
     $html .= "<thead>";
     $html .= "<tr>";
     $html .= "<td>" . $this->language->get('column_image') . "</td>";
     $html .= "<td>" . $this->language->get('column_description') . "</td>";
     $html .= "<td>" . $this->language->get('column_model') . "</td>";
     $html .= "<td>" . $this->language->get('column_rating') . "</td>";
     $html .= "<td>" . $this->language->get('column_price') . "</td>";
     $html .= "<td>" . $this->language->get('column_qr') . "</td>";
     $html .= "</tr>";
     $html .= "</thead>";
     $html .= "<tbody>";
     foreach ($results as $result) {
         $image = !empty($result['image']) ? $result['image'] : 'no_image.jpg';
         $rating = $this->config->get('config_review') ? $this->modelReview->getAverageRating($result['product_id']) : false;
         $special = false;
         $discount = $this->modelProduct->getProductDiscount($result['product_id']);
         if ($discount) {
             $price = $this->currency->format($this->tax->calculate($discount, $result['tax_class_id'], $this->config->get('config_tax')));
         } else {
             $price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')));
             $special = $this->modelProduct->getProductSpecial($result['product_id']);
             if ($special) {
                 $special = $this->currency->format($this->tax->calculate($special, $result['tax_class_id'], $this->config->get('config_tax')));
             }
         }
         $qr->url(Url::createUrl('store/product', array('product_id' => $result['product_id'])));
         $qr->draw(100, DIR_IMAGE . "cache/" . str_replace(".", "_", "qr_code_product_" . $result['product_id']) . '.png');
         $html .= '<tr>';
         $html .= '<td><img src="' . NTImage::resizeAndSave($image, $this->config->get('config_image_product_width'), $this->config->get('config_image_product_height')) . '" /></td>';
         $html .= '<td>' . $result['name'] . '</td>';
         $html .= '<td>' . $result['model'] . '</td>';
         $html .= '<td><img src="' . HTTP_IMAGE . 'stars_' . (int) $rating . '.png" /></td>';
         $html .= '<td>' . $price;
         if ($special) {
             $html .= '<br /><b>' . $this->language->get('text_special') . '</b>';
         }
         $html .= '</td>';
         $html .= '<td><img src="' . HTTP_IMAGE . "cache/" . str_replace(".", "_", "qr_code_product_" . $result['product_id']) . '.png' . '" /></td>';
         $html .= '</tr>';
     }
     $html .= "</tbody>";
     $html .= "<tfoot>";
     $html .= "<tr>";
     $html .= '<td colspan="6" style="text-align:center">Powered By NecoTienda&reg;</td>';
     $html .= "</tr>";
     $html .= "</tfoot>";
     $html .= "</table>";
     return $html;
 }