本文整理汇总了PHP中pSQL函数的典型用法代码示例。如果您正苦于以下问题:PHP pSQL函数的具体用法?PHP pSQL怎么用?PHP pSQL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pSQL函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getTranslationsFieldsChild
/**
* Check then return multilingual fields for database interaction
*
* @return array Multilingual fields
*/
public function getTranslationsFieldsChild()
{
parent::validateFieldsLang();
$fieldsArray = array('title', 'url');
$fields = array();
$languages = Language::getLanguages(false);
$defaultLanguage = (int) Configuration::get('PS_LANG_DEFAULT');
foreach ($languages as $language) {
$fields[$language['id_lang']]['id_lang'] = (int) $language['id_lang'];
$fields[$language['id_lang']][self::$definition['primary']] = (int) $this->id;
foreach ($fieldsArray as $field) {
if (!Validate::isTableOrIdentifier($field)) {
die(Tools::displayError());
}
if (isset($this->{$field}[$language['id_lang']]) and !empty($this->{$field}[$language['id_lang']])) {
$fields[$language['id_lang']][$field] = pSQL($this->{$field}[$language['id_lang']], true);
} elseif (in_array($field, $this->fieldsRequiredLang)) {
$fields[$language['id_lang']][$field] = pSQL($this->{$field}[$defaultLanguage], true);
} else {
$fields[$language['id_lang']][$field] = '';
}
}
}
return $fields;
}
开发者ID:arozanski,项目名称:simpleresponsivetheme,代码行数:30,代码来源:ResponsiveLinksClass.php
示例2: getFields
public function getFields()
{
parent::validateFields();
$fields['id_lang'] = (int) $this->id_lang;
$fields['name'] = pSQL($this->name);
return $fields;
}
开发者ID:nicolasjeol,项目名称:hec-ecommerce,代码行数:7,代码来源:Tag.php
示例3: add_module_to_hook
function add_module_to_hook($module_name, $hook_name)
{
$res = true;
$id_module = Db::getInstance()->getValue('
SELECT `id_module` FROM `' . _DB_PREFIX_ . 'module`
WHERE `name` = "' . $module_name . '"');
if ((int) $id_module > 0) {
$id_hook = Db::getInstance()->getValue('SELECT `id_hook` FROM `' . _DB_PREFIX_ . 'hook` WHERE `name` = "' . $hook_name . '"');
if (!$id_hook) {
if (!Db::getInstance()->execute('
INSERT IGNORE INTO `' . _DB_PREFIX_ . 'hook` (`name`, `title`)
VALUES ("' . pSQL($hook_name) . '", "' . pSQL($hook_name) . '")')) {
$res = false;
} else {
$id_hook = Db::getInstance()->Insert_ID();
}
}
if ((int) $id_hook > 0) {
if (!Db::getInstance()->execute('
INSERT IGNORE INTO `' . _DB_PREFIX_ . 'hook_module` (`id_module`, `id_hook`, `position`)
VALUES (
' . (int) $id_module . ',
' . (int) $id_hook . ',
(SELECT IFNULL(
(SELECT max_position from (SELECT MAX(position)+1 as max_position FROM `' . _DB_PREFIX_ . 'hook_module` WHERE `id_hook` = ' . (int) $id_hook . ') AS max_position), 1))
)')) {
$res = false;
}
}
}
return $res;
}
开发者ID:toufikadfab,项目名称:PrestaShop-1.5,代码行数:32,代码来源:add_module_to_hook.php
示例4: getFields
public function getFields()
{
parent::validateFields();
$fields['id_country'] = (int) $this->id_country;
$fields['format'] = pSQL($this->format);
return $fields;
}
开发者ID:Evil1991,项目名称:PrestaShop-1.4,代码行数:7,代码来源:AddressFormat.php
示例5: getFields
public function getFields()
{
parent::validateFields();
$fields['server'] = pSQL($this->server);
$fields['getvar'] = pSQL($this->getvar);
return $fields;
}
开发者ID:priyankajsr19,项目名称:indusdiva2,代码行数:7,代码来源:SearchEngine.php
示例6: getFields
public function getFields()
{
parent::validateFields();
$fields['file'] = pSQL($this->file);
$fields['mime'] = pSQL($this->mime);
return $fields;
}
开发者ID:Bruno-2M,项目名称:prestashop,代码行数:7,代码来源:Attachment.php
示例7: add_new_groups
function add_new_groups($french, $standard)
{
$res = Db::getInstance()->execute('INSERT INTO `' . _DB_PREFIX_ . 'group` (`id_group`, `date_add`, `date_upd`) VALUES (NULL, NOW(), NOW())');
$last_id = Db::getInstance()->Insert_ID();
$languages = Db::getInstance()->executeS('SELECT id_lang, iso_code FROM `' . _DB_PREFIX_ . 'lang`');
$sql = '';
foreach ($languages as $lang) {
if (strtolower($lang['iso_code']) == 'fr') {
$sql .= '(' . (int) $last_id . ', ' . (int) $lang['id_lang'] . ', "' . pSQL($french) . '"),';
} else {
$sql .= '(' . (int) $last_id . ', ' . (int) $lang['id_lang'] . ', "' . pSQL($standard) . '"),';
}
}
$sql = substr($sql, 0, strlen($sql) - 1);
$res &= Db::getInstance()->execute('INSERT INTO `' . _DB_PREFIX_ . 'group_lang` (`id_group`, `id_lang`, `name`) VALUES ' . $sql);
// we add the different id_group in the configuration
if (strtolower($standard) == 'visitor') {
$res &= Db::getInstance()->execute('INSERT INTO `' . _DB_PREFIX_ . 'configuration` (`id_configuration`, `name`, `value`, `date_add`, `date_upd`) VALUES (NULL, "PS_UNIDENTIFIED_GROUP", "' . (int) $last_id . '", NOW(), NOW())');
} else {
if (strtolower($standard) == 'guest') {
$res &= Db::getInstance()->execute('INSERT INTO `' . _DB_PREFIX_ . 'configuration` (`id_configuration`, `name`, `value`, `date_add`, `date_upd`) VALUES (NULL, "PS_GUEST_GROUP", "' . (int) $last_id . '", NOW(), NOW())');
} else {
if (strtolower($standard) == 'test') {
$res &= Db::getInstance()->execute('INSERT INTO `' . _DB_PREFIX_ . 'configuration` (`id_configuration`, `name`, `value`, `date_add`, `date_upd`) VALUES (NULL, "PS_TEST", "' . (int) $last_id . '", NOW(), NOW())');
}
}
}
// Add shop association
$res &= Db::getInstance()->execute('INSERT INTO `' . _DB_PREFIX_ . 'group_shop` (`id_group`, `id_shop`) (SELECT ' . (int) $last_id . ', `value` FROM `' . _DB_PREFIX_ . 'configuration` WHERE `name` = \'PS_SHOP_DEFAULT\')');
// Copy categories associations from the group of id 1 (default group for both visitors and customers in version 1.4) to the new group
$res &= Db::getInstance()->execute('INSERT INTO `' . _DB_PREFIX_ . 'category_group` (`id_category`, `id_group`) (SELECT `id_category`, ' . (int) $last_id . ' FROM `' . _DB_PREFIX_ . 'category_group` WHERE `id_group` = 1)');
return $res;
}
开发者ID:dev-lav,项目名称:htdocs,代码行数:33,代码来源:add_new_groups.php
示例8: getGlossaries
/**
* Get all available glossaries
*
* @param integer $id_lang Language id
* @param array $criteria Criterias for where clause
* @param integer $start Start number
* @param integer $limit Number of glossaries to return
* @param string $order_by Field for ordering
* @param string $order_way Way for ordering (ASC or DESC)
* @param boolean $only_active Returns only active glossaries if TRUE
* @param Context|null $context
*
* @return array list of glossaries
*/
public static function getGlossaries($id_lang, $criteria = array(), $start = null, $limit = null, $order_by = null, $order_way = null, $only_active = false, Context $context = null)
{
$where = '';
if (!$context) {
$context = Context::getContext();
}
if ($order_by !== null) {
if (!Validate::isOrderBy($order_by) || !Validate::isOrderWay($order_way)) {
die(Tools::displayError());
}
if ($order_by == 'id') {
$order_by_prefix = 'l';
} else {
$order_by_prefix = 'll';
}
if (strpos($order_by, '.') > 0) {
$order_by = explode('.', $order_by);
$order_by_prefix = $order_by[0];
$order_by = $order_by[1];
}
}
if (isset($criteria['k'])) {
$where .= " AND ll.name LIKE '" . pSQL($criteria['k']) . "%' ";
}
$sql = 'SELECT l.*, ll.*
FROM `' . _DB_PREFIX_ . 'lexikotron` l
LEFT JOIN `' . _DB_PREFIX_ . 'lexikotron_lang` ll ON (l.`id_lexikotron` = ll.`id_lexikotron`)
WHERE ll.`id_lang` = ' . (int) $id_lang . ($only_active ? ' AND l.`active` = 1' : '') . '
' . $where . '
' . ($order_by != null ? 'ORDER BY ' . (isset($order_by_prefix) ? pSQL($order_by_prefix) . '.' : '') . '`' . pSQL($order_by) . '` ' . pSQL($order_way) : '') . ($limit > 0 ? ' LIMIT ' . (int) $start . ',' . (int) $limit : '');
$rows = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
return $rows;
}
开发者ID:xanou,项目名称:lexikotron,代码行数:47,代码来源:Glossary.php
示例9: 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];
}
}
}
}
开发者ID:sho5kubota,项目名称:guidingyou2,代码行数:29,代码来源:BelvgStaticBlocks.php
示例10: addAlert
public static function addAlert($email, $id_product)
{
$res = Db::getInstance()->execute('
INSERT INTO `' . _DB_PREFIX_ . 'stock_alert` (`id_product`, `email`)
VALUES (' . (int) $id_product . ', \'' . pSQL($email) . '\')');
return $res;
}
开发者ID:WhisperingTree,项目名称:etagerca,代码行数:7,代码来源:StockAlert.php
示例11: 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();
}
开发者ID:Barclee,项目名称:zzCleanURLs,代码行数:28,代码来源:CmsController.php
示例12: add_unknown_gender
function add_unknown_gender()
{
$res = true;
// creates the new gender
$id_type = 2;
$res &= Db::getInstance()->execute('
INSERT INTO `' . _DB_PREFIX_ . 'gender` (`type`)
VALUES (' . (int) $id_type . ')');
// retrieves its id
$id_gender = Db::getInstance()->Insert_ID();
// inserts lang values
$languages = Db::getInstance()->executeS('SELECT * FROM `' . _DB_PREFIX_ . 'lang`');
$lang_names = array('en' => 'Unknown', 'de' => 'Unbekannte', 'es' => 'Desconocido', 'fr' => 'Inconnu', 'it' => 'Sconosciuto');
foreach ($languages as $lang) {
$name = isset($lang_names[$lang['iso_code']]) ? $lang_names[$lang['iso_code']] : 'Unknown';
$res &= Db::getInstance()->execute('
INSERT INTO `' . _DB_PREFIX_ . 'gender_lang` (`id_gender`, `id_lang`, `name`) VALUES
(' . (int) $id_gender . ', ' . (int) $lang['id_lang'] . ', \'' . pSQL($name) . '\')');
}
// for all clients where id gender is 0, sets the new id gender
$res &= Db::getInstance()->execute('
UPDATE `' . _DB_PREFIX_ . 'customers`
SET `id_gender` = ' . (int) $id_gender . '
WHERE `id_gender` = 0');
}
开发者ID:prestanesia,项目名称:PrestaShop,代码行数:25,代码来源:add_unknown_gender.php
示例13: getIdByName
/**
* Get a zone ID from its default language name
*
* @return integer id_zone
*/
public static function getIdByName($name)
{
return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
SELECT `id_zone`
FROM `' . _DB_PREFIX_ . 'zone`
WHERE `name` = \'' . pSQL($name) . '\'');
}
开发者ID:Evil1991,项目名称:PrestaShop-1.4,代码行数:12,代码来源:Zone.php
示例14: getForSellerByModuleName
public static function getForSellerByModuleName($module_name, $id_seller)
{
${"GLOBALS"}["zkcagbwt"] = "id_seller";
$gzcdohkbbg = "key";
${"GLOBALS"}["ktsfkx"] = "module_name";
$xigepp = "id_seller";
$ttfaclm = "result";
${"GLOBALS"}["ctufmpefcs"] = "id_seller";
$cgjureyee = "obj";
if (!isset(${${"GLOBALS"}["zkcagbwt"]}) or intval(${$xigepp}) <= 0) {
return false;
}
${${"GLOBALS"}["pqnbriqkmcpj"]} = "\n\t\tSELECT a.* \n\t\tFROM `" . _DB_PREFIX_ . "agile_seller_paymentinfo` a\n\t\tWHERE 1\n\t\t AND a.`module_name` = '" . pSQL(${${"GLOBALS"}["ktsfkx"]}) . "'\n\t\t AND a.`id_seller` = " . pSQL(${${"GLOBALS"}["ctufmpefcs"]}) . "\n\t\t";
${${"GLOBALS"}["plodwcumusd"]} = new AgileSellerPaymentInfo();
${"GLOBALS"}["gsvthjtmecpa"] = "result";
${${"GLOBALS"}["gsvthjtmecpa"]} = Db::getInstance()->getRow(${${"GLOBALS"}["pqnbriqkmcpj"]});
if (!${${"GLOBALS"}["jvynnnsmtb"]}) {
return ${$cgjureyee};
}
${"GLOBALS"}["pmnmlsxn"] = "value";
$obj->id = ${$ttfaclm}[$obj->identifier];
foreach (${${"GLOBALS"}["jvynnnsmtb"]} as ${$gzcdohkbbg} => ${${"GLOBALS"}["pmnmlsxn"]}) {
${"GLOBALS"}["yyqgjlxussf"] = "obj";
$tmxdrdkyc = "value";
if (key_exists(${${"GLOBALS"}["lpbzrpslxl"]}, ${${"GLOBALS"}["yyqgjlxussf"]})) {
$obj->{${${"GLOBALS"}["lpbzrpslxl"]}} = ${$tmxdrdkyc};
}
}
return ${${"GLOBALS"}["plodwcumusd"]};
}
开发者ID:evilscripts,项目名称:gy,代码行数:30,代码来源:AgileSellerPaymentInfo.php
示例15: getProductTaxRate
/**
* Return the product tax
*
* @param integer $id_product
* @param integer $id_address
* @return Tax Rate
*/
public static function getProductTaxRate($id_product, $id_address = null, $getCarrierRate = false)
{
include_once _PS_ROOT_DIR_ . '/modules/avalaratax/avalaratax.php';
/* Instanciate the Avalara module and check if active */
$avalara = new AvalaraTax();
if (!$avalara->active) {
return parent::getProductTaxRate($id_product, $id_address, $getCarrierRate);
}
/* With Avalara, we disable the tax for non logged users */
if (!(int) $id_address) {
return 0.0;
}
$region = Db::getInstance()->getValue('SELECT s.`iso_code`
FROM ' . _DB_PREFIX_ . 'address a
LEFT JOIN ' . _DB_PREFIX_ . 'state s ON (s.`id_state` = a.`id_state`)
WHERE a.`id_address` = ' . (int) $id_address);
/* If the Merchant does not want to calculate taxes outside his state and we are outside the state, we return 0 */
if (!empty($region) && $region != Configuration::get('AVALARATAX_STATE') && !Configuration::get('AVALARATAX_TAX_OUTSIDE')) {
return 0.0;
}
return (double) Db::getInstance()->getValue('SELECT ac.`tax_rate`
FROM ' . _DB_PREFIX_ . 'avalara_' . ($getCarrierRate ? 'carrier' : 'product') . '_cache ac
WHERE ac.`id_' . ($getCarrierRate ? 'carrier' : 'product') . '` = ' . (int) $id_product . '
AND ac.`region` = \'' . pSQL($region) . '\'');
}
开发者ID:ventsiwad,项目名称:presta_addons,代码行数:32,代码来源:Tax.php
示例16: SmartHookInsert
public function SmartHookInsert()
{
$hookvalue = array();
require_once dirname(__FILE__) . '/sql/addhook.php';
foreach ($hookvalue as $hkv) {
$hookid = Hook::getIdByName($hkv['name']);
if (!$hookid) {
$add_hook = new Hook();
$add_hook->name = pSQL($hkv['name']);
$add_hook->title = pSQL($hkv['title']);
$add_hook->description = pSQL($hkv['description']);
$add_hook->position = pSQL($hkv['position']);
$add_hook->live_edit = $hkv['live_edit'];
$add_hook->add();
$hookid = $add_hook->id;
if (!$hookid) {
return false;
}
} else {
$up_hook = new Hook($hookid);
$up_hook->update();
}
}
return true;
}
开发者ID:Beattle,项目名称:perrino-shop,代码行数:25,代码来源:smartblog.php
示例17: install
public function install()
{
// check if the order status is defined
if (!defined('PS_OS_PAYFORT_PENDING')) {
// order status is not defined - check if, it exists in the table
$rq = Db::getInstance()->getRow('
SELECT `id_order_state` FROM `' . _DB_PREFIX_ . 'order_state_lang`
WHERE id_lang = \'' . pSQL('1') . '\' AND name = \'' . pSQL('Pending Payfort Payment') . '\'');
if ($rq && isset($rq['id_order_state']) && intval($rq['id_order_state']) > 0) {
// order status exists in the table - define it.
define('PS_OS_PAYFORT_PENDING', $rq['id_order_state']);
} else {
// order status doesn't exist in the table
// insert it into the table and then define it.
Db::getInstance()->Execute('
INSERT INTO `' . _DB_PREFIX_ . 'order_state` (`unremovable`, `color`) VALUES(1, \'orange\')');
$stateid = Db::getInstance()->Insert_ID();
Db::getInstance()->Execute('INSERT INTO `' . _DB_PREFIX_ . 'order_state_lang` (`id_order_state`, `id_lang`, `name`, `template`)
VALUES(' . intval($stateid) . ', 1, \'Pending Payfort Payment\', \'\')');
define('PS_OS_PAYFORT_PENDING', $stateid);
}
}
return parent::install() && $this->registerHook('orderConfirmation') && $this->registerHook('payment') && $this->registerHook('header') && $this->registerHook('backOfficeHeader') && Configuration::updateValue('PAYFORT_FORT_SANDBOX_MODE', 1) && Configuration::updateValue('PAYFORT_FORT_LANGUAGE', 'en') && Configuration::updateValue('PAYFORT_FORT_COMMAND', 'AUTHORIZATION') && Configuration::updateValue('PAYFORT_HASH_ALGORITHM', 'SHA1') && Configuration::updateValue('PAYFORT_FORT_HOLD_REVIEW_OS', _PS_OS_PAYMENT_) && Configuration::updateValue('PS_OS_PAYFORT_PENDING', PS_OS_PAYFORT_PENDING) && Configuration::updateValue('PAYFORT_FORT_INTEGRATION_TYPE', 'redirection') && Configuration::updateValue('PAYFORT_FORT_DEBUG_MODE', 0) && Configuration::updateValue('PAYFORT_FORT_GATEWAY_CURRENCY', 'base');
}
开发者ID:payfort,项目名称:prestashop-payfort,代码行数:28,代码来源:payfortfort.php
示例18: doSearchProducts
public static function doSearchProducts($searchtext, $idcate, $idlang)
{
$sql = 'SELECT ' . _DB_PREFIX_ . 'product_lang.id_product FROM ' . _DB_PREFIX_ . 'product_lang INNER JOIN ' . _DB_PREFIX_ . 'product ON ' . _DB_PREFIX_ . 'product.id_product = ' . _DB_PREFIX_ . 'product_lang.id_product WHERE (';
if (Configuration::get('TCS_PRODUCT_S_NAME') == 1) {
$sql .= ' name LIKE ' . '"%' . pSQL($searchtext) . '%"';
}
if (Configuration::get('TCS_PRODUCT_S_REF') == 1) {
$sql .= Configuration::get('TCS_PRODUCT_S_NAME') == 1 ? ' OR reference LIKE ' . '"%' . pSQL($searchtext) . '%"' : 'reference LIKE ' . '"%' . pSQL($searchtext) . '%"';
}
if (Configuration::get('TCS_PRODUCT_S_SHORTD') == 1) {
$sql .= (Configuration::get('TCS_PRODUCT_S_NAME') == 1 or Configuration::get('TCS_PRODUCT_S_REF') == 1) ? ' OR description_short LIKE ' . '"%' . pSQL($searchtext) . '%"' : 'description_short LIKE ' . '"%' . pSQL($searchtext) . '%"';
}
if (Configuration::get('TCS_PRODUCT_S_DES') == 1) {
$sql .= (Configuration::get('TCS_PRODUCT_S_NAME') == 1 or Configuration::get('TCS_PRODUCT_S_REF') == 1 or Configuration::get('TCS_PRODUCT_S_SHORTD') == 1) ? ' OR description LIKE ' . '"%' . pSQL($searchtext) . '%"' : 'description LIKE ' . '"%' . pSQL($searchtext) . '%"';
}
$sql .= ' ) AND id_lang =' . (int) $idlang;
if ($idcate != 'All') {
$sql .= ' AND id_category_default =' . (int) $idcate;
}
if (Configuration::get('TCS_PRODUCT_S_SUP') == 1) {
if (Configuration::get('TCS_PRODUCT_S_NAME') == 1 or Configuration::get('TCS_PRODUCT_S_SHORTD') or Configuration::get('TCS_PRODUCT_S_REF') == 1 or Configuration::get('TCS_PRODUCT_S_DES') == 1) {
$sql .= ' UNION SELECT ' . _DB_PREFIX_ . 'product_lang.id_product FROM ' . _DB_PREFIX_ . 'product INNER JOIN ' . _DB_PREFIX_ . 'product_lang ON ' . _DB_PREFIX_ . 'product_lang.id_product = ' . _DB_PREFIX_ . 'product.id_product INNER JOIN ' . _DB_PREFIX_ . 'supplier ON ' . _DB_PREFIX_ . 'supplier.id_supplier = ' . _DB_PREFIX_ . 'product.id_supplier WHERE ' . _DB_PREFIX_ . 'supplier.name LIKE ' . '"%' . pSQL($searchtext) . '%"';
} else {
$sql = 'SELECT ' . _DB_PREFIX_ . 'product_lang.id_product FROM ' . _DB_PREFIX_ . 'product INNER JOIN ' . _DB_PREFIX_ . 'product_lang ON ' . _DB_PREFIX_ . 'product_lang.id_product = ' . _DB_PREFIX_ . 'product.id_product INNER JOIN ' . _DB_PREFIX_ . 'supplier ON ' . _DB_PREFIX_ . 'supplier.id_supplier = ' . _DB_PREFIX_ . 'product.id_supplier WHERE ' . _DB_PREFIX_ . 'supplier.name LIKE ' . '"%' . pSQL($searchtext) . '%"';
}
}
if (Configuration::get('TCS_PRODUCT_S_MAN') == 1) {
if (Configuration::get('TCS_PRODUCT_S_NAME') == 1 or Configuration::get('TCS_PRODUCT_S_REF') == 1 or Configuration::get('TCS_PRODUCT_S_SHORTD') == 1 or Configuration::get('TCS_PRODUCT_S_DES') == 1 or Configuration::get('TCS_PRODUCT_S_SUP') == 1) {
$sql .= ' UNION SELECT ' . _DB_PREFIX_ . 'product_lang.id_product FROM ' . _DB_PREFIX_ . 'product INNER JOIN ' . _DB_PREFIX_ . 'product_lang ON ' . _DB_PREFIX_ . 'product_lang.id_product = ' . _DB_PREFIX_ . 'product.id_product INNER JOIN ' . _DB_PREFIX_ . 'manufacturer ON ' . _DB_PREFIX_ . 'manufacturer.id_manufacturer = ' . _DB_PREFIX_ . 'product.id_manufacturer WHERE ' . _DB_PREFIX_ . 'manufacturer.name LIKE ' . '"%' . pSQL($searchtext) . '%"';
} else {
$sql = 'SELECT ' . _DB_PREFIX_ . 'product_lang.id_product FROM ' . _DB_PREFIX_ . 'product INNER JOIN ' . _DB_PREFIX_ . 'product_lang ON ' . _DB_PREFIX_ . 'product_lang.id_product = ' . _DB_PREFIX_ . 'product.id_product INNER JOIN ' . _DB_PREFIX_ . 'manufacturer ON ' . _DB_PREFIX_ . 'manufacturer.id_manufacturer = ' . _DB_PREFIX_ . 'product.id_manufacturer WHERE ' . _DB_PREFIX_ . 'manufacturer.name LIKE ' . '"%' . pSQL($searchtext) . '%"';
}
}
return Db::getInstance()->executeS($sql);
}
开发者ID:Deparagon,项目名称:Instant-Search-Suggestion-Module,代码行数:35,代码来源:BaseSearcher.php
示例19: getFields
public function getFields()
{
parent::validateFields();
$fields['id_attribute_group'] = intval($this->id_attribute_group);
$fields['color'] = pSQL($this->color);
return $fields;
}
开发者ID:vincent,项目名称:theinvertebrates,代码行数:7,代码来源:Attribute.php
示例20: add_order_state
function add_order_state($conf_name, $name, $invoice, $send_email, $color, $unremovable, $logable, $delivery, $template = null)
{
$name_lang = array();
$template_lang = array();
foreach (explode('|', $name) as $item) {
$temp = explode(':', $item);
$name_lang[$temp[0]] = $temp[1];
}
if ($template) {
foreach (explode('|', $template) as $item) {
$temp = explode(':', $item);
$template_lang[$temp[0]] = $temp[1];
}
}
Db::getInstance()->Execute('
INSERT INTO `' . _DB_PREFIX_ . 'order_state` (`invoice`, `send_email`, `color`, `unremovable`, `logable`, `delivery`)
VALUES (' . (int) $invoice . ', ' . (int) $send_email . ', \'' . pSQL($color) . '\', ' . (int) $unremovable . ', ' . (int) $logable . ', ' . (int) $delivery . ')');
$id_order_state = Db::getInstance()->getValue('
SELECT MAX(`id_order_state`)
FROM `' . _DB_PREFIX_ . 'order_state`
');
foreach (Language::getLanguages() as $lang) {
Db::getInstance()->Execute('
INSERT IGNORE INTO `' . _DB_PREFIX_ . 'order_state_lang` (`id_lang`, `id_order_state`, `name`, `template`)
VALUES (' . (int) $lang['id_lang'] . ', ' . (int) $id_order_state . ', \'' . pSQL(isset($name_lang[$lang['iso_code']]) ? $name_lang[$lang['iso_code']] : $name_lang['en']) . '\', \'' . pSQL(isset($template_lang[$lang['iso_code']]) ? $template_lang[$lang['iso_code']] : (isset($template_lang['en']) ? $template_lang['en'] : '')) . '\')
');
}
Configuration::updateValue($conf_name, $id_order_state);
}
开发者ID:srikanthash09,项目名称:codetestdatld,代码行数:29,代码来源:add_order_state.php
注:本文中的pSQL函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论