本文整理汇总了PHP中Customers::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Customers::get方法的具体用法?PHP Customers::get怎么用?PHP Customers::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Customers
的用法示例。
在下文中一共展示了Customers::get方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getNameArray
/**
* Returns an array of Customer names, ordered by last names, ascending
*
* If $inactive is true, inactive Customers are included.
* See {@see getNameById()} for details on the $format parameter.
* @param boolean $inactive Include inactive Customers if true.
* Defaults to false
* @param string $format The optional format string
* @return array The array of Customer names
*/
static function getNameArray($inactive = false, $format = null)
{
// Consider members of the customer groups only
$arrFilter = array('group' => array(\Cx\Core\Setting\Controller\Setting::getValue('usergroup_id_reseller', 'Shop'), \Cx\Core\Setting\Controller\Setting::getValue('usergroup_id_customer', 'Shop')));
if (!$inactive) {
$arrFilter['active'] = true;
}
$objCustomer = Customers::get($arrFilter, null, array('lastname' => 'ASC', 'firstname' => 'ASC'));
$arrNames = array();
while ($objCustomer && !$objCustomer->EOF) {
$name = $objCustomer->getName($format);
$arrNames[$objCustomer->id()] = $name;
$objCustomer->next();
}
return $arrNames;
}
示例2: view_customers
/**
* Show Customers
*/
function view_customers()
{
global $_ARRAYLANG;
$template = isset($_GET['tpl']) ? $_GET['tpl'] : '';
if ($template == 'discounts') {
return $this->view_customer_discounts();
}
if ($template == 'groups') {
return $this->view_customer_groups();
}
$this->toggleCustomer();
$i = 0;
self::$objTemplate->loadTemplateFile("module_shop_customers.html");
$customer_active = null;
$customer_type = null;
$searchterm = null;
$listletter = null;
$group_id_customer = \Cx\Core\Setting\Controller\Setting::getValue('usergroup_id_customer', 'Shop');
$group_id_reseller = \Cx\Core\Setting\Controller\Setting::getValue('usergroup_id_reseller', 'Shop');
$uri = \Html::getRelativeUri();
// TODO: Strip what URI parameters?
\Html::stripUriParam($uri, 'active');
\Html::stripUriParam($uri, 'customer_type');
\Html::stripUriParam($uri, 'searchterm');
\Html::stripUriParam($uri, 'listletter');
$uri_sorting = $uri;
$arrFilter = array();
if (isset($_REQUEST['active']) && $_REQUEST['active'] != '') {
$customer_active = intval($_REQUEST['active']);
$arrFilter['active'] = $customer_active;
\Html::replaceUriParameter($uri_sorting, "active={$customer_active}");
}
if (isset($_REQUEST['customer_type']) && $_REQUEST['customer_type'] != '') {
$customer_type = intval($_REQUEST['customer_type']);
switch ($customer_type) {
case 0:
$arrFilter['group'] = array($group_id_customer);
break;
case 1:
$arrFilter['group'] = array($group_id_reseller);
break;
}
\Html::replaceUriParameter($uri_sorting, "customer_type={$customer_type}");
} else {
$arrFilter['group'] = array($group_id_customer, $group_id_reseller);
}
//DBG::log("Group filter: ".var_export($arrFilter, true));
if (!empty($_REQUEST['searchterm'])) {
$searchterm = trim(strip_tags(contrexx_input2raw($_REQUEST['searchterm'])));
\Html::replaceUriParameter($uri_sorting, "searchterm={$searchterm}");
} elseif (!empty($_REQUEST['listletter'])) {
$listletter = contrexx_input2raw($_REQUEST['listletter']);
\Html::replaceUriParameter($uri_sorting, "listletter={$listletter}");
}
$arrSorting = array('id' => $_ARRAYLANG['TXT_SHOP_CUSTOMER_ID'], 'company' => $_ARRAYLANG['TXT_SHOP_CUSTOMER_COMPANY'], 'firstname' => $_ARRAYLANG['TXT_SHOP_CUSTOMER_FIRSTNAME'], 'lastname' => $_ARRAYLANG['TXT_SHOP_CUSTOMER_LASTNAME'], 'address' => $_ARRAYLANG['TXT_SHOP_CUSTOMER_ADDRESS'], 'zip' => $_ARRAYLANG['TXT_SHOP_CUSTOMER_ZIP'], 'city' => $_ARRAYLANG['TXT_SHOP_CUSTOMER_CITY'], 'phone' => $_ARRAYLANG['TXT_SHOP_CUSTOMER_PHONE'], 'email' => $_ARRAYLANG['TXT_SHOP_CUSTOMER_EMAIL'], 'active' => $_ARRAYLANG['TXT_SHOP_CUSTOMER_ACTIVE']);
$objSorting = new \Sorting($uri_sorting, $arrSorting, false, 'order_shop_customer');
self::$objTemplate->setVariable(array('SHOP_HEADING_CUSTOMER_ID' => $objSorting->getHeaderForField('id'), 'SHOP_HEADING_CUSTOMER_COMPANY' => $objSorting->getHeaderForField('company'), 'SHOP_HEADING_CUSTOMER_FIRSTNAME' => $objSorting->getHeaderForField('firstname'), 'SHOP_HEADING_CUSTOMER_LASTNAME' => $objSorting->getHeaderForField('lastname'), 'SHOP_HEADING_CUSTOMER_ADDRESS' => $objSorting->getHeaderForField('address'), 'SHOP_HEADING_CUSTOMER_ZIP' => $objSorting->getHeaderForField('zip'), 'SHOP_HEADING_CUSTOMER_CITY' => $objSorting->getHeaderForField('city'), 'SHOP_HEADING_CUSTOMER_PHONE' => $objSorting->getHeaderForField('phone'), 'SHOP_HEADING_CUSTOMER_EMAIL' => $objSorting->getHeaderForField('email'), 'SHOP_HEADING_CUSTOMER_ACTIVE' => $objSorting->getHeaderForField('active')));
$limit = \Cx\Core\Setting\Controller\Setting::getValue('numof_customers_per_page_backend', 'Shop');
$objCustomer = Customers::get($arrFilter, $listletter ? $listletter . '%' : $searchterm, array($objSorting->getOrderField() => $objSorting->getOrderDirection()), $limit, \Paging::getPosition());
$count = $objCustomer ? $objCustomer->getFilteredSearchUserCount() : 0;
while ($objCustomer && !$objCustomer->EOF) {
//DBG::log("Customer: ".var_export($objCustomer, true));
self::$objTemplate->setVariable(array('SHOP_ROWCLASS' => 'row' . (++$i % 2 + 1), 'SHOP_CUSTOMERID' => $objCustomer->getId(), 'SHOP_COMPANY' => $objCustomer->company(), 'SHOP_FIRSTNAME' => $objCustomer->firstname(), 'SHOP_LASTNAME' => $objCustomer->lastname(), 'SHOP_ADDRESS' => $objCustomer->address(), 'SHOP_ZIP' => $objCustomer->zip(), 'SHOP_CITY' => $objCustomer->city(), 'SHOP_PHONE' => $objCustomer->phone(), 'SHOP_EMAIL' => $objCustomer->email(), 'SHOP_CUSTOMER_STATUS_IMAGE' => $objCustomer->active() ? 'led_green.gif' : 'led_red.gif', 'SHOP_CUSTOMER_ACTIVE' => $objCustomer->active() ? $_ARRAYLANG['TXT_ACTIVE'] : $_ARRAYLANG['TXT_INACTIVE']));
self::$objTemplate->parse('shop_customer');
$objCustomer->next();
}
// if ($count == 0) self::$objTemplate->hideBlock('shop_customers');
$paging = \Paging::get($uri_sorting, $_ARRAYLANG['TXT_CUSTOMERS_ENTRIES'], $count, $limit, true);
self::$objTemplate->setVariable(array('SHOP_CUSTOMER_PAGING' => $paging, 'SHOP_CUSTOMER_TERM' => htmlentities($searchterm), 'SHOP_LISTLETTER_LINKS' => Orders::getListletterLinks($listletter), 'SHOP_CUSTOMER_TYPE_MENUOPTIONS' => Customers::getTypeMenuoptions($customer_type, true), 'SHOP_CUSTOMER_STATUS_MENUOPTIONS' => Customers::getActiveMenuoptions($customer_active, true)));
return true;
}