本文整理汇总了PHP中Shop::addSqlRestriction方法的典型用法代码示例。如果您正苦于以下问题:PHP Shop::addSqlRestriction方法的具体用法?PHP Shop::addSqlRestriction怎么用?PHP Shop::addSqlRestriction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Shop
的用法示例。
在下文中一共展示了Shop::addSqlRestriction方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getOrigins
private function getOrigins($dateBetween)
{
$directLink = $this->l('Direct link');
$sql = 'SELECT http_referer
FROM ' . _DB_PREFIX_ . 'connections
WHERE 1
' . Shop::addSqlRestriction() . '
AND date_add BETWEEN ' . $dateBetween;
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->query($sql);
$websites = array($directLink => 0);
while ($row = Db::getInstance(_PS_USE_SQL_SLAVE_)->nextRow($result)) {
if (!isset($row['http_referer']) || empty($row['http_referer'])) {
++$websites[$directLink];
} else {
$website = preg_replace('/^www./', '', parse_url($row['http_referer'], PHP_URL_HOST));
if (!isset($websites[$website])) {
$websites[$website] = 1;
} else {
++$websites[$website];
}
}
}
arsort($websites);
return $websites;
}
示例2: __construct
public function __construct()
{
$this->bootstrap = true;
$this->table = 'group';
$this->className = 'Group';
$this->list_id = 'group';
$this->lang = true;
$this->addRowAction('edit');
$this->addRowAction('view');
$this->addRowAction('delete');
$this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?'), 'icon' => 'icon-trash'));
$groups_to_keep = array(Configuration::get('PS_UNIDENTIFIED_GROUP'), Configuration::get('PS_GUEST_GROUP'), Configuration::get('PS_CUSTOMER_GROUP'));
$this->fields_list = array('id_group' => array('title' => $this->l('ID'), 'align' => 'center', 'class' => 'fixed-width-xs'), 'name' => array('title' => $this->l('Group name'), 'filter_key' => 'b!name'), 'reduction' => array('title' => $this->l('Discount (%)'), 'align' => 'right', 'type' => 'percent'), 'nb' => array('title' => $this->l('Members'), 'align' => 'center', 'havingFilter' => true), 'show_prices' => array('title' => $this->l('Show prices'), 'align' => 'center', 'type' => 'bool', 'callback' => 'printShowPricesIcon', 'orderby' => false), 'date_add' => array('title' => $this->l('Creation date'), 'type' => 'date', 'align' => 'right'));
$this->addRowActionSkipList('delete', $groups_to_keep);
parent::__construct();
$this->_select .= '(SELECT COUNT(jcg.`id_customer`)
FROM `' . _DB_PREFIX_ . 'customer_group` jcg
LEFT JOIN `' . _DB_PREFIX_ . 'customer` jc ON (jc.`id_customer` = jcg.`id_customer`)
WHERE jc.`deleted` != 1
' . Shop::addSqlRestriction(Shop::SHARE_CUSTOMER) . '
AND jcg.`id_group` = a.`id_group`) AS nb';
$groups = Group::getGroups(Context::getContext()->language->id, true);
if (Shop::isFeatureActive()) {
$this->fields_options = array('general' => array('title' => $this->l('Default groups options'), 'fields' => array('PS_UNIDENTIFIED_GROUP' => array('title' => $this->l('Visitors group'), 'desc' => $this->l('The group defined for your un-identified visitors.'), 'cast' => 'intval', 'type' => 'select', 'list' => $groups, 'identifier' => 'id_group'), 'PS_GUEST_GROUP' => array('title' => $this->l('Guests group'), 'desc' => $this->l('The group defined for your identified guest customers (used in guest checkout).'), 'cast' => 'intval', 'type' => 'select', 'list' => $groups, 'identifier' => 'id_group'), 'PS_CUSTOMER_GROUP' => array('title' => $this->l('Customers group'), 'desc' => $this->l('The group defined for your identified registered customers.'), 'cast' => 'intval', 'type' => 'select', 'list' => $groups, 'identifier' => 'id_group')), 'submit' => array('title' => $this->l('Save'))));
}
}
示例3: __construct
public function __construct()
{
$this->bootstrap = true;
$this->required_database = true;
$this->required_fields = array('company', 'address2', 'postcode', 'other', 'phone', 'phone_mobile', 'vat_number', 'dni');
$this->table = 'address';
$this->className = 'Address';
$this->lang = false;
$this->addressType = 'customer';
$this->explicitSelect = true;
$this->context = Context::getContext();
$this->addRowAction('edit');
$this->addRowAction('delete');
$this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?'), 'icon' => 'icon-trash'));
$this->allow_export = true;
if (!Tools::getValue('realedit')) {
$this->deleted = true;
}
$countries = Country::getCountries($this->context->language->id);
foreach ($countries as $country) {
$this->countries_array[$country['id_country']] = $country['name'];
}
$this->fields_list = array('id_address' => array('title' => $this->l('ID'), 'align' => 'center', 'class' => 'fixed-width-xs'), 'firstname' => array('title' => $this->l('First Name'), 'filter_key' => 'a!firstname'), 'lastname' => array('title' => $this->l('Last Name'), 'filter_key' => 'a!lastname'), 'address1' => array('title' => $this->l('Address')), 'postcode' => array('title' => $this->l('Zip/Postal Code'), 'align' => 'right'), 'city' => array('title' => $this->l('City')), 'country' => array('title' => $this->l('Country'), 'type' => 'select', 'list' => $this->countries_array, 'filter_key' => 'cl!id_country'));
parent::__construct();
$this->_select = 'cl.`name` as country';
$this->_join = '
LEFT JOIN `' . _DB_PREFIX_ . 'country_lang` cl ON (cl.`id_country` = a.`id_country` AND cl.`id_lang` = ' . (int) $this->context->language->id . ')
LEFT JOIN `' . _DB_PREFIX_ . 'customer` c ON a.id_customer = c.id_customer
';
$this->_where = 'AND a.id_customer != 0 ' . Shop::addSqlRestriction(Shop::SHARE_CUSTOMER, 'c');
}
示例4: getData
public function getData()
{
$this->_totalCount = $this->getTotalCount();
$this->query = 'SELECT m.name, SUM(od.product_quantity) as quantity, ROUND(SUM(od.product_quantity * od.product_price) / c.conversion_rate, 2) as sales
FROM ' . _DB_PREFIX_ . 'order_detail od
LEFT JOIN ' . _DB_PREFIX_ . 'product p ON (p.id_product = od.product_id)
LEFT JOIN ' . _DB_PREFIX_ . 'orders o ON (o.id_order = od.id_order)
LEFT JOIN ' . _DB_PREFIX_ . 'currency c ON (c.id_currency = o.id_currency)
LEFT JOIN ' . _DB_PREFIX_ . 'manufacturer m ON (m.id_manufacturer = p.id_manufacturer)
WHERE o.invoice_date BETWEEN ' . $this->getDate() . '
' . Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o') . '
AND o.valid = 1
AND m.id_manufacturer IS NOT NULL
GROUP BY p.id_manufacturer';
if (Validate::IsName($this->_sort)) {
$this->query .= ' ORDER BY `' . bqSQL($this->_sort) . '`';
if (isset($this->_direction) && Validate::isSortDirection($this->_direction)) {
$this->query .= ' ' . $this->_direction;
}
}
if (($this->_start === 0 || Validate::IsUnsignedInt($this->_start)) && Validate::IsUnsignedInt($this->_limit)) {
$this->query .= ' LIMIT ' . (int) $this->_start . ', ' . (int) $this->_limit;
}
$this->_values = Db::getInstance()->executeS($this->query);
}
示例5: getData
public function getData()
{
$currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
$this->query = 'SELECT SQL_CALC_FOUND_ROWS cr.code, ocr.name, COUNT(ocr.id_cart_rule) as total, ROUND(SUM(o.total_paid_real) / o.conversion_rate,2) as ca
FROM ' . _DB_PREFIX_ . 'order_cart_rule ocr
LEFT JOIN ' . _DB_PREFIX_ . 'orders o ON o.id_order = ocr.id_order
LEFT JOIN ' . _DB_PREFIX_ . 'cart_rule cr ON cr.id_cart_rule = ocr.id_cart_rule
WHERE o.valid = 1
' . Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o') . '
AND o.invoice_date BETWEEN ' . $this->getDate() . '
GROUP BY ocr.id_cart_rule';
if (Validate::IsName($this->_sort)) {
$this->query .= ' ORDER BY `' . bqSQL($this->_sort) . '`';
if (isset($this->_direction) && (Tools::strtoupper($this->_direction) == 'ASC' || Tools::strtoupper($this->_direction) == 'DESC')) {
$this->query .= ' ' . pSQL($this->_direction);
}
}
if (($this->_start === 0 || Validate::IsUnsignedInt($this->_start)) && Validate::IsUnsignedInt($this->_limit)) {
$this->query .= ' LIMIT ' . (int) $this->_start . ', ' . (int) $this->_limit;
}
$values = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($this->query);
foreach ($values as &$value) {
$value['ca'] = Tools::displayPrice($value['ca'], $currency);
}
$this->_values = $values;
$this->_totalCount = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('SELECT FOUND_ROWS()');
}
示例6: ModuleHookExec
private function ModuleHookExec($moduleName, $hook_name)
{
$output = '';
$moduleInstance = Module::getInstanceByName($moduleName);
if (Validate::isLoadedObject($moduleInstance) && $moduleInstance->id) {
$altern = 0;
$id_hook = Hook::getIdByName($hook_name);
$retro_hook_name = Hook::getRetroHookName($hook_name);
$disable_non_native_modules = (bool) Configuration::get('PS_DISABLE_NON_NATIVE_MODULE');
if ($disable_non_native_modules && Hook::$native_module && count(Hook::$native_module) && !in_array($moduleInstance->name, self::$native_module)) {
return '';
}
//check disable module
$device = (int) $this->context->getDevice();
if (Db::getInstance()->getValue('
SELECT COUNT(`id_module`) FROM ' . _DB_PREFIX_ . 'module_shop
WHERE enable_device & ' . (int) $device . ' AND id_module=' . (int) $moduleInstance->id . Shop::addSqlRestriction()) == 0) {
return '';
}
// Check permissions
$exceptions = $moduleInstance->getExceptions($id_hook);
$controller = Dispatcher::getInstance()->getController();
$controller_obj = Context::getContext()->controller;
//check if current controller is a module controller
if (isset($controller_obj->module) && Validate::isLoadedObject($controller_obj->module)) {
$controller = 'module-' . $controller_obj->module->name . '-' . $controller;
}
if (in_array($controller, $exceptions)) {
return '';
}
//retro compat of controller names
$matching_name = array('authentication' => 'auth', 'productscomparison' => 'compare');
if (isset($matching_name[$controller]) && in_array($matching_name[$controller], $exceptions)) {
return '';
}
if (Validate::isLoadedObject($this->context->employee) && !$moduleInstance->getPermission('view', $this->context->employee)) {
return '';
}
if (!isset($hook_args['cookie']) or !$hook_args['cookie']) {
$hook_args['cookie'] = $this->context->cookie;
}
if (!isset($hook_args['cart']) or !$hook_args['cart']) {
$hook_args['cart'] = $this->context->cart;
}
$hook_callable = is_callable(array($moduleInstance, 'hook' . $hook_name));
$hook_retro_callable = is_callable(array($moduleInstance, 'hook' . $retro_hook_name));
if (($hook_callable || $hook_retro_callable) && Module::preCall($moduleInstance->name)) {
$hook_args['altern'] = ++$altern;
// Call hook method
if ($hook_callable) {
$display = $moduleInstance->{'hook' . $hook_name}($hook_args);
} elseif ($hook_retro_callable) {
$display = $moduleInstance->{'hook' . $retro_hook_name}($hook_args);
}
$output .= $display;
}
}
return $output;
}
示例7: getCustomers
public static function getCustomers()
{
$sql = 'SELECT `id_customer`, `email`, `firstname`, `lastname`, `fax`, `details_website`
FROM `' . _DB_PREFIX_ . 'customer`
WHERE 1 ' . Shop::addSqlRestriction(Shop::SHARE_CUSTOMER) . '
ORDER BY `id_customer` ASC';
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
}
示例8: renderList
public function renderList()
{
$this->_select = 'cl.`name` as country';
$this->_join = '
LEFT JOIN `' . _DB_PREFIX_ . 'country_lang` cl ON (cl.`id_country` = a.`id_country` AND cl.`id_lang` = ' . (int) $this->context->language->id . ')
LEFT JOIN `' . _DB_PREFIX_ . 'customer` c ON a.id_customer = c.id_customer
';
$this->_where = 'AND a.id_customer != 0 ' . Shop::addSqlRestriction(Shop::SHARE_CUSTOMER, 'c');
return parent::renderList();
}
示例9: __construct
public function __construct()
{
$this->bootstrap = true;
$this->required_database = true;
$this->required_fields = array('newsletter', 'optin');
$this->table = 'customer';
$this->className = 'Customer';
$this->lang = false;
$this->deleted = true;
$this->explicitSelect = true;
$this->allow_export = true;
$this->addRowAction('edit');
$this->addRowAction('view');
$this->addRowAction('delete');
$this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?'), 'icon' => 'icon-trash'));
$this->context = Context::getContext();
$this->default_form_language = $this->context->language->id;
$titles_array = array();
$genders = Gender::getGenders($this->context->language->id);
foreach ($genders as $gender) {
/** @var Gender $gender */
$titles_array[$gender->id_gender] = $gender->name;
}
$this->_select = '
a.date_add, gl.name as title, (
SELECT SUM(total_paid_real / conversion_rate)
FROM ' . _DB_PREFIX_ . 'orders o
WHERE o.id_customer = a.id_customer
' . Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o') . '
AND o.valid = 1
) as total_spent, (
SELECT c.date_add FROM ' . _DB_PREFIX_ . 'guest g
LEFT JOIN ' . _DB_PREFIX_ . 'connections c ON c.id_guest = g.id_guest
WHERE g.id_customer = a.id_customer
ORDER BY c.date_add DESC
LIMIT 1
) as connect';
$this->_join = 'LEFT JOIN ' . _DB_PREFIX_ . 'gender_lang gl ON (a.id_gender = gl.id_gender AND gl.id_lang = ' . (int) $this->context->language->id . ')';
$this->_use_found_rows = false;
$this->fields_list = array('id_customer' => array('title' => $this->l('ID'), 'align' => 'text-center', 'class' => 'fixed-width-xs'), 'title' => array('title' => $this->l('Social title'), 'filter_key' => 'a!id_gender', 'type' => 'select', 'list' => $titles_array, 'filter_type' => 'int', 'order_key' => 'gl!name'), 'firstname' => array('title' => $this->l('First name')), 'lastname' => array('title' => $this->l('Last name')), 'email' => array('title' => $this->l('Email address')));
if (Configuration::get('PS_B2B_ENABLE')) {
$this->fields_list = array_merge($this->fields_list, array('company' => array('title' => $this->l('Company'))));
}
$this->fields_list = array_merge($this->fields_list, array('total_spent' => array('title' => $this->l('Sales'), 'type' => 'price', 'search' => false, 'havingFilter' => true, 'align' => 'text-right', 'badge_success' => true), 'active' => array('title' => $this->l('Enabled'), 'align' => 'text-center', 'active' => 'status', 'type' => 'bool', 'orderby' => false, 'filter_key' => 'a!active'), 'newsletter' => array('title' => $this->l('Newsletter'), 'align' => 'text-center', 'type' => 'bool', 'callback' => 'printNewsIcon', 'orderby' => false), 'optin' => array('title' => $this->l('Opt-in'), 'align' => 'text-center', 'type' => 'bool', 'callback' => 'printOptinIcon', 'orderby' => false), 'date_add' => array('title' => $this->l('Registration'), 'type' => 'date', 'align' => 'text-right'), 'connect' => array('title' => $this->l('Last visit'), 'type' => 'datetime', 'search' => false, 'havingFilter' => true)));
$this->shopLinkType = 'shop';
$this->shopShareDatas = Shop::SHARE_CUSTOMER;
parent::__construct();
// Check if we can add a customer
if (Shop::isFeatureActive() && (Shop::getContext() == Shop::CONTEXT_ALL || Shop::getContext() == Shop::CONTEXT_GROUP)) {
$this->can_add_customer = false;
}
self::$meaning_status = array('open' => $this->l('Open'), 'closed' => $this->l('Closed'), 'pending1' => $this->l('Pending 1'), 'pending2' => $this->l('Pending 2'));
}
示例10: __construct
public function __construct()
{
$this->table = 'order_slip';
$this->className = 'OrderSlip';
$this->_select = ' o.`id_shop`';
$this->_join .= ' LEFT JOIN ' . _DB_PREFIX_ . 'orders o ON (o.`id_order` = a.`id_order`)';
$this->_group = ' GROUP BY o.`id_order`';
$this->fields_list = array('id_order_slip' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25), 'id_order' => array('title' => $this->l('ID Order'), 'align' => 'left'), 'date_add' => array('title' => $this->l('Date issued'), 'width' => 150, 'type' => 'date', 'align' => 'right'), 'id_pdf' => array('title' => $this->l('PDF'), 'width' => 35, 'align' => 'center', 'callback' => 'printPDFIcons', 'orderby' => false, 'search' => false, 'remove_onclick' => true));
$this->_select = 'a.id_order_slip AS id_pdf';
$this->optionTitle = $this->l('Slip');
$this->fields_options = array('general' => array('title' => $this->l('Credit slip options'), 'fields' => array('PS_CREDIT_SLIP_PREFIX' => array('title' => $this->l('Credit slip prefix:'), 'desc' => $this->l('Prefix used for credit slips'), 'size' => 6, 'type' => 'textLang')), 'submit' => array()));
parent::__construct();
$this->_where = Shop::addSqlRestriction(false, 'o');
}
示例11: getData
public function getData()
{
$currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT'));
$date_between = $this->getDate();
$array_date_between = explode(' AND ', $date_between);
$this->query = 'SELECT SQL_CALC_FOUND_ROWS p.reference, p.id_product, pl.name,
ROUND(AVG(od.product_price / o.conversion_rate), 2) as avgPriceSold,
IFNULL(stock.quantity, 0) as quantity,
IFNULL(SUM(od.product_quantity), 0) AS totalQuantitySold,
ROUND(IFNULL(IFNULL(SUM(od.product_quantity), 0) / (1 + LEAST(TO_DAYS(' . $array_date_between[1] . '), TO_DAYS(NOW())) - GREATEST(TO_DAYS(' . $array_date_between[0] . '), TO_DAYS(product_shop.date_add))), 0), 2) as averageQuantitySold,
ROUND(IFNULL(SUM((od.product_price * od.product_quantity) / o.conversion_rate), 0), 2) AS totalPriceSold,
(
SELECT IFNULL(SUM(pv.counter), 0)
FROM ' . _DB_PREFIX_ . 'page pa
LEFT JOIN ' . _DB_PREFIX_ . 'page_viewed pv ON pa.id_page = pv.id_page
LEFT JOIN ' . _DB_PREFIX_ . 'date_range dr ON pv.id_date_range = dr.id_date_range
WHERE pa.id_object = p.id_product AND pa.id_page_type = ' . (int) Page::getPageTypeByName('product') . '
AND dr.time_start BETWEEN ' . $date_between . '
AND dr.time_end BETWEEN ' . $date_between . '
) AS totalPageViewed,
product_shop.active
FROM ' . _DB_PREFIX_ . 'product p
' . Shop::addSqlAssociation('product', 'p') . '
LEFT JOIN ' . _DB_PREFIX_ . 'product_lang pl ON (p.id_product = pl.id_product AND pl.id_lang = ' . (int) $this->getLang() . ' ' . Shop::addSqlRestrictionOnLang('pl') . ')
LEFT JOIN ' . _DB_PREFIX_ . 'order_detail od ON od.product_id = p.id_product
LEFT JOIN ' . _DB_PREFIX_ . 'orders o ON od.id_order = o.id_order
' . Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o') . '
' . Product::sqlStock('p', 0) . '
WHERE o.valid = 1
AND o.invoice_date BETWEEN ' . $date_between . '
GROUP BY od.product_id';
if (Validate::IsName($this->_sort)) {
$this->query .= ' ORDER BY `' . bqSQL($this->_sort) . '`';
if (isset($this->_direction) && Validate::isSortDirection($this->_direction)) {
$this->query .= ' ' . $this->_direction;
}
}
if (($this->_start === 0 || Validate::IsUnsignedInt($this->_start)) && Validate::IsUnsignedInt($this->_limit)) {
$this->query .= ' LIMIT ' . (int) $this->_start . ', ' . (int) $this->_limit;
}
$values = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($this->query);
foreach ($values as &$value) {
$value['avgPriceSold'] = Tools::displayPrice($value['avgPriceSold'], $currency);
$value['totalPriceSold'] = Tools::displayPrice($value['totalPriceSold'], $currency);
}
unset($value);
$this->_values = $values;
$this->_totalCount = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('SELECT FOUND_ROWS()');
}
示例12: __construct
public function __construct()
{
$this->bootstrap = true;
$this->table = 'order_slip';
$this->className = 'OrderSlip';
$this->_select = ' o.`id_shop`';
$this->_join .= ' LEFT JOIN ' . _DB_PREFIX_ . 'orders o ON (o.`id_order` = a.`id_order`)';
$this->_group = ' GROUP BY a.`id_order_slip`';
parent::__construct();
$this->fields_list = array('id_order_slip' => array('title' => $this->trans('ID', array(), 'Admin.Global'), 'align' => 'center', 'class' => 'fixed-width-xs'), 'id_order' => array('title' => $this->trans('Order ID', array(), 'Admin.OrdersCustomers.Feature'), 'align' => 'left', 'class' => 'fixed-width-md'), 'date_add' => array('title' => $this->trans('Date issued', array(), 'Admin.OrdersCustomers.Feature'), 'type' => 'date', 'align' => 'right', 'filter_key' => 'a!date_add', 'havingFilter' => true), 'id_pdf' => array('title' => $this->trans('PDF', array(), 'Admin.Global'), 'align' => 'center', 'callback' => 'printPDFIcons', 'orderby' => false, 'search' => false, 'remove_onclick' => true));
$this->_select = 'a.id_order_slip AS id_pdf';
$this->optionTitle = $this->trans('Slip', array(), 'Admin.OrdersCustomers.Feature');
$this->fields_options = array('general' => array('title' => $this->trans('Credit slip options', array(), 'Admin.OrdersCustomers.Feature'), 'fields' => array('PS_CREDIT_SLIP_PREFIX' => array('title' => $this->trans('Credit slip prefix', array(), 'Admin.OrdersCustomers.Feature'), 'desc' => $this->trans('Prefix used for credit slips.', array(), 'Admin.OrdersCustomers.Help'), 'size' => 6, 'type' => 'textLang')), 'submit' => array('title' => $this->trans('Save', array(), 'Admin.Actions'))));
$this->_where = Shop::addSqlRestriction(false, 'o');
}
示例13: customerHasAmazonCustomerId
public static function customerHasAmazonCustomerId($id_customer)
{
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
SELECT ac.*
FROM `' . _DB_PREFIX_ . 'customer` c
JOIN `' . _DB_PREFIX_ . 'amz_customer` ac ON c.`id_customer` = ac.`id_customer`
WHERE c.`id_customer` = \'' . pSQL($id_customer) . '\'
' . Shop::addSqlRestriction(Shop::SHARE_CUSTOMER) . '
AND c.`deleted` = 0');
if (!$result) {
return false;
} else {
return $result['amazon_customer_id'] ? $result['amazon_customer_id'] : false;
}
}
示例14: __construct
public function __construct()
{
$this->bootstrap = true;
$this->context = Context::getContext();
$this->table = 'order_return';
$this->className = 'OrderReturn';
$this->colorOnBackground = true;
$this->_select = 'orsl.`name`, o.`id_shop`';
$this->_join = 'LEFT JOIN ' . _DB_PREFIX_ . 'order_return_state_lang orsl ON (orsl.`id_order_return_state` = a.`state` AND orsl.`id_lang` = ' . (int) $this->context->language->id . ')';
$this->_join .= ' LEFT JOIN ' . _DB_PREFIX_ . 'orders o ON (o.`id_order` = a.`id_order`)';
$this->fields_list = array('id_order_return' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25), 'a!id_order' => array('title' => $this->l('Order ID'), 'width' => 100, 'align' => 'center'), 'name' => array('title' => $this->l('Status'), 'width' => 'auto', 'align' => 'left'), 'a!date_add' => array('title' => $this->l('Date issued'), 'width' => 150, 'type' => 'date', 'align' => 'right'));
$this->fields_options = array('general' => array('title' => $this->l('Merchandise return (RMA) options'), 'fields' => array('PS_ORDER_RETURN' => array('title' => $this->l('Enable returns'), 'desc' => $this->l('Would you like to allow merchandise returns in your shop?'), 'cast' => 'intval', 'type' => 'bool'), 'PS_ORDER_RETURN_NB_DAYS' => array('title' => $this->l('Time limit of validity'), 'desc' => $this->l('How many days after the delivery date does the customer have to return a product?'), 'cast' => 'intval', 'type' => 'text', 'size' => '2')), 'submit' => array('title' => $this->l('Save'))));
parent::__construct();
$this->_where = Shop::addSqlRestriction(false, 'o');
}
示例15: getTotalCustomerMessages
public static function getTotalCustomerMessages($where = null)
{
if (is_null($where)) {
return (int) Db::getInstance()->getValue('
SELECT COUNT(*)
FROM ' . _DB_PREFIX_ . 'customer_message
LEFT JOIN `' . _DB_PREFIX_ . 'customer_thread` ct ON (cm.`id_customer_thread` = ct.`id_customer_thread`)
WHERE 1' . Shop::addSqlRestriction());
} else {
return (int) Db::getInstance()->getValue('
SELECT COUNT(*)
FROM ' . _DB_PREFIX_ . 'customer_message cm
LEFT JOIN `' . _DB_PREFIX_ . 'customer_thread` ct ON (cm.`id_customer_thread` = ct.`id_customer_thread`)
WHERE ' . $where . Shop::addSqlRestriction());
}
}