当前位置: 首页>>代码示例>>PHP>>正文


PHP Customer::getFields方法代码示例

本文整理汇总了PHP中Customer::getFields方法的典型用法代码示例。如果您正苦于以下问题:PHP Customer::getFields方法的具体用法?PHP Customer::getFields怎么用?PHP Customer::getFields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Customer的用法示例。


在下文中一共展示了Customer::getFields方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: preProcess

 public function preProcess()
 {
     parent::preProcess();
     $customer = new Customer((int) self::$cookie->id_customer);
     if (sizeof($_POST)) {
         $exclusion = array('secure_key', 'old_passwd', 'passwd', 'active', 'date_add', 'date_upd', 'last_passwd_gen', 'newsletter_date_add', 'id_default_group');
         $fields = $customer->getFields();
         foreach ($fields as $key => $value) {
             if (!in_array($key, $exclusion)) {
                 $customer->{$key} = key_exists($key, $_POST) ? trim($_POST[$key]) : 0;
             }
         }
     }
     if (isset($_POST['years']) and isset($_POST['months']) and isset($_POST['days'])) {
         $customer->birthday = (int) $_POST['years'] . '-' . (int) $_POST['months'] . '-' . (int) $_POST['days'];
     }
     if (Tools::isSubmit('submitIdentity')) {
         if (!@checkdate(Tools::getValue('months'), Tools::getValue('days'), Tools::getValue('years')) and !(Tools::getValue('months') == '' and Tools::getValue('days') == '' and Tools::getValue('years') == '')) {
             $this->errors[] = Tools::displayError('Invalid date of birth');
         } else {
             $customer->birthday = empty($_POST['years']) ? '' : (int) $_POST['years'] . '-' . (int) $_POST['months'] . '-' . (int) $_POST['days'];
             $_POST['old_passwd'] = trim($_POST['old_passwd']);
             if (empty($_POST['old_passwd']) or Tools::encrypt($_POST['old_passwd']) != self::$cookie->passwd) {
                 $this->errors[] = Tools::displayError('Your password is incorrect.');
             } elseif ($_POST['passwd'] != $_POST['confirmation']) {
                 $this->errors[] = Tools::displayError('Password and confirmation do not match');
             } else {
                 $prev_id_default_group = $customer->id_default_group;
                 $this->errors = $customer->validateControler();
             }
             if (!sizeof($this->errors)) {
                 $customer->id_default_group = (int) $prev_id_default_group;
                 $customer->firstname = Tools::ucfirst(Tools::strtolower($customer->firstname));
                 if (Tools::getValue('passwd')) {
                     self::$cookie->passwd = $customer->passwd;
                 }
                 if ($customer->update()) {
                     self::$cookie->customer_lastname = $customer->lastname;
                     self::$cookie->customer_firstname = $customer->firstname;
                     self::$smarty->assign('confirmation', 1);
                 } else {
                     $this->errors[] = Tools::displayError('Cannot update information');
                 }
             }
         }
     } else {
         $_POST = array_map('stripslashes', $customer->getFields());
     }
     if ($customer->birthday) {
         $birthday = explode('-', $customer->birthday);
     } else {
         $birthday = array('-', '-', '-');
     }
     /* Generate years, months and days */
     self::$smarty->assign(array('years' => Tools::dateYears(), 'sl_year' => $birthday[0], 'months' => Tools::dateMonths(), 'sl_month' => $birthday[1], 'days' => Tools::dateDays(), 'sl_day' => $birthday[2], 'errors' => $this->errors));
     self::$smarty->assign('newsletter', (int) Module::getInstanceByName('blocknewsletter')->active);
 }
开发者ID:srikanthash09,项目名称:codetestdatld,代码行数:57,代码来源:IdentityController.php

示例2: preProcess

 public function preProcess()
 {
     parent::preProcess();
     $customer = new Customer((int) self::$cookie->id_customer);
     if (isset($_POST['years']) && isset($_POST['months']) && isset($_POST['days'])) {
         $customer->birthday = (int) $_POST['years'] . '-' . (int) $_POST['months'] . '-' . (int) $_POST['days'];
     }
     if (Tools::isSubmit('submitIdentity')) {
         if (Module::getInstanceByName('blocknewsletter')->active) {
             if (!isset($_POST['optin'])) {
                 $customer->optin = 0;
             }
             if (!isset($_POST['newsletter'])) {
                 $customer->newsletter = 0;
             }
         }
         if (!isset($_POST['id_gender'])) {
             $_POST['id_gender'] = 9;
         }
         if (!@checkdate(Tools::getValue('months'), Tools::getValue('days'), Tools::getValue('years')) && !(Tools::getValue('months') == '' && Tools::getValue('days') == '' && Tools::getValue('years') == '')) {
             $this->errors[] = Tools::displayError('Invalid date of birth');
         } else {
             $customer->birthday = empty($_POST['years']) ? '' : (int) $_POST['years'] . '-' . (int) $_POST['months'] . '-' . (int) $_POST['days'];
             $id_customer_exists = (int) Customer::customerExists(Tools::getValue('email'), true, false);
             if ($id_customer_exists && $id_customer_exists != (int) self::$cookie->id_customer) {
                 $this->errors[] = Tools::displayError('An account is already registered with this e-mail.');
             }
             $_POST['old_passwd'] = trim($_POST['old_passwd']);
             if (empty($_POST['old_passwd']) || Tools::encrypt($_POST['old_passwd']) != self::$cookie->passwd) {
                 $this->errors[] = Tools::displayError('Your password is incorrect.');
             } elseif ($_POST['passwd'] != $_POST['confirmation']) {
                 $this->errors[] = Tools::displayError('Password and confirmation do not match');
             } else {
                 $prev_id_default_group = $customer->id_default_group;
                 $this->errors = array_unique(array_merge($this->errors, $customer->validateController(true, true)));
             }
             if (!count($this->errors)) {
                 $customer->id_default_group = (int) $prev_id_default_group;
                 $customer->firstname = Tools::ucfirst(Tools::strtolower($customer->firstname));
                 if (Tools::getValue('passwd')) {
                     self::$cookie->passwd = $customer->passwd;
                 }
                 if ($customer->update()) {
                     self::$cookie->customer_lastname = $customer->lastname;
                     self::$cookie->customer_firstname = $customer->firstname;
                     self::$smarty->assign('confirmation', 1);
                 } else {
                     $this->errors[] = Tools::displayError('Cannot update information');
                 }
             }
         }
     } else {
         $_POST = array_map('stripslashes', $customer->getFields());
     }
     $birthday = $customer->birthday ? explode('-', $customer->birthday) : array('-', '-', '-');
     /* Generate years, months and days */
     self::$smarty->assign(array('years' => Tools::dateYears(), 'sl_year' => $birthday[0], 'months' => Tools::dateMonths(), 'sl_month' => $birthday[1], 'days' => Tools::dateDays(), 'sl_day' => $birthday[2], 'errors' => $this->errors));
     self::$smarty->assign('newsletter', (int) Module::getInstanceByName('blocknewsletter')->active);
 }
开发者ID:Evil1991,项目名称:PrestaShop-1.4,代码行数:59,代码来源:IdentityController.php

示例3: hookcreateAccount

 public function hookcreateAccount($req)
 {
     global $cookie;
     $id_lang = $cookie->id_lang;
     $cookie->logout();
     $cookie->id_lang = $id_lang;
     $cookie->write();
     $activation_link = md5(uniqid(rand(), true));
     $link = $this->context->link->getModuleLink($this->name, 'activation') . '&link=' . $activation_link;
     $sql = sprintf("update %scustomer set active=0, activation_link='%s' where id_customer=%d", _DB_PREFIX_, $activation_link, $req['newCustomer']->id);
     Db::getInstance()->Execute($sql);
     $customer = new Customer($req['newCustomer']->id);
     $customer->getFields();
     Mail::Send($id_lang, 'account_activation', $this->l('Account activation'), array('{firstname}' => $customer->firstname, '{lastname}' => $customer->lastname, '{email}' => $customer->email, '{link}' => $link), $customer->email, NULL, NULL, NULL, NULL, NULL, 'modules/activationbymail/mails/');
     Tools::redirect($this->context->link->getModuleLink($this->name, 'info'));
 }
开发者ID:ashishScripter,项目名称:activationbymail,代码行数:16,代码来源:activationbymail.php

示例4: dirname

<?php

/* SSL Management */
$useSSL = true;
include dirname(__FILE__) . '/config/config.inc.php';
include dirname(__FILE__) . '/init.php';
if (!$cookie->isLogged()) {
    Tools::redirect('authentication.php?back=identity.php');
}
$customer = new Customer(intval($cookie->id_customer));
$need_identification_number = $customer->getNeedDNI();
if (sizeof($_POST)) {
    $exclusion = array('secure_key', 'old_passwd', 'passwd', 'active', 'date_add', 'date_upd', 'last_passwd_gen', 'newsletter_date_add', 'id_default_group');
    $fields = $customer->getFields();
    foreach ($fields as $key => $value) {
        if (!in_array($key, $exclusion)) {
            $customer->{$key} = key_exists($key, $_POST) ? trim($_POST[$key]) : 0;
        }
    }
}
if (isset($_POST['years']) and isset($_POST['months']) and isset($_POST['days'])) {
    $customer->birthday = intval($_POST['years']) . '-' . intval($_POST['months']) . '-' . intval($_POST['days']);
}
$errors = array();
if (Tools::isSubmit('submitIdentity')) {
    if (!@checkdate(Tools::getValue('months'), Tools::getValue('days'), Tools::getValue('years')) and !(Tools::getValue('months') == '' and Tools::getValue('days') == '' and Tools::getValue('years') == '')) {
        $errors[] = Tools::displayError('invalid birthday');
    } else {
        $customer->birthday = empty($_POST['years']) ? '' : intval($_POST['years']) . '-' . intval($_POST['months']) . '-' . intval($_POST['days']);
        $_POST['old_passwd'] = trim($_POST['old_passwd']);
        if (empty($_POST['old_passwd']) or Tools::encrypt($_POST['old_passwd']) != $cookie->passwd) {
开发者ID:vincent,项目名称:theinvertebrates,代码行数:31,代码来源:identity.php

示例5: hookPaymentReturn

 public function hookPaymentReturn($params)
 {
     global $cookie, $smarty;
     include dirname(__FILE__) . '/includes/Shop.php';
     // dados do cliente
     $customer = new Customer(intval($cookie->id_customer));
     $ArrayCliente = $customer->getFields();
     // dados do pedido
     $DadosOrder = new Order($params['objOrder']->id);
     $ArrayListaProdutos = $DadosOrder->getProducts();
     // gera descri�?o
     foreach ($ArrayListaProdutos as $info) {
         $item = array($zb[] = $info['product_name'] . ' * ' . $info['product_quantity']);
     }
     $descricao = implode(" + ", $zb);
     $currency = new Currency($DadosOrder->id_currency);
     $dados = array("external_reference" => $params['objOrder']->id, "currency" => $currency->iso_code, "title" => $descricao, "description" => $descricao, 'quantity' => 1, 'image' => '', 'amount' => $params['total_to_pay'], 'payment_firstname' => $ArrayCliente['firstname'], 'payment_lastname' => $ArrayCliente['lastname'], 'email' => $ArrayCliente['email'], 'pending' => Configuration::get('mercadopago_URLPROCESS'), 'approved' => Configuration::get('mercadopago_URLSUCCESFULL'));
     $client = Configuration::get('mercadopago_CLIENT_ID');
     $secret = Configuration::get('mercadopago_CLIENT_SECRET');
     $exclude = Configuration::get('mercadopago_METHODS');
     $pagamento = new MPShop($client, $secret);
     $botton = $pagamento->GetCheckout($dados, $exclude);
     $country = Configuration::get('mercadopago_COUNTRY');
     switch ($country) {
         case 'MLA':
             $banner = 'modules/mercadopago/imagens/mercadopagoar.jpg';
             break;
         case 'MLB':
             $banner = 'modules/mercadopago/imagens/mercadopagobr.jpg';
             break;
         case 'MLM':
             $banner = 'modules/mercadopago/imagens/mercadopagomx.jpg';
             break;
         case 'MLV':
             $banner = 'modules/mercadopago/imagens/mercadopagov.jpg';
             break;
         default:
             $banner = 'modules/mercadopago/imagens/mercadopagobr.jpg';
     }
     $smarty->assign(array('totalApagar' => Tools::displayPrice($params['total_to_pay'], $params['currencyObj'], false, false), 'status' => 'ok', 'seller_op_id' => $params['objOrder']->id, 'secure_key' => $params['objOrder']->secure_key, 'id_module' => $this->id, 'formmercadopago' => $botton, 'imgBnr' => $banner));
     return $this->display(__FILE__, 'payment_return.tpl');
 }
开发者ID:mercadeoweb,项目名称:cart-prestashop,代码行数:42,代码来源:mercadopago.php

示例6: postProcess

 /**
  * Start forms process
  * @see FrontController::postProcess()
  */
 public function postProcess()
 {
     $origin_newsletter = (bool) $this->customer->newsletter;
     if (Tools::isSubmit('submitIdentity')) {
         $email = trim(Tools::getValue('email'));
         if (Tools::getValue('months') != '' && Tools::getValue('days') != '' && Tools::getValue('years') != '') {
             $this->customer->birthday = (int) Tools::getValue('years') . '-' . (int) Tools::getValue('months') . '-' . (int) Tools::getValue('days');
         } elseif (Tools::getValue('months') == '' && Tools::getValue('days') == '' && Tools::getValue('years') == '') {
             $this->customer->birthday = null;
         } else {
             $this->errors[] = Tools::displayError('Invalid date of birth.');
         }
         if (Tools::getIsset('old_passwd')) {
             $old_passwd = trim(Tools::getValue('old_passwd'));
         }
         if (!Validate::isEmail($email)) {
             $this->errors[] = Tools::displayError('This email address is not valid');
         } elseif ($this->customer->email != $email && Customer::customerExists($email, true)) {
             $this->errors[] = Tools::displayError('An account using this email address has already been registered.');
         } elseif (!Tools::getIsset('old_passwd') || Tools::encrypt($old_passwd) != $this->context->cookie->passwd) {
             $this->errors[] = Tools::displayError('The password you entered is incorrect.');
         } elseif (Tools::getValue('passwd') != Tools::getValue('confirmation')) {
             $this->errors[] = Tools::displayError('The password and confirmation do not match.');
         } else {
             $prev_id_default_group = $this->customer->id_default_group;
             // Merge all errors of this file and of the Object Model
             $this->errors = array_merge($this->errors, $this->customer->validateController());
         }
         if (!count($this->errors)) {
             $this->customer->id_default_group = (int) $prev_id_default_group;
             $this->customer->firstname = Tools::ucwords($this->customer->firstname);
             if (Configuration::get('PS_B2B_ENABLE')) {
                 $this->customer->website = Tools::getValue('website');
                 // force update of website, even if box is empty, this allows user to remove the website
                 $this->customer->company = Tools::getValue('company');
             }
             if (!Tools::getIsset('newsletter')) {
                 $this->customer->newsletter = 0;
             } elseif (!$origin_newsletter && Tools::getIsset('newsletter')) {
                 if ($module_newsletter = Module::getInstanceByName('blocknewsletter')) {
                     /** @var Blocknewsletter $module_newsletter */
                     if ($module_newsletter->active) {
                         $module_newsletter->confirmSubscription($this->customer->email);
                     }
                 }
             }
             if (!Tools::getIsset('optin')) {
                 $this->customer->optin = 0;
             }
             if (Tools::getValue('passwd')) {
                 $this->context->cookie->passwd = $this->customer->passwd;
             }
             if ($this->customer->update()) {
                 $this->context->cookie->customer_lastname = $this->customer->lastname;
                 $this->context->cookie->customer_firstname = $this->customer->firstname;
                 $this->context->smarty->assign('confirmation', 1);
             } else {
                 $this->errors[] = Tools::displayError('The information cannot be updated.');
             }
         }
     } else {
         $_POST = array_map('stripslashes', $this->customer->getFields());
     }
     return $this->customer;
 }
开发者ID:yewed,项目名称:share,代码行数:69,代码来源:IdentityController.php

示例7: hookPaymentReturn

    public function hookPaymentReturn($params)
    {
        global $cookie, $smarty;
        // dados do cliente
        $customer = new Customer(intval($cookie->id_customer));
        $ArrayCliente = $customer->getFields();
        // dados do pedido
        $DadosOrder = new Order($params['objOrder']->id);
        $ArrayListaProdutos = $DadosOrder->getProducts();
        //Get shipment
        $address_delivery = new Address(intval($params['cart']->id_address_delivery));
        $shipments = array("receiver_address" => array("floor" => "-", "zip_code" => $address_delivery->postcode, "street_name" => $address_delivery->address1 . " - " . $address_delivery->address2 . " - " . $address_delivery->city . "/" . $address_delivery->country, "apartment" => "-", "street_number" => "-"));
        //Force format YYYY-DD-MMTH:i:s
        $date_creation_user = date('Y-m-d', strtotime($ArrayCliente['date_add'])) . "T" . date('H:i:s', strtotime($ArrayCliente['date_add']));
        $address_invoice = new Address(intval($params['cart']->id_address_invoice));
        $phone = $address_invoice->phone;
        $phone .= $phone == "" ? "" : "|";
        $phone .= $address_invoice->phone_mobile;
        $payer = array("name" => $ArrayCliente['firstname'], "surname" => $ArrayCliente['lastname'], "email" => $ArrayCliente['email'], "date_created" => $date_creation_user, "phone" => array("area_code" => "-", "number" => $phone), "address" => array("zip_code" => $address_invoice->postcode, "street_name" => $address_invoice->address1 . " - " . $address_delivery->address2 . " - " . $address_delivery->city . "/" . $address_delivery->country, "street_number" => "-"), "identification" => array("number" => "null", "type" => "null"));
        //items
        $image_url = "";
        // gera descrição
        foreach ($ArrayListaProdutos as $info) {
            $item = array($zb[] = $info['product_name'] . ' * ' . $info['product_quantity']);
            //get object image on product object
            $id_image = $info['image'];
            // get Image by id
            if (sizeof($id_image) > 0) {
                $image = new Image($id_image->id_image);
                // get image full URL
                $image_url = _PS_BASE_URL_ . _THEME_PROD_DIR_ . $image->getExistingImgPath() . "." . $image->image_format;
            }
        }
        $descricao = implode(" + ", $zb);
        $item_price = number_format($params['total_to_pay'], 2, '.', '');
        $currency = new Currency($DadosOrder->id_currency);
        $items = array(array("id" => $params['objOrder']->id, "title" => utf8_encode($descricao), "description" => utf8_encode($descricao), "quantity" => 1, "unit_price" => round($item_price, 2), "currency_id" => $currency->iso_code, "picture_url" => $image_url, "category_id" => Configuration::get('mercadopago_CATEGORY')));
        //excludes_payment_methods
        $exclude = Configuration::get('mercadopago_METHODS');
        $installments = Configuration::get('mercadopago_INSTALLMENTS');
        $installments = str_replace("inst-", "", $installments);
        $installments = (int) $installments;
        if ($exclude != '') {
            //case exist exclude methods
            $methods_excludes = preg_split("/[\\s,]+/", $exclude);
            $excludemethods = array();
            foreach ($methods_excludes as $exclude) {
                if ($exclude != "") {
                    $excludemethods[] = array('id' => $exclude);
                }
            }
            $payment_methods = array("installments" => $installments, "excluded_payment_methods" => $excludemethods);
        } else {
            //case not exist exclude methods
            $payment_methods = array("installments" => $installments);
        }
        //set back url
        $back_urls = array("pending" => Configuration::get('mercadopago_URLPROCESS'), "success" => Configuration::get('mercadopago_URLSUCCESFULL'));
        //mount array pref
        $pref = array();
        $pref['external_reference'] = $params['objOrder']->id;
        $pref['payer'] = $payer;
        $pref['shipments'] = $shipments;
        $pref['items'] = $items;
        $pref['back_urls'] = $back_urls;
        $pref['payment_methods'] = $payment_methods;
        $client_id = Configuration::get('mercadopago_CLIENT_ID');
        $client_secret = Configuration::get('mercadopago_CLIENT_SECRET');
        $mp = new MP($client_id, $client_secret);
        $preferenceResult = $mp->create_preference($pref);
        $sandbox = Configuration::get('mercadopago_SANDBOX') == "active" ? true : false;
        $url = "";
        if ($sandbox) {
            $url = $preferenceResult['response']['sandbox_init_point'];
        } else {
            $url = $preferenceResult['response']['init_point'];
        }
        switch (Configuration::get('mercadopago_TYPECHECKOUT')) {
            case "Iframe":
                $botton = '
		    <iframe src="' . $url . '" name="MP-Checkout" width="740" height="600" frameborder="0"></iframe>
		    <script type="text/javascript">
			(function(){function $MPBR_load(){window.$MPBR_loaded !== true && (function(){var s = document.createElement("script");s.type = "text/javascript";s.async = true;
			s.src = ("https:"==document.location.protocol?"https://www.mercadopago.com/org-img/jsapi/mptools/buttons/":"http://mp-tools.mlstatic.com/buttons/")+"render.js";
			var x = document.getElementsByTagName("script")[0];x.parentNode.insertBefore(s, x);window.$MPBR_loaded = true;})();}
			window.$MPBR_loaded !== true ? (window.attachEvent ? window.attachEvent("onload", $MPBR_load) : window.addEventListener("load", $MPBR_load, false)) : null;})();
		    </script>
		';
                break;
            case "Redirect":
                header("location: " . $url);
                break;
            case "Lightbox":
            default:
                $botton = '
		    <a href="' . $url . '" name="MP-Checkout" class="blue-L-Rn" mp-mode="modal" onreturn="execute_my_onreturn">Pagar</a>
		    <script type="text/javascript">
			(function(){function $MPBR_load(){window.$MPBR_loaded !== true && (function(){var s = document.createElement("script");s.type = "text/javascript";s.async = true;
			s.src = ("https:"==document.location.protocol?"https://www.mercadopago.com/org-img/jsapi/mptools/buttons/":"http://mp-tools.mlstatic.com/buttons/")+"render.js";
			var x = document.getElementsByTagName("script")[0];x.parentNode.insertBefore(s, x);window.$MPBR_loaded = true;})();}
//.........这里部分代码省略.........
开发者ID:mercadeoweb,项目名称:cart-prestashop,代码行数:101,代码来源:mercadopago.php

示例8: infoFields

function infoFields()
{
    $c = new Customer();
    return $c->getFields();
}
开发者ID:Babaritech,项目名称:babar2,代码行数:5,代码来源:customer.php


注:本文中的Customer::getFields方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。