本文整理汇总了PHP中Shop::getContextShopID方法的典型用法代码示例。如果您正苦于以下问题:PHP Shop::getContextShopID方法的具体用法?PHP Shop::getContextShopID怎么用?PHP Shop::getContextShopID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Shop
的用法示例。
在下文中一共展示了Shop::getContextShopID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderForm
public function renderForm()
{
if (!$this->object->id) {
$this->object->price = -1;
}
$this->fields_form = array('legend' => array('title' => $this->trans('Catalog price rules', array(), 'Admin.Catalog.Feature'), 'icon' => 'icon-dollar'), 'input' => array(array('type' => 'text', 'label' => $this->trans('Name', array(), 'Admin.Global'), 'name' => 'name', 'maxlength' => 255, 'required' => true), array('type' => 'select', 'label' => $this->trans('Shop', array(), 'Admin.Global'), 'name' => 'shop_id', 'options' => array('query' => Shop::getShops(), 'id' => 'id_shop', 'name' => 'name'), 'condition' => Shop::isFeatureActive(), 'default_value' => Shop::getContextShopID()), array('type' => 'select', 'label' => $this->trans('Currency', array(), 'Admin.Global'), 'name' => 'id_currency', 'options' => array('query' => array_merge(array(0 => array('id_currency' => 0, 'name' => $this->trans('All currencies', array(), 'Admin.Global'))), Currency::getCurrencies(false, true, true)), 'id' => 'id_currency', 'name' => 'name')), array('type' => 'select', 'label' => $this->trans('Country', array(), 'Admin.Global'), 'name' => 'id_country', 'options' => array('query' => array_merge(array(0 => array('id_country' => 0, 'name' => $this->trans('All countries', array(), 'Admin.Global'))), Country::getCountries((int) $this->context->language->id)), 'id' => 'id_country', 'name' => 'name')), array('type' => 'select', 'label' => $this->trans('Group', array(), 'Admin.Global'), 'name' => 'id_group', 'options' => array('query' => array_merge(array(0 => array('id_group' => 0, 'name' => $this->trans('All groups', array(), 'Admin.Global'))), Group::getGroups((int) $this->context->language->id)), 'id' => 'id_group', 'name' => 'name')), array('type' => 'text', 'label' => $this->trans('From quantity', array(), 'Admin.Catalog.Feature'), 'name' => 'from_quantity', 'maxlength' => 10, 'required' => true), array('type' => 'text', 'label' => $this->trans('Price (tax excl.)', array(), 'Admin.Catalog.Feature'), 'name' => 'price', 'disabled' => $this->object->price == -1 ? 1 : 0, 'maxlength' => 10, 'suffix' => $this->context->currency->getSign('right')), array('type' => 'checkbox', 'name' => 'leave_bprice', 'values' => array('query' => array(array('id' => 'on', 'name' => $this->trans('Leave initial price', array(), 'Admin.Catalog.Feature'), 'val' => '1', 'checked' => '1')), 'id' => 'id', 'name' => 'name')), array('type' => 'datetime', 'label' => $this->trans('From', array(), 'Admin.Global'), 'name' => 'from'), array('type' => 'datetime', 'label' => $this->trans('To', array(), 'Admin.Global'), 'name' => 'to'), array('type' => 'select', 'label' => $this->trans('Reduction type', array(), 'Admin.Catalog.Feature'), 'name' => 'reduction_type', 'options' => array('query' => array(array('reduction_type' => 'amount', 'name' => $this->trans('Amount', array(), 'Admin.Global')), array('reduction_type' => 'percentage', 'name' => $this->trans('Percentage', array(), 'Admin.Global'))), 'id' => 'reduction_type', 'name' => 'name')), array('type' => 'select', 'label' => $this->trans('Reduction with or without taxes', array(), 'Admin.Catalog.Feature'), 'name' => 'reduction_tax', 'align' => 'center', 'options' => array('query' => array(array('lab' => $this->trans('Tax included', array(), 'Admin.Global'), 'val' => 1), array('lab' => $this->trans('Tax excluded', array(), 'Admin.Global'), 'val' => 0)), 'id' => 'val', 'name' => 'lab')), array('type' => 'text', 'label' => $this->trans('Reduction', array(), 'Admin.Catalog.Feature'), 'name' => 'reduction', 'required' => true)), 'submit' => array('title' => $this->trans('Save', array(), 'Admin.Actions')));
if (($value = $this->getFieldValue($this->object, 'price')) != -1) {
$price = number_format($value, 6);
} else {
$price = '';
}
$this->fields_value = array('price' => $price, 'from_quantity' => ($value = $this->getFieldValue($this->object, 'from_quantity')) ? $value : 1, 'reduction' => number_format(($value = $this->getFieldValue($this->object, 'reduction')) ? $value : 0, 6), 'leave_bprice_on' => $price ? 0 : 1, 'shop_id' => ($value = $this->getFieldValue($this->object, 'id_shop')) ? $value : 1);
$attribute_groups = array();
$attributes = Attribute::getAttributes((int) $this->context->language->id);
foreach ($attributes as $attribute) {
if (!isset($attribute_groups[$attribute['id_attribute_group']])) {
$attribute_groups[$attribute['id_attribute_group']] = array('id_attribute_group' => $attribute['id_attribute_group'], 'name' => $attribute['attribute_group']);
}
$attribute_groups[$attribute['id_attribute_group']]['attributes'][] = array('id_attribute' => $attribute['id_attribute'], 'name' => $attribute['name']);
}
$features = Feature::getFeatures((int) $this->context->language->id);
foreach ($features as &$feature) {
$feature['values'] = FeatureValue::getFeatureValuesWithLang((int) $this->context->language->id, $feature['id_feature'], true);
}
$this->tpl_form_vars = array('manufacturers' => Manufacturer::getManufacturers(), 'suppliers' => Supplier::getSuppliers(), 'attributes_group' => $attribute_groups, 'features' => $features, 'categories' => Category::getSimpleCategories((int) $this->context->language->id), 'conditions' => $this->object->getConditions(), 'is_multishop' => Shop::isFeatureActive());
return parent::renderForm();
}
示例2: renderForm
public function renderForm()
{
if (!$this->object->id) {
$this->object->price = -1;
}
$shops = Shop::getShops();
if (count($this->context->employee->getAssociatedShops()) > 1) {
$shops = array_merge(array(0 => array('id_shop' => 0, 'name' => $this->l('All shops'))), $shops);
}
$this->fields_form = array('legend' => array('title' => $this->l('Specific price rules')), 'input' => array(array('type' => 'text', 'label' => $this->l('Name:'), 'name' => 'name', 'size' => 33, 'maxlength' => 32, 'required' => true, 'hint' => $this->l('Forbidden characters:') . ' <>;=#{}'), array('type' => 'select', 'label' => $this->l('Shop:'), 'name' => 'id_shop', 'options' => array('query' => $shops, 'id' => 'id_shop', 'name' => 'name'), 'condition' => Shop::isFeatureActive(), 'default_value' => Shop::getContextShopID()), array('type' => 'select', 'label' => $this->l('Currency:'), 'name' => 'id_currency', 'options' => array('query' => array_merge(array(0 => array('id_currency' => 0, 'name' => $this->l('All currencies'))), Currency::getCurrencies()), 'id' => 'id_currency', 'name' => 'name')), array('type' => 'select', 'label' => $this->l('Country:'), 'name' => 'id_country', 'options' => array('query' => array_merge(array(0 => array('id_country' => 0, 'name' => $this->l('All countries'))), Country::getCountries((int) $this->context->language->id)), 'id' => 'id_country', 'name' => 'name')), array('type' => 'select', 'label' => $this->l('Group:'), 'name' => 'id_group', 'options' => array('query' => array_merge(array(0 => array('id_group' => 0, 'name' => $this->l('All groups'))), Group::getGroups((int) $this->context->language->id)), 'id' => 'id_group', 'name' => 'name')), array('type' => 'text', 'label' => $this->l('From quantity:'), 'name' => 'from_quantity', 'size' => 6, 'maxlength' => 10, 'required' => true), array('type' => 'text', 'label' => $this->l('Price (tax excl.):'), 'name' => 'price', 'size' => 6, 'disabled' => $this->object->price == -1 ? 1 : 0, 'maxlength' => 10, 'suffix' => $this->context->currency->getSign('right')), array('type' => 'checkbox', 'name' => 'leave_bprice', 'values' => array('query' => array(array('id' => 'on', 'name' => $this->l('Leave base price'), 'val' => '1', 'checked' => '1')), 'id' => 'id', 'name' => 'name')), array('type' => 'date', 'label' => $this->l('From:'), 'name' => 'from', 'size' => 12), array('type' => 'date', 'label' => $this->l('To:'), 'name' => 'to', 'size' => 12), array('type' => 'select', 'label' => $this->l('Reduction type:'), 'name' => 'reduction_type', 'options' => array('query' => array(array('reduction_type' => 'amount', 'name' => $this->l('Amount')), array('reduction_type' => 'percentage', 'name' => $this->l('Percentage'))), 'id' => 'reduction_type', 'name' => 'name')), array('type' => 'text', 'label' => $this->l('Reduction:'), 'name' => 'reduction', 'required' => true)), 'submit' => array('title' => $this->l('Save'), 'class' => 'button'));
if (($value = $this->getFieldValue($this->object, 'price')) != -1) {
$price = number_format($value, 2);
} else {
$price = '';
}
$this->fields_value = array('price' => $price, 'from_quantity' => ($value = $this->getFieldValue($this->object, 'from_quantity')) ? $value : 1, 'reduction' => number_format(($value = $this->getFieldValue($this->object, 'reduction')) ? $value : 0, 2), 'leave_bprice_on' => $price ? 0 : 1);
$attribute_groups = array();
$attributes = Attribute::getAttributes((int) $this->context->language->id);
foreach ($attributes as $attribute) {
if (!isset($attribute_groups[$attribute['id_attribute_group']])) {
$attribute_groups[$attribute['id_attribute_group']] = array('id_attribute_group' => $attribute['id_attribute_group'], 'name' => $attribute['attribute_group']);
}
$attribute_groups[$attribute['id_attribute_group']]['attributes'][] = array('id_attribute' => $attribute['id_attribute'], 'name' => $attribute['name']);
}
$features = Feature::getFeatures((int) $this->context->language->id);
foreach ($features as &$feature) {
$feature['values'] = FeatureValue::getFeatureValuesWithLang((int) $this->context->language->id, $feature['id_feature'], true);
}
$this->tpl_form_vars = array('manufacturers' => Manufacturer::getManufacturers(), 'suppliers' => Supplier::getSuppliers(), 'attributes_group' => $attribute_groups, 'features' => $features, 'categories' => Category::getSimpleCategories((int) $this->context->language->id), 'conditions' => $this->object->getConditions(), 'is_multishop' => Shop::isFeatureActive());
return parent::renderForm();
}
示例3: updateNewMessages
public static function updateNewMessages($id_shop = null)
{
$context = Context::getContext();
if ($id_shop == null && Shop::getContext() == Shop::CONTEXT_SHOP) {
$id_shop = Shop::getContextShopID();
}
if ($id_shop > 0) {
if (($mf_employee = Db::getInstance()->getRow('SELECT id_employee, id_last_new_message, id_first_new_message FROM `' . _DB_PREFIX_ . 'mf_employee` WHERE `id_shop`=' . (int) $id_shop . ' AND `id_employee` = ' . (int) $context->employee->id)) != false) {
$id_last_new_message = Db::getInstance()->getValue('SELECT IFNULL(MAX(`' . self::$definition['primary'] . '`), 0)
FROM `' . _DB_PREFIX_ . self::$definition['table'] . '` WHERE `id_shop`=' . (int) $id_shop);
if ($id_last_new_message > $mf_employee['id_last_new_message']) {
$id_first_new_message = $mf_employee['id_last_new_message'];
} else {
$id_first_new_message = $mf_employee['id_first_new_message'];
}
return Db::getInstance()->execute('
UPDATE `' . _DB_PREFIX_ . 'mf_employee`
SET `id_last_new_message` = ' . (int) $id_last_new_message . ',
`id_first_new_message`=' . (int) $id_first_new_message . '
WHERE `id_shop`=' . (int) $id_shop . ' AND `id_employee` = ' . (int) $context->employee->id);
} else {
return Db::getInstance()->execute('
INSERT INTO `' . _DB_PREFIX_ . 'mf_employee`
(`id_last_new_message`, `id_first_new_message`, `id_employee`, `id_shop`) VALUES ((
SELECT IFNULL(MAX(`' . self::$definition['primary'] . '`), 0)
FROM `' . _DB_PREFIX_ . self::$definition['table'] . '`
), 0, ' . (int) $context->employee->id . ', ' . (int) $id_shop . ')');
}
}
}
示例4: getRenderedShopList
/**
* Render shop list
*
* @return string
*/
public function getRenderedShopList()
{
if (!Shop::isFeatureActive() || Shop::getTotalShops(false, null) < 2) {
return '';
}
$shop_context = Shop::getContext();
$context = Context::getContext();
$tree = Shop::getTree();
if ($shop_context == Shop::CONTEXT_ALL || $context->controller->multishop_context_group == false && $shop_context == Shop::CONTEXT_GROUP) {
$current_shop_value = '';
$current_shop_name = Translate::getAdminTranslation('All shops');
} elseif ($shop_context == Shop::CONTEXT_GROUP) {
$current_shop_value = 'g-' . Shop::getContextShopGroupID();
$current_shop_name = sprintf(Translate::getAdminTranslation('%s group'), $tree[Shop::getContextShopGroupID()]['name']);
} else {
$current_shop_value = 's-' . Shop::getContextShopID();
foreach ($tree as $group_id => $group_data) {
foreach ($group_data['shops'] as $shop_id => $shop_data) {
if ($shop_id == Shop::getContextShopID()) {
$current_shop_name = $shop_data['name'];
break;
}
}
}
}
$tpl = $this->createTemplate('helpers/shops_list/list.tpl');
$tpl->assign(array('tree' => $tree, 'current_shop_name' => $current_shop_name, 'current_shop_value' => $current_shop_value, 'multishop_context' => $context->controller->multishop_context, 'multishop_context_group' => $context->controller->multishop_context_group, 'is_shop_context' => $context->controller->multishop_context & Shop::CONTEXT_SHOP, 'is_group_context' => $context->controller->multishop_context & Shop::CONTEXT_GROUP, 'shop_context' => $shop_context, 'url' => $_SERVER['REQUEST_URI'] . ($_SERVER['QUERY_STRING'] ? '&' : '?') . 'setShopContext='));
return $tpl->fetch();
}
示例5: getContent
public function getContent()
{
$output = '<p class="info">' . $this->l('On some versions you could have to disable Cache, save, open your shop home page, than go back and enable it:') . '<br><br>' . sprintf('%s -> %s -> %s', $this->l('Advanced Parameters'), $this->l('Performance'), $this->l('Clear Smarty cache')) . '<br>' . sprintf('%s -> %s -> %s -> %s', $this->l('Preferences'), $this->l('SEO and URLs'), $this->l('Set userfriendly URL off'), $this->l('Save')) . '<br>' . sprintf('%s -> %s -> %s -> %s', $this->l('Preferences'), $this->l('SEO and URLs'), $this->l('Set userfriendly URL on'), $this->l('Save')) . '<br>' . '</p>';
$sql = 'SELECT * FROM `' . _DB_PREFIX_ . 'product_lang`
WHERE `link_rewrite`
IN (SELECT `link_rewrite` FROM `' . _DB_PREFIX_ . 'product_lang`
GROUP BY `link_rewrite`, `id_lang`
HAVING count(`link_rewrite`) > 1)';
if (Shop::isFeatureActive() && Shop::getContext() == Shop::CONTEXT_SHOP) {
$sql .= ' AND `id_shop` = ' . (int) Shop::getContextShopID();
}
if ($res = Db::getInstance()->ExecuteS($sql)) {
$err = $this->l('You need to fix duplicate URL entries:') . '<br>';
foreach ($res as $row) {
$lang = $this->context->language->getLanguage($row['id_lang']);
$err .= $row['name'] . ' (' . $row['id_product'] . ') - ' . $row['link_rewrite'] . '<br>';
$shop = $this->context->shop->getShop($lang['id_shop']);
$err .= $this->l('Language: ') . $lang['name'] . '<br>' . $this->l('Shop: ') . $shop['name'] . '<br><br>';
}
$output .= $this->displayWarning($err);
} else {
$output .= $this->displayConfirmation($this->l('Nice. You have no duplicate URL entry.'));
}
return '<div class="panel">' . $output . '</div>';
}
示例6: init
public function init()
{
if (Tools::getValue('supplier_rewrite')) {
$name_supplier = str_replace('-', '%', Tools::getValue('supplier_rewrite'));
//
// TODO:: need to core update Prestashop code and
// DB for link_rewrite for suppliers
// Should we use the Mysql FullText Index Search ??
//
$sql = 'SELECT sp.`id_supplier`
FROM `' . _DB_PREFIX_ . 'supplier` sp
LEFT JOIN `' . _DB_PREFIX_ . 'supplier_shop` s ON (sp.`id_supplier` = s.`id_supplier`)
WHERE sp.`name` LIKE \'' . $name_supplier . '\'';
if (Shop::isFeatureActive() && Shop::getContext() == Shop::CONTEXT_SHOP) {
$sql .= ' AND s.`id_shop` = ' . (int) Shop::getContextShopID();
}
$id_supplier = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
if ($id_supplier > 0) {
$_GET['id_supplier'] = $id_supplier;
} else {
//TODO: Do we need to send 404?
header('HTTP/1.1 404 Not Found');
header('Status: 404 Not Found');
}
}
parent::init();
}
示例7: init
public function init()
{
if ($cms_rewrite = Tools::getValue('cms_rewrite')) {
$sql = 'SELECT l.`id_cms`
FROM `' . _DB_PREFIX_ . 'cms_lang` l
LEFT JOIN `' . _DB_PREFIX_ . 'cms_shop` s ON (l.`id_cms` = s.`id_cms`)
WHERE l.`link_rewrite` = \'' . pSQL(str_replace('.html', '', $cms_rewrite)) . '\'';
if (Shop::isFeatureActive() && Shop::getContext() == Shop::CONTEXT_SHOP) {
$sql .= ' AND s.`id_shop` = ' . (int) Shop::getContextShopID();
}
$id_cms = (int) Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
if ($id_cms > 0) {
$_GET['id_cms'] = $id_cms;
}
} elseif ($cms_category_rewrite = Tools::getValue('cms_category_rewrite')) {
$sql = 'SELECT `id_cms_category`
FROM `' . _DB_PREFIX_ . 'cms_category_lang`
WHERE `link_rewrite` = \'' . pSQL($cms_category_rewrite) . '\'';
if (Shop::isFeatureActive() && Shop::getContext() == Shop::CONTEXT_SHOP) {
$sql .= ' AND s.`id_shop` = ' . (int) Shop::getContextShopID();
}
$id_cms_category = (int) Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
if ($id_cms_category > 0) {
$_GET['id_cms_category'] = $id_cms_category;
}
}
parent::init();
}
示例8: init
public function init()
{
if ($product_rewrite = Tools::getValue('product_rewrite')) {
$url_id_pattern = '/.*?([0-9]+)\\-([a-zA-Z0-9-]*)(\\.html)?/';
$lang_id = (int) Context::getContext()->language->id;
$sql = 'SELECT `id_product`
FROM `' . _DB_PREFIX_ . 'product_lang`
WHERE `link_rewrite` = \'' . pSQL(str_replace('.html', '', $product_rewrite)) . '\' AND `id_lang` = ' . $lang_id;
if (Shop::isFeatureActive() && Shop::getContext() == Shop::CONTEXT_SHOP) {
$sql .= ' AND `id_shop` = ' . (int) Shop::getContextShopID();
}
$id_product = (int) Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
if ($id_product > 0) {
$_GET['id_product'] = $id_product;
} elseif (preg_match($url_id_pattern, $this->request_uri, $url_parts)) {
$sql = 'SELECT `id_product`
FROM `' . _DB_PREFIX_ . 'product_lang`
WHERE `id_product` = \'' . pSQL($url_parts[1]) . '\' AND `id_lang` = ' . $lang_id;
if (Shop::isFeatureActive() && Shop::getContext() == Shop::CONTEXT_SHOP) {
$sql .= ' AND `id_shop` = ' . (int) Shop::getContextShopID();
}
$id_product = (int) Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
if ($id_product > 0) {
$_GET['id_product'] = $id_product;
}
}
}
parent::init();
}
示例9: getContent
public function getContent()
{
$output = '';
$output .= '<div style="display:block;" class="hint">
On some versions you have to disable Cache save than open your shop home page than go back and enable it.<br/>
Advanced Parameters > Performance > Clear Smarty cache<br /><br/>
Go to back office -> Preferences -> SEO and URLs -> Set userfriendly URL off -> Save<br />
Go to back office -> Preferences -> SEO and URLs -> Set userfriendly URL on -> Save<br />
</div><br />';
$sql = 'SELECT * FROM `' . _DB_PREFIX_ . 'product_lang`
WHERE `link_rewrite`
IN (SELECT `link_rewrite` FROM `' . _DB_PREFIX_ . 'product_lang`
GROUP BY `link_rewrite`, `id_lang`
HAVING count(`link_rewrite`) > 1)';
if (Shop::isFeatureActive() && Shop::getContext() == Shop::CONTEXT_SHOP) {
$sql .= ' AND `id_shop` = ' . (int) Shop::getContextShopID();
}
if ($results = Db::getInstance()->ExecuteS($sql)) {
$output .= 'You need to fix duplicate URL entries<br/>';
foreach ($results as $row) {
$language_info = $this->context->language->getLanguage($row['id_lang']);
$output .= $row['name'] . ' (' . $row['id_product'] . ') - ' . $row['link_rewrite'] . '<br/>';
$shop_info = $this->context->shop->getShop($language_info['id_shop']);
$output .= 'Language:' . $language_info['name'] . '<br /> Shop:' . $shop_info['name'] . '<br/><br/>';
}
} else {
$output .= 'Nice you don\'t have any duplicate URL entries.';
}
return $output;
}
示例10: getLogo
/**
* Returns the invoice logo
*
* @return String Logo path
*/
protected function getLogo()
{
$logo = '';
if (Configuration::get('PS_LOGO_INVOICE', null, null, (int) Shop::getContextShopID()) != false && file_exists(_PS_IMG_DIR_ . Configuration::get('PS_LOGO_INVOICE', null, null, (int) Shop::getContextShopID()))) {
$logo = _PS_IMG_DIR_ . Configuration::get('PS_LOGO_INVOICE', null, null, (int) Shop::getContextShopID());
} elseif (Configuration::get('PS_LOGO', null, null, (int) Shop::getContextShopID()) != false && file_exists(_PS_IMG_DIR_ . Configuration::get('PS_LOGO', null, null, (int) Shop::getContextShopID()))) {
$logo = _PS_IMG_DIR_ . Configuration::get('PS_LOGO', null, null, (int) Shop::getContextShopID());
}
return $logo;
}
示例11: __construct
public function __construct()
{
// Get current id_shop context
$this->context_id_shop_prev = Shop::getContextShopID();
// Set id_shop context to 'CONTEXT_ALL'
// $this->setContext();
$this->name = 'mobassistantconnector';
$this->tab = 'mobile';
$this->version = '1.2.13';
$this->author = 'eMagicOne';
$this->module_key = 'c0b8b5438c3e54ae5f47df2d8da43907';
$this->need_instance = 0;
$this->is_configurable = 1;
$this->bootstrap = true;
$this->cart_version = Configuration::get('PS_INSTALL_VERSION');
$this->def_shop = Configuration::get('PS_SHOP_DEFAULT');
// Initialize logger
$this->file_logger = new FileLoggerMob();
$this->file_logger->setFilename(_PS_MODULE_DIR_ . $this->name . '/log/' . self::LOG_FILENAME);
if (version_compare($this->cart_version, '1.6.0.4', '=')) {
$this->ps_versions_compliancy = array('min' => '1.5.1', 'max' => '1.7');
} else {
$this->ps_versions_compliancy = array('min' => '1.5.1', 'max' => '1.6');
}
parent::__construct();
$this->displayName = $this->l('Mobile Assistant Connector');
$this->description = $this->l("Feel stressed leaving your Prestashop store off-hand during your vacation, meetings or conferences?\n\t\t\tAre you carrying laptop everywhere you go, repeatedly searching the answer for bothering question in your mind - 'What’s going on at my store?'\n\t\t\tWith Prestashop Mobile Assistant on you can be on the move and have access to the real-time store data reports at your fingertips.\n\t\t\tUsing it you can monitor key details on your products, customers and orders from your Android device wherever you are.");
$this->database_version_cur = $this->getDatabaseVersion();
if ($this->database_version_cur) {
// Update module version in database
if (version_compare($this->database_version_cur, $this->version, '<')) {
self::upgradeModuleVersion($this->name, $this->version);
$this->_generateConfigXml();
}
if (version_compare($this->database_version_cur, '1.2.0', '=')) {
$this->dropOldTables();
}
// Create additional tables
if (version_compare($this->database_version_cur, '1.2.1', '<')) {
$this->createTables();
$this->movePushDevices();
}
if (version_compare($this->database_version_cur, '1.2.0', '>') && version_compare($this->database_version_cur, '1.2.5', '<')) {
$this->changeTableDevices();
}
}
$this->confirmUninstall = $this->l('Are you sure you want to uninstall?');
if (!Configuration::get('MOBASSISTANTCONNECTOR')) {
$this->warning = $this->l('No name provided');
}
}
示例12: init
public function init()
{
if ($category_rewrite = Tools::getValue('category_rewrite')) {
$sql = 'SELECT `id_category` FROM `' . _DB_PREFIX_ . 'category_lang`
WHERE `link_rewrite` = \'' . pSQL(str_replace('.html', '', $category_rewrite)) . '\' AND `id_lang` = ' . Context::getContext()->language->id;
if (Shop::isFeatureActive() && Shop::getContext() == Shop::CONTEXT_SHOP) {
$sql .= ' AND `id_shop` = ' . (int) Shop::getContextShopID();
}
$id_category = (int) Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
if ($id_category > 0) {
$_GET['id_category'] = $id_category;
}
}
parent::init();
}
示例13: init
public function init()
{
if (Tools::getValue('category_rewrite')) {
// SQL safe?
$category_rewrite = Tools::getValue('category_rewrite');
$sql = 'SELECT `id_category` FROM `' . _DB_PREFIX_ . 'category_lang`
WHERE `link_rewrite` = \'' . $category_rewrite . '\' AND `id_lang` = ' . Context::getContext()->language->id;
if (Shop::isFeatureActive() && Shop::getContext() == Shop::CONTEXT_SHOP) {
$sql .= ' AND `id_shop` = ' . (int) Shop::getContextShopID();
}
$categorys_list = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
$categorys_count = count($categorys_list);
if ($categorys_count == 1) {
// Found ONLY one so dont need to look for parent
$id_category = (int) $categorys_list[0]['id_category'];
$_GET['noredirect'] = TRUE;
} else {
if ($categorys_count > 1) {
// Found more than one so look for parent
// SQL safe?
$parent_rewrite = Tools::getValue('categories_rewrite');
$shop_id = (int) Shop::getContextShopID();
$sql = 'SELECT c.`id_category`
FROM `ps_category` c
LEFT JOIN `ps_category_lang` cl ON (c.`id_category` = cl.`id_category` AND cl.id_shop = ' . $shop_id . ' )
INNER JOIN ps_category_shop category_shop ON (category_shop.id_category = c.id_category AND category_shop.id_shop = ' . $shop_id . ')
LEFT JOIN `ps_category_lang` clp ON (c.`id_parent` = clp.`id_category`)
WHERE cl.`link_rewrite` = \'' . $category_rewrite . '\'
AND clp.`link_rewrite` = \'' . $parent_rewrite . '\'
AND cl.`id_lang` = ' . Context::getContext()->language->id;
$id_category = (int) Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
$_GET['noredirect'] = TRUE;
} else {
// none found
$id_category = 0;
}
}
if ($id_category > 0) {
$_GET['id_category'] = $id_category;
} else {
//TODO: Do we need to send 404?
header('HTTP/1.1 404 Not Found');
header('Status: 404 Not Found');
}
}
parent::init();
}
示例14: init
public function init()
{
if ($supplier_rewrite = Tools::getValue('supplier_rewrite')) {
$sql = 'SELECT sp.`id_supplier`
FROM `' . _DB_PREFIX_ . 'supplier` sp
LEFT JOIN `' . _DB_PREFIX_ . 'supplier_shop` s ON (sp.`id_supplier` = s.`id_supplier`)
WHERE sp.`name` LIKE \'' . pSQL(str_replace('-', '%', $supplier_rewrite)) . '\'';
if (Shop::isFeatureActive() && Shop::getContext() == Shop::CONTEXT_SHOP) {
$sql .= ' AND s.`id_shop` = ' . (int) Shop::getContextShopID();
}
$id_supplier = (int) Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
if ($id_supplier > 0) {
$_GET['id_supplier'] = $id_supplier;
}
}
parent::init();
}
示例15: init
public function init()
{
if ($manufacturer_rewrite = Tools::getValue('manufacturer_rewrite')) {
$manufacturer_rewrite = str_replace('-', '%', $manufacturer_rewrite);
$sql = 'SELECT m.`id_manufacturer`
FROM `' . _DB_PREFIX_ . 'manufacturer` m
LEFT JOIN `' . _DB_PREFIX_ . 'manufacturer_shop` s ON (m.`id_manufacturer` = s.`id_manufacturer`)
WHERE m.`name` LIKE \'' . pSQL($manufacturer_rewrite) . '\'';
if (Shop::isFeatureActive() && Shop::getContext() == Shop::CONTEXT_SHOP) {
$sql .= ' AND s.`id_shop` = ' . (int) Shop::getContextShopID();
}
$id_manufacturer = (int) Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
if ($id_manufacturer > 0) {
$_GET['id_manufacturer'] = $id_manufacturer;
$_GET['noredirect'] = 1;
}
}
parent::init();
}