本文整理汇总了PHP中Customer::getCustomers方法的典型用法代码示例。如果您正苦于以下问题:PHP Customer::getCustomers方法的具体用法?PHP Customer::getCustomers怎么用?PHP Customer::getCustomers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Customer
的用法示例。
在下文中一共展示了Customer::getCustomers方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: hookAdminStatsModules
public function hookAdminStatsModules($params)
{
$this->_html = '<fieldset class="width3"><legend><img src="../modules/' . $this->name . '/logo.gif" /> ' . $this->displayName . '</legend>';
if (sizeof(Customer::getCustomers())) {
if (Tools::getValue('export')) {
if (Tools::getValue('exportType') == 'gender') {
$this->csvExport(array('type' => 'pie', 'option' => 'gender'));
} elseif (Tools::getValue('exportType') == 'age') {
$this->csvExport(array('type' => 'pie', 'option' => 'age'));
} elseif (Tools::getValue('exportType') == 'country') {
$this->csvExport(array('type' => 'pie', 'option' => 'country'));
} elseif (Tools::getValue('exportType') == 'currency') {
$this->csvExport(array('type' => 'pie', 'option' => 'currency'));
} elseif (Tools::getValue('exportType') == 'language') {
$this->csvExport(array('type' => 'pie', 'option' => 'language'));
}
}
$this->_html .= '
<center><p><img src="../img/admin/down.gif" />' . $this->l('Gender distribution allows you to determine the percentage of men and women among your customers.') . '</p>
' . ModuleGraph::engine(array('type' => 'pie', 'option' => 'gender')) . '<br /></center>
<p><a href="' . $_SERVER['REQUEST_URI'] . '&export=1&exportType=gender"><img src="../img/admin/asterisk.gif" />' . $this->l('CSV Export') . '</a></p>
<br class="clear" /><br />
<center><p><img src="../img/admin/down.gif" />' . $this->l('Age ranges allows you to determine in which age range your customers are.') . '</p>
' . ModuleGraph::engine(array('type' => 'pie', 'option' => 'age')) . '<br /></center>
<p><a href="' . $_SERVER['REQUEST_URI'] . '&export=1&exportType=age"><img src="../img/admin/asterisk.gif" />' . $this->l('CSV Export') . '</a></p><br /><br />
<center><p><img src="../img/admin/down.gif" />' . $this->l('Country distribution allows you to determine in which part of the world your customers are shopping from.') . '</p>
' . ModuleGraph::engine(array('type' => 'pie', 'option' => 'country')) . '<br /></center>
<p><a href="' . $_SERVER['REQUEST_URI'] . '&export=1&exportType=country"><img src="../img/admin/asterisk.gif" />' . $this->l('CSV Export') . '</a></p><br /><br />
<center><p><img src="../img/admin/down.gif" />' . $this->l('Currency ranges allows you to determine which currencies your customers are using.') . '</p>
' . ModuleGraph::engine(array('type' => 'pie', 'option' => 'currency')) . '<br /></center>
<p><a href="' . $_SERVER['REQUEST_URI'] . '&export=1&exportType=currency"><img src="../img/admin/asterisk.gif" />' . $this->l('CSV Export') . '</a></p><br /><br />
<center><p><img src="../img/admin/down.gif" />' . $this->l('Language distribution allows you to determine the general languages your customers are using on your shop.') . '</p>
' . ModuleGraph::engine(array('type' => 'pie', 'option' => 'language')) . '<br /></center>
<p><a href="' . $_SERVER['REQUEST_URI'] . '&export=1&exportType=language"><img src="../img/admin/asterisk.gif" />' . $this->l('CSV Export') . '</a></p>
</center>';
} else {
$this->_html .= '<p>' . $this->l('No customers registered yet.') . '</p>';
}
$this->_html .= '
</fieldset><br />
<fieldset class="width3"><legend><img src="../img/admin/comment.gif" /> ' . $this->l('Guide') . '</legend>
<h2>' . $this->l('Target your audience') . '</h2>
<p>
' . $this->l('In order for each message to have an impact, you need to know to whom it should be addressed.') . '
' . $this->l('Addressing the right audience is essential for choosing the right tools to win them over.') . '
' . $this->l('It is best to limit action to a group or groups of clients.') . '
' . $this->l('Registered customer information allows you to accurately define the typical customer profile so that you can adapt your specials to various criteria.') . '
</p><br />
<p>
' . $this->l('You should use this information to increase your sales by') . '
<ul>
<li class="bullet">' . $this->l('launching ad campaigns addressed to specific customers who might be interested in a particular offer at specific dates and times.') . '</li>
<li class="bullet">' . $this->l('Contacting a group of clients by e-mail / newsletter.') . '</li>
</ul>
</p><br />
</fieldset>';
return $this->_html;
}
示例2: anonimize_customers
public static function anonimize_customers()
{
$customers = Customer::getCustomers();
foreach ($customers as $customer) {
// print_r($customer);
$anon_customer = new Customer($customer["id_customer"]);
$anon_customer->email = md5($customer['email']) . '@example.com';
$res = $anon_customer->update();
if ($res) {
echo "Successfully updated user " . $anon_customer->id . "\n";
} else {
echo "Error, could not update user " . $customer['id_customer'] . "\n";
return false;
}
}
}
示例3: Customer
<?php
if ($_SESSION["profile"] == "2") {
$_GET['idcustomer'] = $_SESSION["idcustomer"];
}
?>
<form id="form1" action="../controller/CustomerController.php?opcion=" method="post" >
<table width="680" cellspacing="0" border="0" align="center">
<tr>
<td>Customer</td>
<td>
<select name="cmbCustomer" id="cmbCustomer" onchange="loadOrderGuide('orderGuide',this.value)" style="min-width: 200px;">
<option value="" selected="selected">...</option>
<?php
include_once "../model/Customer.php";
$customerObj = new Customer();
$customers = $customerObj->getCustomers($_SESSION["profile"], $_SESSION["username"]);
foreach ($customers as $id => $value) {
?>
<option value="<?php
echo $id;
?>
" <?php
echo $_GET['idcustomer'] === $id ? "selected='selected'" : "";
?>
><?php
echo htmlentities($value);
?>
</option>
<?php
}
?>
示例4: _displayFormView
private function _displayFormView()
{
$customers = Customer::getCustomers();
if (!sizeof($customers)) {
return;
}
$id_customer = (int) Tools::getValue('id_customer');
if (!$id_customer) {
$id_customer = $customers[0]['id_customer'];
}
$this->_html .= '<br />
<form action="' . Tools::safeOutput($_SERVER['REQUEST_URI']) . '" method="post" id="listing">
<fieldset>
<legend><img src="' . $this->_path . 'img/icon/package_go.png" alt="" title="" />' . $this->l('Listing') . '</legend>
<label>' . $this->l('Customers') . '</label>
<div class="margin-form">
<select name="id_customer" onchange="$(\'#listing\').submit();">';
foreach ($customers as $customer) {
$this->_html .= '<option value="' . (int) $customer['id_customer'] . '"';
if ($customer['id_customer'] == $id_customer) {
$this->_html .= ' selected="selected"';
}
$this->_html .= '>' . htmlentities($customer['firstname'], ENT_COMPAT, 'UTF-8') . ' ' . htmlentities($customer['lastname'], ENT_COMPAT, 'UTF-8') . '</option>';
}
$this->_html .= '
</select>
</div>';
require_once dirname(__FILE__) . '/WishList.php';
$wishlists = WishList::getByIdCustomer($id_customer);
if (!sizeof($wishlists)) {
return $this->_html .= '</fieldset></form>';
}
$id_wishlist = false;
foreach ($wishlists as $row) {
if ($row['id_wishlist'] == Tools::getValue('id_wishlist')) {
$id_wishlist = (int) Tools::getValue('id_wishlist');
break;
}
}
if (!$id_wishlist) {
$id_wishlist = $wishlists[0]['id_wishlist'];
}
$this->_html .= '
<label>' . $this->l('Wishlists') . '</label>
<div class="margin-form">
<select name="id_wishlist" onchange="$(\'#listing\').submit();">';
foreach ($wishlists as $wishlist) {
$this->_html .= '<option value="' . (int) $wishlist['id_wishlist'] . '"';
if ($wishlist['id_wishlist'] == $id_wishlist) {
$this->_html .= ' selected="selected"';
$counter = $wishlist['counter'];
}
$this->_html .= '>' . htmlentities($wishlist['name'], ENT_COMPAT, 'UTF-8') . '</option>';
}
$this->_html .= '
</select>
</div>';
$this->_displayProducts((int) $id_wishlist);
$this->_html .= '</fieldset>
</form>';
}
示例5: renderForm
public function renderForm()
{
$customers = Customer::getCustomers();
foreach ($customers as $key => $val) {
$customers[$key]['name'] = $val['firstname'] . ' ' . $val['lastname'];
}
$fields_form = array('form' => array('legend' => array('title' => $this->l('Listing'), 'icon' => 'icon-cogs'), 'input' => array(array('type' => 'select', 'label' => $this->l('Customers :'), 'name' => 'id_customer', 'options' => array('default' => array('value' => 0, 'label' => $this->l('Choose customer')), 'query' => $customers, 'id' => 'id_customer', 'name' => 'name')))));
if ($id_customer = Tools::getValue('id_customer')) {
$wishlists = WishList::getByIdCustomer($id_customer);
$fields_form['form']['input'][] = array('type' => 'select', 'label' => $this->l('Wishlist :'), 'name' => 'id_wishlist', 'options' => array('default' => array('value' => 0, 'label' => $this->l('Choose wishlist')), 'query' => $wishlists, 'id' => 'id_wishlist', 'name' => 'name'));
}
$helper = new HelperForm();
$helper->show_toolbar = false;
$helper->table = $this->table;
$lang = new Language((int) Configuration::get('PS_LANG_DEFAULT'));
$helper->default_form_language = $lang->id;
$helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0;
$helper->identifier = $this->identifier;
$helper->submit_action = 'submitModule';
$helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false) . '&configure=' . $this->name . '&tab_module=' . $this->tab . '&module_name=' . $this->name;
$helper->token = Tools::getAdminTokenLite('AdminModules');
$helper->tpl_vars = array('fields_value' => $this->getConfigFieldsValues(), 'languages' => $this->context->controller->getLanguages(), 'id_language' => $this->context->language->id);
return $helper->generateForm(array($fields_form));
}
示例6: Payment
var cust_id = $('#cust_id').val();
window.location = api.base_url + '/profile/'+cust_id;
});
});
</script>
<div class="container">
<div class="page-header">
<h2>Payment <small>Group by customers</small></h2>
</div>
<?php
include_once "api/payment.php";
include_once "api/customer.php";
$Payments = new Payment();
$Customer = new Customer();
$getCustomers = $Customer->getCustomers();
if (count($getCustomers)) {
echo "<div id='accordion' class='panel-group'>";
foreach ($getCustomers as $val) {
$getPayments = $Payments->getCustomerPayments($val->id);
echo "<div class='panel panel-success'>\n\t\t\t\t<div class='panel-heading'>\n\t\t\t\t\t<h4>\n\t\t\t\t\t\t<a href='#section{$val->id}' data-parent='#accordion' data-toggle='collapse' class='collapsed'>\n\t\t\t\t\t\t{$val->first_name} {$val->last_name}\n\t\t\t\t\t\t</a>\n\t\t\t\t\t</h4>\n\t\t\t\t</div>\n\t\t\t<div class='panel-collapse collapse' id='section{$val->id}'>\n\t\t\t<div class='panel-body'>";
?>
<table class="table table-condensed ">
<thead>
<tr>
<th>#</th>
<th>Product</th>
<th>Date</th>
<th>Price</th>
<th>Quantity</th>
<th>Total</th>
示例7: generateCustomerData
protected function generateCustomerData()
{
$delimiter = ';';
$line = array();
$titles = array();
$new_path = new Sampledatainstall();
$f = fopen($new_path->sendPath() . 'output/customers.vsc', 'w');
foreach ($this->customers_fields as $field => $array) {
$titles[] = $array['label'];
}
fputcsv($f, $titles, $delimiter, '"');
$customers = Customer::getCustomers();
foreach ($customers as $customer) {
$c = new Customer($customer['id_customer']);
foreach ($this->customers_fields as $field => $array) {
if ($field == 'passwd') {
$line[$field] = Tools::encrypt($c->{$field});
} else {
$line[$field] = property_exists('Customer', $field) && !is_array($c->{$field}) && !Tools::isEmpty($c->{$field}) ? $c->{$field} : '';
}
}
if (!$line[$field]) {
$line[$field] = '';
}
fputcsv($f, $line, $delimiter, '"');
}
fclose($f);
}
示例8: createCustomers
/**
* Crear el nodo con los datos de los clientes
*
* #@throws SPException
*/
private function createCustomers()
{
$customers = Customer::getCustomers();
if (count($customers) === 0) {
return;
}
try {
// Crear el nodo de clientes
$nodeCustomers = $this->_xml->createElement('Customers');
foreach ($customers as $customer) {
$customerName = $this->_xml->createElement('name', $this->escapeChars($customer->customer_name));
$customerDescription = $this->_xml->createElement('description', $this->escapeChars($customer->customer_description));
// Crear el nodo de categoría
$nodeCustomer = $this->_xml->createElement('Customer');
$nodeCustomer->setAttribute('id', $customer->customer_id);
$nodeCustomer->appendChild($customerName);
$nodeCustomer->appendChild($customerDescription);
// Añadir categoría al nodo de categorías
$nodeCustomers->appendChild($nodeCustomer);
}
$this->appendNode($nodeCustomers);
} catch (\DOMException $e) {
throw new SPException(SPException::SP_WARNING, $e->getMessage(), __FUNCTION__);
}
}
示例9: insertAccountsHistory
/**
* Insertar el historial de una cuenta en sysPass.
*
* @param array $accountHistory con los datos del historial de la cuenta
* @throws SPException
* @return bool
*/
private static function insertAccountsHistory($accountHistory)
{
if (!is_array(self::$_customersByName)) {
$customers = Customer::getCustomers(null, true);
self::$_customersByName = array_flip($customers);
}
$customer = trim($accountHistory['vacCliente']);
if (array_key_exists($customer, self::$_customersByName)) {
$customerId = self::$_customersByName[$customer];
} else {
return false;
}
$query = 'INSERT INTO accHistory SET ' . 'acchistory_accountId = :id,' . 'acchistory_userGroupId = :userGroupId,' . 'acchistory_userId = :userId,' . 'acchistory_userEditId = :userEditId,' . 'acchistory_customerId = :customerId,' . 'acchistory_name = :name,' . 'acchistory_categoryId = :categoryId,' . 'acchistory_login = :login,' . 'acchistory_url = :url,' . 'acchistory_pass = :pass,' . 'acchistory_IV = :iv,' . 'acchistory_notes = :notes,' . 'acchistory_countView = :countView,' . 'acchistory_countDecrypt = :countDecrypt,' . 'acchistory_dateAdd = :dateAdd,' . 'acchistory_dateEdit = :dateEdit,' . 'acchistory_isModify = :isModify,' . 'acchistory_isDeleted = :isDeleted';
$data['id'] = $accountHistory['intAccountId'];
$data['userGroupId'] = $accountHistory['intUGroupFId'];
$data['userId'] = $accountHistory['intUserFId'];
$data['userEditId'] = $accountHistory['intUEditFId'];
$data['customerId'] = $customerId;
$data['name'] = $accountHistory['vacName'];
$data['categoryId'] = $accountHistory['intCategoryFid'];
$data['login'] = $accountHistory['vacLogin'];
$data['url'] = $accountHistory['vacUrl'];
$data['pass'] = $accountHistory['vacPassword'];
$data['iv'] = $accountHistory['vacInitialValue'];
$data['notes'] = $accountHistory['txtNotice'];
$data['countView'] = $accountHistory['intCountView'];
$data['countDecrypt'] = $accountHistory['intCountDecrypt'];
$data['dateAdd'] = $accountHistory['datAdded'];
$data['dateEdit'] = $accountHistory['datChanged'];
$data['isModify'] = $accountHistory['blnModificada'];
$data['isDeleted'] = $accountHistory['blnEliminada'];
if (DB::getQuery($query, __FUNCTION__, $data) === false) {
throw new SPException(SPException::SP_CRITICAL, _('Error al crear historico de cuentas'), DB::$txtError);
}
return true;
}
示例10: hookAdminStatsModules
public function hookAdminStatsModules($params)
{
$this->html = '<div class="blocStats"><h2 class="icon-' . $this->name . '"><span></span>' . $this->displayName . '</h2>';
if (count(Customer::getCustomers())) {
if (Tools::getValue('export')) {
if (Tools::getValue('exportType') == 'gender') {
$this->csvExport(array('type' => 'pie', 'option' => 'gender'));
} else {
if (Tools::getValue('exportType') == 'age') {
$this->csvExport(array('type' => 'pie', 'option' => 'age'));
} else {
if (Tools::getValue('exportType') == 'country') {
$this->csvExport(array('type' => 'pie', 'option' => 'country'));
} else {
if (Tools::getValue('exportType') == 'currency') {
$this->csvExport(array('type' => 'pie', 'option' => 'currency'));
} else {
if (Tools::getValue('exportType') == 'language') {
$this->csvExport(array('type' => 'pie', 'option' => 'language'));
}
}
}
}
}
}
$this->html .= '
<p><img src="../img/admin/down.gif" />' . $this->l('Gender distribution allows you to determine the percentage of men and women shoppers in your store. ') . '</p>
<div>' . $this->engine(array('type' => 'pie', 'option' => 'gender')) . '</div><br />
<p><a class="button export-csv" href="' . Tools::safeOutput($_SERVER['REQUEST_URI']) . '&export=1&exportType=gender"><span>' . $this->l('CSV Export') . '</span></a></p>
<br class="clear" /><br />
<p><img src="../img/admin/down.gif" />' . $this->l('Age ranges allow you to better understand target demographics. ') . '</p>
<div>' . $this->engine(array('type' => 'pie', 'option' => 'age')) . '</div><br />
<p><a class="button export-csv" href="' . Tools::safeOutput($_SERVER['REQUEST_URI']) . '&export=1&exportType=age"><span>' . $this->l('CSV Export') . '</span></a></p><br /><br />
<p><img src="../img/admin/down.gif" />' . $this->l('Country distribution allows you to analyze which part of the world your customers are shopping from.') . '</p>
<div>' . $this->engine(array('type' => 'pie', 'option' => 'country')) . '</div><br />
<p><a class="button export-csv" href="' . Tools::safeOutput($_SERVER['REQUEST_URI']) . '&export=1&exportType=country"><span>' . $this->l('CSV Export') . '</span></a></p><br /><br />
<p><img src="../img/admin/down.gif" />' . $this->l('Currency range allows you to determine which currency your customers are using.') . '</p>
<div>' . $this->engine(array('type' => 'pie', 'option' => 'currency')) . '</div><br />
<p><a class="button export-csv" href="' . Tools::safeOutput($_SERVER['REQUEST_URI']) . '&export=1&exportType=currency"><span>' . $this->l('CSV Export') . '</span></a></p><br /><br />
<p><img src="../img/admin/down.gif" />' . $this->l('Language distribution allows you to analyze the browsing language used by your customers. ') . '</p>
<div>' . $this->engine(array('type' => 'pie', 'option' => 'language')) . '</div><br />
<p><a class="button export-csv" href="' . Tools::safeOutput($_SERVER['REQUEST_URI']) . '&export=1&exportType=language"><span>' . $this->l('CSV Export') . '</span></a></p>
</center>';
} else {
$this->html .= '<p>' . $this->l('No customers have registered yet.') . '</p>';
}
$this->html .= '
</div><br />
<div class="blocStats"><h2 class="icon-guide"><span></span>' . $this->l('Guide') . '</h2>
<h2>' . $this->l('Target your audience.') . '</h2>
<p>
' . $this->l('In order for each message to have an impact, you need to know who it is being addressed to. ') . '
' . $this->l('Defining your target audience is essential when choosing the right tools to win them over.') . '
' . $this->l('It is best to limit action to a group -- or groups -- of clients.') . '
' . $this->l('Storing registered customer information allows you to accurately define customer profile so you can adapt your special deals and promotions.') . '
</p><br />
<p>
' . $this->l('Increase your sales by') . '
<ul>
<li class="bullet">' . $this->l('launching targeted advertisement campaigns.') . '</li>
<li class="bullet">' . $this->l('Contact a group of clients by email or newsletter.') . '</li>
</ul>
</p><br />
</div>';
return $this->html;
}
示例11: postProcess
public function postProcess()
{
global $currentIndex, $cookie;
if (Tools::getValue('send') == 1)
{
if( !isset($_SESSION['newsletter']) OR empty($_SESSION['newsletter']['finalList']) ){
$sCustomers = Tools::getValue('sCustomers');
$sNewsletter = Tools::getValue('$sNewsletter');
$sTeste = Tools::getValue('sTeste');
$sendList = Array();
/** BEGIN Mailer test **/
if( $sTeste AND Validate::isEmail(Tools::getValue('sMailTest')) )
{
$array[] =
array( 'email' => Tools::getValue('sMailTest'), 'firstname' => $this->l('Mailer'), 'lastname' => $this->l('TestMan') );
$sendList = array_merge($sendList, $array );
}
/** END Mailer test **/
/** BEGIN Customers **/
if ($sCustomers == '1' )
{
$customers = Customer::getCustomers();
$sendList = array_merge($sendList, $customers);
}
else if ( $sCustomers == '2' )
{
$customers = Customer::getNewsletteremails();
$sendList = array_merge($sendList, $customers);
}
else if( $sCustomers == '3' )
{
$customers = $this->getBrithdayCustomers( Tools::getValue('dateBrithday') );
$sendList = array_merge($sendList, $customers);
}
/** END Customers **/
/** BEGIN Block Subscribers **/
if ($sNewsletter)
{
$blockSubscribers = $this->getBlockSubscribers();
$sendList = array_merge($sendList, $blockSubscribers);
}
/** END Block Subscribers **/
$finalList = Array();
foreach ($sendList as $item){
if (!recursive_in_array($item['email'],$finalList))
{$finalList[] = $item;}
}
$Result['total'] = 0;
$Result['failed'] = 0;
$Result['sucess'] = 0;
$ArrayFailed = array();
$key = 0;
$output = '';
$check_division = 60 / ( intval($_POST['wait_time']) > 0 ? intval($_POST['wait_time']) : 2 ) ;
$wait = intval( $check_division ) > 0 ? $check_division : 30;
$_SESSION['newsletter']['check'] = TRUE;
$_SESSION['newsletter']['finalList'] = $finalList;
$_SESSION['newsletter']['total'] = $Result['total'];
$_SESSION['newsletter']['failed'] = $Result['failed'];
$_SESSION['newsletter']['sucess'] = $Result['sucess'];
$_SESSION['newsletter']['ArrayFailed'] = $ArrayFailed;
$_SESSION['newsletter']['POST'] = $_POST;
$_SESSION['newsletter']['GET'] = $_GET;
$_SESSION['newsletter']['key'] = $key;
$_SESSION['newsletter']['output'] = $output;
}else{
$finalList = $_SESSION['newsletter']['finalList'];
$Result['total'] = $_SESSION['newsletter']['total'];
$Result['failed'] = $_SESSION['newsletter']['failed'];
$Result['sucess'] = $_SESSION['newsletter']['sucess'];
$ArrayFailed = $_SESSION['newsletter']['ArrayFailed'];
$_POST = $_SESSION['newsletter']['POST'];
$_GET = $_SESSION['newsletter']['GET'];
$key = $_SESSION['newsletter']['key']+1;
$output = $_SESSION['newsletter']['output'];
$check_division = 60 / ( intval($_POST['wait_time']) > 0 ? intval($_POST['wait_time']) : 2 ) ;
$wait = intval( $check_division ) > 0 ? $check_division : 30;
}
/** GLOBAL **/
$email_from = Configuration::get('PS_SHOP_EMAIL');
$name = Configuration::get('PS_SHOP_NAME');
/** GLOBAL **/
if( empty($finalList) ){
echo '<div class="alert">'.$this->l('No recipients, with selected criteria!').'</div>';
$_POST['send'] = 0;
return $this->display();
}
$value = $finalList[$key];
//.........这里部分代码省略.........
示例12: importCustomers
/**
* Import customers into the selected Mailchimp list
*/
public function importCustomers()
{
// Get List id
$list_id = Tools::getValue('list');
if (!Tools::isSubmit('list') || !$list_id) {
$this->message = array('text' => $this->l('List is required! Please select one.'), 'type' => 'error');
return;
}
// Get customers type
$all_customers = Tools::getValue('all-user') ? true : false;
// Get mailchimp fields
$fields = Tools::getValue('fields');
// Get Customers list
$customers = Customer::getCustomers();
// Creating import array
$list = array();
foreach ($customers as $customer_key => $customer) {
// Get customer data
$customer_details = new Customer($customer['id_customer']);
// Populate customer array
if ($all_customers) {
$list[$customer_key]['EMAIL'] = $customer_details->email;
if (isset($fields[$list_id])) {
foreach ($fields[$list_id] as $key => $field) {
// mailchimp tag = customer field
$list[$customer_key][$key] = $customer_details->{$field};
}
}
} else {
if (!$all_customers && $customer_details->newsletter) {
$list[$customer_key]['EMAIL'] = $customer_details->email;
if (isset($fields[$list_id])) {
foreach ($fields[$list_id] as $key => $field) {
// mailchimp tag = customer field
$list[$customer_key][$key] = $customer_details->{$field};
}
}
}
}
}
// listBatchSubscribe configuration
$optin = Tools::getValue('optin') ? true : false;
//send optin emails
$up_exist = Tools::getValue('update_users') ? true : false;
//update currently subscribed users
$replace_int = true;
// Import customers
$mailchimp = new MCAPI($this->api_key, $this->ssl);
$import = $mailchimp->listBatchSubscribe($list_id, $list, $optin, $up_exist, $replace_int);
// Process response
if ($mailchimp->errorCode) {
$this->message = array('text' => $this->l('Mailchimp error code:') . ' ' . $mailchimp->errorCode . '<br />' . $this->l('Milchimp message:') . ' ' . $mailchimp->errorMessage, 'type' => 'error');
return;
} else {
$this->message['text'] = $this->l('Successfull imported:') . ' <b>' . $import['add_count'] . '</b><br />';
$this->message['text'] .= $this->l('Successfull updated:') . ' <b>' . $import['update_count'] . '</b><br />';
if ($import['error_count'] > 0) {
$this->message['text'] .= $this->l('Error occured:') . ' <b>' . $import['error_count'] . '</b><br />';
foreach ($import['errors'] as $error) {
$this->message['text'] .= '<p style="margin-left: 15px;">';
$this->message['text'] .= $error['email'] . ' - ' . $error['code'] . ' - ' . $error['message'];
$this->message['text'] .= '</p>';
}
$this->message['type'] = 'warn';
}
}
}
示例13: _csv_export_customers
private static function _csv_export_customers()
{
$separator = ';';
$customers = Customer::getCustomers();
$FH = fopen('php://output', 'w');
$csvVals = array('id_customer', 'email', 'firstname', 'lastname');
fputcsv($FH, $csvVals, $separator);
foreach ($customers as $customer) {
$csvVals = array($customer['id_customer'], $customer['email'], $customer['firstname'], $customer['lastname']);
fputcsv($FH, $csvVals, $separator);
}
}
示例14: echo
/customers/DB.php?FLAG=DELSELECT">
<table class="table table-striped table-bordered table-hover" id="sample_1">
<thead>
<tr>
<th class="table-checkbox"><input type="checkbox" class="group-checkable" data-set="#sample_1 .checkboxes"/></th>
<th>Name</th>
<th>Email</th>
<th>Contact No</th>
<th>Status</th>
<th>Date Created</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
$results = Customer::getCustomers();
if (count($results) > 0) {
for ($index = 0; $index < count($results); $index++) {
$rows = $results[$index];
if ($rows['status'] == '0') {
$status = "Active";
} else {
if ($rows['status'] == '1') {
$status = "Inactive";
}
}
?>
<tr class="<?php
echo ($index + 1) % 2 == 0 ? 'even' : 'odd';
?>
gradeX">
示例15: foreach
<col width="5px" />
<col width="5px" />
</colgroup>
<thead>
<tr>
<th>#</th>
<th>Name</th>
<th>Address</th>
<th>Gender</th>
<th>Contacts</th>
<th>Credit Limit</th>
<th>Date Created</th>
<th colspan='2' class='center'>Action</th>
</tr>
</thead>
<tbody>
<?php
$data = $Customers->getCustomers();
if (count($data)) {
foreach ($data as $k => $v) {
$k++;
$credit = $v->credit_limit == "0.00" ? 'Unlimited' : $v->credit_limit;
echo "<tr>\n\t\t\t\t\t\t<td>{$k}</td>\n\t\t\t\t\t\t<td><a href='" . BASE_URL . "/profile/{$v->id}'>{$v->first_name} {$v->last_name}</a></td>\n\t\t\t\t\t\t<td>{$v->address}</td>\n\t\t\t\t\t\t<td>{$v->gender}</td>\n\t\t\t\t\t\t<td>{$v->contacts}</td>\n\t\t\t\t\t\t<td>{$credit}</td>\n\t\t\t\t\t\t<td>{$v->date}</td>\n\t\t\t\t\t\t<td><a href='" . BASE_URL . "/deletecustomer/{$v->id}' data-id='{$v->id}' class='btn cust_delete'><i class='glyphicon glyphicon-trash'></i></a></td>\n\t\t\t\t\t\t<td><a href='" . BASE_URL . "/editcustomer/{$v->id}' data-id='{$v->id}' data-id='{$v->id}' class='btn'><i class='glyphicon glyphicon-pencil'></i></a></td>\n\t\t\t\t\t</tr>";
}
} else {
echo "<tr><td colspan='9' class='center'>No record yet<td></tr>";
}
?>
</tbody>
</table>
</div>