本文整理汇总了PHP中Shop::getContextListShopID方法的典型用法代码示例。如果您正苦于以下问题:PHP Shop::getContextListShopID方法的具体用法?PHP Shop::getContextListShopID怎么用?PHP Shop::getContextListShopID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Shop
的用法示例。
在下文中一共展示了Shop::getContextListShopID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initFormByStatus
public function initFormByStatus()
{
$this->fields_form = array('legend' => array('title' => $this->l('By order status'), 'image' => '../img/admin/pdf.gif'), 'input' => array(array('type' => 'checkboxStatuses', 'label' => $this->l('Statuses:'), 'name' => 'id_order_state', 'values' => array('query' => OrderState::getOrderStates($this->context->language->id), 'id' => 'id_order_state', 'name' => 'name'), 'desc' => $this->l('You can also export orders which have not been charged yet.') . ' (<img src="../img/admin/charged_ko.gif" alt="" />).')), 'submit' => array('title' => $this->l('Generate PDF file by status.'), 'class' => 'button', 'id' => 'submitPrint2'));
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
SELECT COUNT(o.id_order) as nbOrders, (
SELECT oh.id_order_state
FROM ' . _DB_PREFIX_ . 'order_history oh
WHERE oh.id_order = oi.id_order
ORDER BY oh.date_add DESC, oh.id_order_history DESC
LIMIT 1
) id_order_state
FROM ' . _DB_PREFIX_ . 'order_invoice oi
LEFT JOIN ' . _DB_PREFIX_ . 'orders o ON (oi.id_order = o.id_order)
WHERE o.id_shop IN(' . implode(', ', Shop::getContextListShopID()) . ')
GROUP BY id_order_state
');
$status_stats = array();
foreach ($result as $row) {
$status_stats[$row['id_order_state']] = $row['nbOrders'];
}
$this->tpl_form_vars = array('statusStats' => $status_stats, 'style' => '');
$this->table = 'invoice_status';
$this->show_toolbar = false;
return parent::renderForm();
}
示例2: getBlockContent
public static function getBlockContent($params, &$smarty)
{
//use in template as {getBelvgBlockContent id="block_identifier"}
if (!Module::isEnabled('belvg_staticblocks')) {
return FALSE;
}
if (isset($params['id'])) {
$block_identifier = $params['id'];
$sql = '
SELECT `id_belvg_staticblocks`
FROM `' . _DB_PREFIX_ . 'belvg_staticblocks`
WHERE `block_identifier` = "' . pSQL($block_identifier) . '" AND `status` = "1"';
if (Shop::isFeatureActive()) {
$sql .= ' AND `id_belvg_staticblocks` IN (
SELECT sa.`id_belvg_staticblocks`
FROM `' . _DB_PREFIX_ . 'belvg_staticblocks_shop` sa
WHERE sa.id_shop IN (' . implode(', ', Shop::getContextListShopID()) . ')
)';
}
$block_id = (int) Db::getInstance()->getValue($sql);
if ($block_id) {
$id_lang = Context::getContext()->cookie->id_lang;
$block = new self($block_id);
if (isset($block->content[$id_lang])) {
return $block->content[$id_lang];
}
}
}
}
示例3: __construct
public function __construct()
{
$this->table = 'smart_blog_comment';
$this->className = 'Blogcomment';
$this->module = 'smartblog';
$this->context = Context::getContext();
$this->bootstrap = true;
if (Shop::isFeatureActive()) {
Shop::addTableAssociation($this->table, array('type' => 'shop'));
}
parent::__construct();
$this->fields_list = array('id_smart_blog_comment' => array('title' => $this->l('Id'), 'width' => 50, 'type' => 'text'), 'email' => array('title' => $this->l('Email'), 'width' => 50, 'type' => 'text', 'lang' => true), 'meta_title' => array('title' => $this->l('Post Title'), 'filter_key' => 'smp!meta_title', 'align' => 'center'), 'name' => array('title' => $this->l('Name'), 'width' => 150, 'type' => 'text'), 'content' => array('title' => $this->l('Comment'), 'width' => 200, 'type' => 'text', 'callback' => 'getCommentClean'), 'created' => array('title' => $this->l('Date'), 'width' => 60, 'type' => 'text', 'lang' => true), 'active' => array('title' => $this->l('Status'), 'width' => '70', 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false));
$this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'icon' => 'icon-trash', 'confirm' => $this->l('Delete selected items?')));
$this->_join = ' LEFT JOIN ' . _DB_PREFIX_ . 'smart_blog_comment_shop sbs ON a.id_smart_blog_comment=sbs.id_smart_blog_comment && sbs.id_shop IN(' . implode(',', Shop::getContextListShopID()) . ')';
$this->_join .= ' LEFT JOIN ' . _DB_PREFIX_ . 'smart_blog_post_lang smp ON a.id_post=smp.id_smart_blog_post and smp.id_lang = ' . (int) Context::getContext()->language->id;
$this->_select = 'sbs.id_shop';
$this->_defaultOrderBy = 'a.id_smart_blog_comment';
$this->_defaultOrderWay = 'DESC';
$this->_select = 'smp.meta_title';
//$this->_defaultOrderBy = 'a.id_smart_blog_comment';
if (Shop::isFeatureActive() && Shop::getContext() != Shop::CONTEXT_SHOP) {
$this->_group = 'GROUP BY a.id_smart_blog_comment';
}
parent::__construct();
}
示例4: getContacts
/**
* Return available contacts
*
* @param integer $id_lang Language ID
* @param Context
* @return array Contacts
*/
public static function getContacts($id_lang)
{
$shop_ids = Shop::getContextListShopID();
$sql = 'SELECT *
FROM `' . _DB_PREFIX_ . 'contact` c
' . Shop::addSqlAssociation('contact', 'c', false) . '
LEFT JOIN `' . _DB_PREFIX_ . 'contact_lang` cl ON (c.`id_contact` = cl.`id_contact`)
WHERE cl.`id_lang` = ' . (int) $id_lang . '
AND contact_shop.`id_shop` IN (' . implode(', ', array_map('intval', $shop_ids)) . ')
ORDER BY `name` ASC';
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
}
示例5: getCategoriesContacts
/**
* Return available categories contacts
* @return array Contacts
*/
public static function getCategoriesContacts()
{
$shop_ids = Shop::getContextListShopID();
return Db::getInstance()->executeS('
SELECT cl.*
FROM ' . _DB_PREFIX_ . 'contact ct
' . Shop::addSqlAssociation('contact', 'ct', false) . '
LEFT JOIN ' . _DB_PREFIX_ . 'contact_lang cl
ON (cl.id_contact = ct.id_contact AND cl.id_lang = ' . (int) Context::getContext()->language->id . ')
WHERE ct.customer_service = 1
AND contact_shop.`id_shop` IN (' . implode(', ', array_map('intval', $shop_ids)) . ')
GROUP BY ct.`id_contact`
');
}
示例6: getLastElementsIdsByType
/**
* getLastElementsIdsByType return all the element ids to show (order, customer registration, and customer message)
* Get all the element ids
*
* @param string $type contains the field name of the Employee table
* @param integer $id_last_element contains the id of the last seen element
* @return array containing the notifications
*/
public static function getLastElementsIdsByType($type, $id_last_element)
{
switch ($type) {
case 'order':
$sql = '
SELECT SQL_CALC_FOUND_ROWS o.`id_order`, o.`id_customer`, o.`total_paid`, o.`id_currency`, c.`firstname`, c.`lastname`
FROM `' . _DB_PREFIX_ . 'orders` as o
LEFT JOIN `' . _DB_PREFIX_ . 'customer` as c ON (c.`id_customer` = o.`id_customer`)
WHERE `id_order` > ' . (int) $id_last_element . Shop::addSqlRestriction(false, 'o') . '
ORDER BY `id_order` DESC
LIMIT 5';
break;
case 'customer_message':
$sql = '
SELECT SQL_CALC_FOUND_ROWS c.`id_customer_message`, ct.`id_customer`, ct.`id_customer_thread`, ct.`email`
FROM `' . _DB_PREFIX_ . 'customer_message` as c
LEFT JOIN `' . _DB_PREFIX_ . 'customer_thread` as ct ON (c.`id_customer_thread` = ct.`id_customer_thread`)
WHERE c.`id_customer_message` > ' . (int) $id_last_element . '
AND c.`id_employee` = 0
AND ct.id_shop IN (' . implode(', ', Shop::getContextListShopID()) . ')
ORDER BY c.`id_customer_message` DESC
LIMIT 5';
break;
default:
$sql = '
SELECT SQL_CALC_FOUND_ROWS t.`id_' . bqSQL($type) . '`, t.*
FROM `' . _DB_PREFIX_ . bqSQL($type) . '` t
WHERE t.`deleted` = 0 AND t.`id_' . bqSQL($type) . '` > ' . (int) $id_last_element . Shop::addSqlRestriction(false, 't') . '
ORDER BY t.`id_' . bqSQL($type) . '` DESC
LIMIT 5';
break;
}
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql, true, false);
$total = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('SELECT FOUND_ROWS()', false);
$json = array('total' => $total, 'results' => array());
foreach ($result as $value) {
$customer_name = '';
if (isset($value['firstname']) && isset($value['lastname'])) {
$customer_name = Tools::safeOutput($value['firstname'] . ' ' . $value['lastname']);
} else {
if (isset($value['email'])) {
$customer_name = Tools::safeOutput($value['email']);
}
}
$json['results'][] = array('id_order' => !empty($value['id_order']) ? (int) $value['id_order'] : 0, 'id_customer' => !empty($value['id_customer']) ? (int) $value['id_customer'] : 0, 'id_customer_message' => !empty($value['id_customer_message']) ? (int) $value['id_customer_message'] : 0, 'id_customer_thread' => !empty($value['id_customer_thread']) ? (int) $value['id_customer_thread'] : 0, 'total_paid' => !empty($value['total_paid']) ? Tools::displayPrice((double) $value['total_paid'], (int) $value['id_currency'], false) : 0, 'customer_name' => $customer_name);
}
return $json;
}
示例7: add
/**
* Inserts new menu item to the database
*
* @param bool $autoDate
* @param bool $nullValues
*
* @return bool
* @throws PrestaShopException
*/
public function add($autoDate = true, $nullValues = false)
{
$status = parent::add($autoDate, $nullValues);
Hook::exec('actionCTTopMenuCompositionChanged');
if ($status) {
$id_shop_list = Shop::getContextListShopID();
if (!empty($this->id_shop_list)) {
$id_shop_list = $this->id_shop_list;
}
// @TODO Fix initial value
foreach ($id_shop_list as $id_shop) {
Db::getInstance()->update('ct_top_menu_item_shop', array('position' => self::getMaxPosition($id_shop) + 1), 'id_ct_top_menu_item = ' . (int) $this->id . ' AND id_shop = ' . (int) $id_shop);
}
}
return $status;
}
示例8: renderList
public function renderList()
{
// Display list Referrers:
$this->addRowAction('view');
$this->addRowAction('edit');
$this->addRowAction('delete');
$this->_select = 'SUM(sa.cache_visitors) AS cache_visitors, SUM(sa.cache_visits) AS cache_visits, SUM(sa.cache_pages) AS cache_pages,
SUM(sa.cache_registrations) AS cache_registrations, SUM(sa.cache_orders) AS cache_orders, SUM(sa.cache_sales) AS cache_sales,
IF(sa.cache_orders > 0, ROUND(sa.cache_sales/sa.cache_orders, 2), 0) as cart, (sa.cache_visits*click_fee) as fee0,
(sa.cache_orders*base_fee) as fee1, (sa.cache_sales*percent_fee/100) as fee2';
$this->_join = '
LEFT JOIN `' . _DB_PREFIX_ . 'referrer_shop` sa
ON (sa.' . $this->identifier . ' = a.' . $this->identifier . ' AND sa.id_shop IN (' . implode(', ', Shop::getContextListShopID()) . '))';
$this->_group = 'GROUP BY sa.id_referrer';
$this->tpl_list_vars = array('enable_calendar' => $this->enableCalendar(), 'calendar_form' => $this->displayCalendar(), 'settings_form' => $this->displaySettings());
return parent::renderList();
}
示例9: upgrade_module_1_5_0
function upgrade_module_1_5_0($module)
{
/* Get existing values as default */
$default_width = (int) Configuration::get('HOMESLIDER_WIDTH');
$default_speed = (int) Configuration::get('HOMESLIDER_SPEED');
$default_pause = (int) Configuration::get('HOMESLIDER_PAUSE');
$default_loop = (int) Configuration::get('HOMESLIDER_LOOP');
$res = true;
// Clean existing
Configuration::deleteByName('HOMESLIDER_WIDTH');
Configuration::deleteByName('HOMESLIDER_SPEED');
Configuration::deleteByName('HOMESLIDER_PAUSE');
Configuration::deleteByName('HOMESLIDER_LOOP');
$shops = Shop::getContextListShopID();
$shop_groups_list = array();
/* Setup each shop */
foreach ($shops as $shop_id) {
$shop_group_id = (int) Shop::getGroupFromShop($shop_id, true);
if (!in_array($shop_group_id, $shop_groups_list)) {
$shop_groups_list[] = $shop_group_id;
}
/* Sets up configuration */
$res = Configuration::updateValue('HOMESLIDER_WIDTH', $default_width, false, $shop_group_id, $shop_id);
$res &= Configuration::updateValue('HOMESLIDER_SPEED', $default_speed, false, $shop_group_id, $shop_id);
$res &= Configuration::updateValue('HOMESLIDER_PAUSE', $default_pause, false, $shop_group_id, $shop_id);
$res &= Configuration::updateValue('HOMESLIDER_LOOP', $default_loop, false, $shop_group_id, $shop_id);
}
/* Sets up Shop Group configuration */
if (count($shop_groups_list)) {
foreach ($shop_groups_list as $shop_group_id) {
$res = Configuration::updateValue('HOMESLIDER_WIDTH', $default_width, false, $shop_group_id);
$res &= Configuration::updateValue('HOMESLIDER_SPEED', $default_speed, false, $shop_group_id);
$res &= Configuration::updateValue('HOMESLIDER_PAUSE', $default_pause, false, $shop_group_id);
$res &= Configuration::updateValue('HOMESLIDER_LOOP', $default_loop, false, $shop_group_id);
}
}
/* Sets up Global configuration */
$res = Configuration::updateValue('HOMESLIDER_WIDTH', $default_width);
$res &= Configuration::updateValue('HOMESLIDER_SPEED', $default_speed);
$res &= Configuration::updateValue('HOMESLIDER_PAUSE', $default_pause);
$res &= Configuration::updateValue('HOMESLIDER_LOOP', $default_loop);
return $res;
}
示例10: initFormByStatus
public function initFormByStatus()
{
$this->fields_form = array('legend' => array('title' => $this->l('By order status'), 'icon' => 'icon-time'), 'input' => array(array('type' => 'checkboxStatuses', 'label' => $this->l('Statuses'), 'name' => 'id_order_state', 'values' => array('query' => OrderState::getOrderStates($this->context->language->id), 'id' => 'id_order_state', 'name' => 'name'), 'hint' => $this->l('You can also export orders which have not been charged yet.'))), 'submit' => array('title' => $this->l('Generate PDF file by status'), 'id' => 'submitPrint2', 'icon' => 'process-icon-download-alt'));
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
SELECT COUNT( o.id_order ) AS nbOrders, o.current_state as id_order_state
FROM `' . _DB_PREFIX_ . 'order_invoice` oi
LEFT JOIN `' . _DB_PREFIX_ . 'orders` o ON oi.id_order = o.id_order
WHERE o.id_shop IN(' . implode(', ', Shop::getContextListShopID()) . ')
GROUP BY o.current_state
');
$status_stats = array();
foreach ($result as $row) {
$status_stats[$row['id_order_state']] = $row['nbOrders'];
}
$this->tpl_form_vars = array('statusStats' => $status_stats, 'style' => '');
$this->table = 'invoice_status';
$this->show_toolbar = false;
return parent::renderForm();
}
示例11: __construct
public function __construct()
{
$this->bootstrap = true;
$this->table = 'belvg_staticblocks';
$this->identifier = 'id_belvg_staticblocks';
$this->className = 'BelvgStaticBlocks';
$this->lang = TRUE;
$this->addRowAction('edit');
$this->addRowAction('delete');
$this->fields_list = array('id_belvg_staticblocks' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 30), 'title' => array('title' => $this->l('Block Title'), 'width' => 300), 'block_identifier' => array('title' => $this->l('Identifier'), 'width' => 300), 'status' => array('title' => $this->l('Status'), 'width' => 40, 'active' => 'update', 'align' => 'center', 'type' => 'bool', 'orderby' => FALSE), 'date_add' => array('title' => $this->l('Date Created'), 'width' => 150, 'type' => 'date', 'align' => 'right'), 'date_upd' => array('title' => $this->l('Last Modified'), 'width' => 150, 'type' => 'date', 'align' => 'right'));
if (Shop::isFeatureActive() && Shop::getContext() != Shop::CONTEXT_ALL) {
$this->_where .= ' AND a.' . $this->identifier . ' IN (
SELECT sa.' . $this->identifier . '
FROM `' . _DB_PREFIX_ . $this->table . '_shop` sa
WHERE sa.id_shop IN (' . implode(', ', Shop::getContextListShopID()) . ')
)';
}
$this->identifiersDnd = array('id_belvg_staticblocks' => 'id_sslide_to_move');
parent::__construct();
}
示例12: __construct
public function __construct()
{
$this->table = 'smart_blog_comment';
$this->className = 'Blogcomment';
$this->module = 'smartblog';
$this->context = Context::getContext();
$this->bootstrap = true;
if (Shop::isFeatureActive()) {
Shop::addTableAssociation($this->table, array('type' => 'shop'));
}
parent::__construct();
$this->fields_list = array('id_smart_blog_comment' => array('title' => $this->l('Id'), 'width' => 100, 'type' => 'text'), 'name' => array('title' => $this->l('Name'), 'width' => 150, 'type' => 'text'), 'content' => array('title' => $this->l('Comment'), 'width' => 340, 'type' => 'text'), 'created' => array('title' => $this->l('Date'), 'width' => 60, 'type' => 'text', 'lang' => true), 'active' => array('title' => $this->l('Status'), 'width' => '70', 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false));
$this->_join = 'LEFT JOIN ' . _DB_PREFIX_ . 'smart_blog_comment_shop sbs ON a.id_smart_blog_comment=sbs.id_smart_blog_comment && sbs.id_shop IN(' . implode(',', Shop::getContextListShopID()) . ')';
$this->_select = 'sbs.id_shop';
$this->_defaultOrderBy = 'a.id_smart_blog_comment';
$this->_defaultOrderWay = 'DESC';
if (Shop::isFeatureActive() && Shop::getContext() != Shop::CONTEXT_SHOP) {
$this->_group = 'GROUP BY a.id_smart_blog_comment';
}
parent::__construct();
}
示例13: initContent
public function initContent()
{
parent::initContent();
$this->ajax = true;
$region = Tools::getValue('set_region', -1);
if ($region > -1) {
$url = $this->getRegionURL($region);
if ($url) {
$this->context->cookie->__set('yandex_region', $region);
} else {
$this->context->cookie->__unset('yandex_region');
}
die(json_encode($url));
}
$sql = 'SELECT su.`id_shop_url` as id, su.`domain`,
mu.`city_name`, s.`name` as shop_name
FROM `' . _DB_PREFIX_ . 'shop_url` su
INNER JOIN `' . _DB_PREFIX_ . 'shop` s ON
s.`id_shop`=su.`id_shop`
INNER JOIN `' . _DB_PREFIX_ . 'egmultishop_url` mu ON
mu.`id_url`=su.`id_shop_url`
WHERE su.id_shop IN (' . implode(', ', Shop::getContextListShopID()) . ')
and su.`main`= 0
and su.`active` = 1
and not mu.`city_name` = \'\'
and mu.`active` > 0
order by 3';
if (!($citys = Db::getInstance()->executeS($sql))) {
return false;
}
if (Tools::getValue('json', false) !== false) {
die(json_encode($citys));
}
$host = "http://" . Tools::getHttpHost();
$current_page = str_replace($host, "", $_SERVER["HTTP_REFERER"]);
$question = Tools::getValue('question');
$region = Tools::getValue('region');
$this->context->smarty->assign(array('citys' => $citys, 'host' => $host, 'question' => $question, 'region' => $region));
$this->smartyOutputContent($this->getTemplatePath('citys.tpl'));
}
示例14: addShopAssociation
public static function addShopAssociation($table, $alias, $context = null)
{
if (is_null($context)) {
$context = Context::getContext();
}
$table_alias = $table . '_shop';
if (strpos($table, '.') !== false) {
list($table_alias, $table) = explode('.', $table);
}
if (!array_key_exists($table, self::$blog_shop_tables)) {
return;
}
$sql = ' INNER JOIN ' . _DB_PREFIX_ . $table . '_shop ' . $table_alias . ' ON (' . $table_alias . '.id_' . $table . ' = ' . $alias . '.id_' . $table;
if (isset($context->shop->id)) {
$sql .= ' AND ' . $table_alias . '.id_shop = ' . (int) $context->shop->id;
} elseif (Shop::checkIdShopDefault($table)) {
$sql .= ' AND ' . $table_alias . '.id_shop = ' . $alias . '.id_shop_default';
} else {
$sql .= ' AND ' . $table_alias . '.id_shop IN (' . implode(', ', Shop::getContextListShopID()) . ')';
}
$sql .= ')';
return $sql;
}
示例15: __construct
public function __construct()
{
$this->table = 'smart_blog_category';
$this->className = 'BlogCategory';
$this->module = 'smartblog';
$this->lang = true;
$this->image_dir = '../modules/smartblog/images/category';
$this->bootstrap = true;
$this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?'), 'icon' => 'icon-trash'));
$this->tpl_list_vars['icon'] = 'icon-folder-close';
$this->tpl_list_vars['title'] = $this->l('Categories');
$this->fields_list = array('id_smart_blog_category' => array('title' => $this->l('ID'), 'align' => 'center', 'class' => 'fixed-width-xs'), 'name' => array('title' => $this->l('Name'), 'width' => 'auto'), 'description' => array('title' => $this->l('Description'), 'maxlength' => 90, 'orderby' => false), 'position' => array('title' => $this->l('Position'), 'filter_key' => 'position', 'align' => 'center', 'class' => 'fixed-width-sm', 'position' => 'position'), 'active' => array('title' => $this->l('Displayed'), 'class' => 'fixed-width-sm', 'active' => 'status', 'align' => 'center', 'type' => 'bool', 'orderby' => false));
/* $id_smart_blog_category = (int)Tools::getValue('id_smart_blog_category', Tools::getValue('id_smart_blog_category', 1));
$this->smart_blog_category = new BlogCategory($id_smart_blog_category);
$this->context = Context::getContext();
$this->_where = ' AND `id_parent` = '.(int)$this->smart_blog_category->id;
*/
$this->_select = 'position ';
$this->_orderBy = 'position';
if (Shop::isFeatureActive()) {
Shop::addTableAssociation($this->table, array('type' => 'shop'));
}
$this->_join = 'LEFT JOIN ' . _DB_PREFIX_ . 'smart_blog_category_shop sbs ON a.id_smart_blog_category=sbs.id_smart_blog_category && sbs.id_shop IN(' . implode(',', Shop::getContextListShopID()) . ')';
$this->_select = 'sbs.id_shop';
$this->_defaultOrderBy = 'a.id_smart_blog_category';
$this->_defaultOrderWay = 'DESC';
if (Shop::isFeatureActive() && Shop::getContext() != Shop::CONTEXT_SHOP) {
$this->_group = 'GROUP BY a.id_smart_blog_category';
}
parent::__construct();
}