public function order()
 {
     /**
      * Setting base configuration
      */
     define('CD_URL_RETORNO', HTTPS_SERVER . 'index.php?route=payment/cobredireto/retorno');
     define('CD_URL_RECIBO', HTTPS_SERVER . 'index.php?route=payment/cobredireto/recibo');
     define('CD_URL_ERRO', HTTPS_SERVER . 'index.php?route=payment/cobredireto/erro');
     define('CD_CODLOJA', $this->config->get('cobredireto_cod_loja'));
     define('CD_AMBIENTE', $this->config->get('cobredireto_test') ? 'teste' : 'producao');
     define('CD_USUARIO', $this->config->get('cobredireto_username'));
     define('CD_SENHA', $this->config->get('cobredireto_password'));
     require_once DIR_APPLICATION . 'model' . DIRECTORY_SEPARATOR . 'payment' . DIRECTORY_SEPARATOR . 'cobredireto' . DIRECTORY_SEPARATOR . 'pagamento.php';
     /**
      * Initializing the library
      */
     $order = new pg($this->session->data['order_id']);
     /**
      * Including the Shipping cost
      */
     $frete = number_format($this->currency->format($this->session->data['shipping_method']['cost'], '', FALSE, FALSE), 2, '', '');
     $order->frete($frete);
     /**
      * Sending the shipping and the billing information
      */
     $this->load->model('checkout/order');
     $order_info = $this->model_checkout_order->getOrder($this->session->data['order_id']);
     $telephone = str_replace(' ', '', str_replace('(', '', str_replace(')', '', str_replace('-', '', $order_info['telephone']))));
     $data = array('primeiro_nome' => $order_info['shipping_firstname'], 'meio_nome' => '', 'ultimo_nome' => $order_info['shipping_lastname'], 'email' => $order_info['email'], 'documento' => '', 'tel_casa' => array('area' => substr($telephone, 0, -8), 'numero' => substr($telephone, -8)), 'cep' => $order_info['shipping_postcode']);
     $order->endereco($data, 'ENTREGA');
     $data = array('primeiro_nome' => $order_info['payment_firstname'], 'meio_nome' => '', 'ultimo_nome' => $order_info['payment_lastname'], 'email' => $order_info['email'], 'documento' => '', 'tel_casa' => array('area' => substr($telephone, 0, -8), 'numero' => substr($telephone, -8)), 'cep' => $order_info['payment_postcode']);
     $order->endereco($data, 'COBRANCA');
     $order->endereco($data, 'CONSUMIDOR');
     /**
      * Getting all the products from the order and including on the library
      */
     $products = $this->cart->getProducts();
     $prod = array();
     foreach ($products as $k => $v) {
         $prod[] = array("descricao" => $v['name'] . ' Model(' . $v['model'] . ')', "valor" => $v['price'], "quantidade" => $v['quantity'], "id" => $v['product_id']);
     }
     $order->adicionar($prod);
     /**
      * Let's PAY... <o
      */
     $order->pagar();
 }
Beispiel #2
0
<?php

require_once '../class/class.pg.php';
$pg = pg::getPg();
$q = $_REQUEST['q'];
$hint = "";
if ($q != "") {
    $sql = "select count(id) from _user_ where md5(id)=md5('{$q}');";
    $res = $pg->query($sql);
    $row = $res->fetch(PDO::FETCH_NUM)[0];
    if ($row) {
        $hint = "A felhasználónév foglalt!";
    } else {
        $hint = " ";
    }
    echo $hint;
}
 public static function connect()
 {
     if (self::$connected) {
         return true;
     }
     if (pg_connect('host=localhost dbname=imos user=webdev')) {
         self::$connected = true;
         pg_query('SET search_path TO foodmanager, public;');
         return true;
     }
     return false;
 }