本文整理汇总了PHP中hikashop_table函数的典型用法代码示例。如果您正苦于以下问题:PHP hikashop_table函数的具体用法?PHP hikashop_table怎么用?PHP hikashop_table使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了hikashop_table函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkToken
public function checkToken($data)
{
if (empty($data['user']) || empty($data['token'])) {
return false;
}
$db = JFactory::getDBO();
$query = 'SELECT * FROM ' . hikashop_table('user') . ' WHERE user_email = ' . $db->Quote($data['user']);
$db->setQuery($query);
$hkUser = $db->loadObject();
if (empty($hkUser)) {
return false;
}
$api_salt = $this->getSalt();
$token_frame = $this->getTokenFrame();
$timestamp = time();
$timestamp -= $timestamp % 60;
$timestamp -= $timestamp % (60 * $token_frame);
$token = sha1((int) $hkUser->user_id . '#' . (int) $hkUser->user_cms_id . '#' . (int) $hkUser->user_created . '#' . date('dmY:Hi', $timestamp) . '#' . $api_salt);
$previous_token = sha1((int) $hkUser->user_id . '#' . (int) $hkUser->user_cms_id . '#' . (int) $hkUser->user_created . '#' . date('dmY:Hi', $timestamp - $token_frame * 60) . '#' . $api_salt);
if ($data['token'] == $token || $data['token'] == $previous_token) {
$this->setHeader('token', $token);
$app = JFactory::getApplication();
$app->setUserState(HIKASHOP_COMPONENT . '.user_id', $hkUser->user_id);
if ((int) $hkUser->user_cms_id > 0) {
$user = JFactory::getUser((int) $hkUser->user_cms_id);
JFactory::getSession()->set('user', $user);
} else {
JFactory::getSession()->set('user', null);
}
return true;
}
return false;
}
示例2: addColumns
function addColumns($table, $columns)
{
if (!is_array($columns)) {
$columns = array($columns);
}
$query = 'ALTER TABLE `' . hikashop_table($table) . '` ADD ' . implode(', ADD', $columns) . ';';
$this->db->setQuery($query);
$err = false;
try {
$this->db->query();
} catch (Exception $e) {
$err = true;
}
if (!$err) {
return true;
}
if ($err && count($columns) > 1) {
foreach ($columns as $col) {
$query = 'ALTER TABLE `' . hikashop_table($table) . '` ADD ' . $col . ';';
$this->db->setQuery($query);
$err = 0;
try {
$this->db->query();
} catch (Exception $e) {
$err++;
}
}
if ($err < count($columns)) {
return true;
}
}
return false;
}
示例3: checkProducts
function checkProducts()
{
$db = JFactory::getDBO();
$query = 'SELECT * FROM ' . hikashop_table('product') . ' WHERE ' . ' product_quantity < ' . (int) $this->stock_limit . ' AND product_published = 1 AND product_quantity != -1 ' . ' AND (product_sale_start = 0 OR product_sale_start < ' . time() . ') AND (product_sale_end = 0 OR product_sale_end > ' . time() . ')';
$db->setQuery($query);
$products = $db->loadObjectList();
if (!empty($products)) {
$mailClass = hikashop_get('class.mail');
$infos = new stdClass();
$infos->products =& $products;
$mail = $mailClass->get('out_of_stock', $infos);
$mail->subject = JText::sprintf($mail->subject, HIKASHOP_LIVE);
$config =& hikashop_config();
if (!empty($infos->email)) {
$mail->dst_email = $infos->email;
} else {
$mail->dst_email = $config->get('from_email');
}
if (!empty($infos->name)) {
$mail->dst_name = $infos->name;
} else {
$mail->dst_name = $config->get('from_name');
}
$mailClass->sendMail($mail);
}
$app = JFactory::getApplication();
$this->message = 'Products quantity checked';
$app->enqueueMessage($this->message);
return true;
}
示例4: checkOrders
function checkOrders($notify = false)
{
$db = JFactory::getDBO();
$config =& hikashop_config();
$status = $config->get('order_created_status');
$query = 'SELECT order_id, order_status, order_created FROM ' . hikashop_table('order') . ' WHERE order_type = ' . $db->Quote('sale') . ' AND order_created < ' . (time() - $this->period) . ' AND order_status = ' . $db->Quote($status) . ' ORDER BY order_created ASC LIMIT 0, 20';
$db->setQuery($query);
$orders = $db->loadObjectList();
if (!empty($orders)) {
$orderClass = hikashop_get('class.order');
$status = $config->get('cancelled_order_status');
$statuses = explode(',', $status);
$status = reset($statuses);
foreach ($orders as $order) {
$update = new stdClass();
$update->order_id = $order->order_id;
$update->order_status = $status;
if ($notify) {
$update->history = new stdClass();
$update->history->history_notified = 1;
}
$orderClass->save($update);
}
}
$app = JFactory::getApplication();
$this->message = 'Orders checked';
$app->enqueueMessage($this->message);
return true;
}
示例5: listing
function listing()
{
$app = JFactory::getApplication();
$database = JFactory::getDBO();
$toggleClass = hikashop_get('helper.toggle');
$this->assignRef('toggleClass', $toggleClass);
$pageInfo = $this->getPageInfo('a.warehouse_id');
$filters = array();
$order = '';
$searchMap = array('a.warehouse_id', 'a.warehouse_name', 'a.warehouse_description');
$this->processFilters($filters, $order, $searchMap);
$query = ' FROM ' . hikashop_table('warehouse') . ' AS a' . $filters . $order;
$this->getPageInfoTotal($query, '*');
$database->setQuery('SELECT a.*' . $query, $pageInfo->limit->start, $pageInfo->limit->value);
$rows = $database->loadObjectList();
if (!empty($pageInfo->search)) {
$rows = hikashop_search($pageInfo->search, $rows, 'warehouse_id');
}
$database->setQuery('SELECT count(*)' . $query);
$pageInfo->elements->page = count($rows);
$toggleClass = hikashop_get('helper.toggle');
$this->assignRef('toggleClass', $toggleClass);
$this->assignRef('rows', $rows);
$this->assignRef('pageInfo', $pageInfo);
$this->getPagination();
$this->getOrdering('a.warehouse_ordering', true);
$this->assignRef('order', $order);
hikashop_setTitle(JText::_($this->nameListing), $this->icon, $this->ctrl);
$config =& hikashop_config();
$manage = hikashop_isAllowed($config->get('acl_warehouse_manage', 'all'));
$this->assignRef('manage', $manage);
$this->toolbar = array(array('name' => 'addNew', 'display' => $manage), array('name' => 'editList', 'display' => $manage), array('name' => 'deleteList', 'check' => JText::_('HIKA_VALIDDELETEITEMS'), 'display' => hikashop_isAllowed($config->get('acl_warehouse_delete', 'all'))), '|', array('name' => 'pophelp', 'target' => $this->ctrl . '-listing'), 'dashboard');
}
示例6: delete
function delete(&$ids)
{
foreach ($ids as $k => $id) {
$ids[$k] = $this->database->Quote($id);
}
$query = 'DELETE FROM ' . hikashop_table('tax') . ' WHERE tax_namekey IN (' . implode(',', $ids) . ')';
$this->database->setQuery($query);
return $this->database->query();
}
示例7: getTable
function getTable()
{
$trans_table = 'jf_content';
$translationHelper = hikashop_get('helper.translation');
$translationHelper->isMulti();
if ($translationHelper->falang) {
$trans_table = 'falang_content';
}
return hikashop_table($trans_table, false);
}
示例8: load
function load()
{
$query = 'SELECT * FROM ' . hikashop_table('characteristic') . ' WHERE characteristic_parent_id=0';
$database = JFactory::getDBO();
$database->setQuery($query);
$object = $database->loadObjectList();
$this->values = array();
foreach ($object as $val) {
$this->values[] = JHTML::_('select.option', $val->characteristic_id, $val->characteristic_value);
}
}
示例9: save
function save(&$element, $reorder = true)
{
JPluginHelper::importPlugin('hikashop');
$dispatcher = JDispatcher::getInstance();
$do = true;
if (empty($element->shipping_id)) {
$dispatcher->trigger('onBeforeHikaPluginCreate', array('shipping', &$element, &$do));
} else {
$dispatcher->trigger('onBeforeHikaPluginUpdate', array('shipping', &$element, &$do));
}
if (!$do) {
return false;
}
if (isset($element->shipping_params) && !is_string($element->shipping_params)) {
$element->shipping_params = serialize($element->shipping_params);
}
if (isset($element->shipping_currency) && is_array($element->shipping_currency)) {
$element->shipping_currency = implode(",", $element->shipping_currency);
if (!empty($element->shipping_currency)) {
$element->shipping_currency = ',' . $element->shipping_currency . ',';
}
}
$status = parent::save($element);
if ($status) {
$this->get('reset_cache');
}
if ($status && empty($element->shipping_id)) {
$element->shipping_id = $status;
if ($reorder) {
$orderClass = hikashop_get('helper.order');
$orderClass->pkey = 'shipping_id';
$orderClass->table = 'shipping';
$orderClass->groupMap = 'shipping_type';
$orderClass->groupVal = $element->shipping_type;
$orderClass->orderingMap = 'shipping_ordering';
$orderClass->reOrder();
}
}
if ($status && !empty($element->shipping_published) && !empty($element->shipping_id)) {
$db = JFactory::getDBO();
$query = 'SELECT shipping_type FROM ' . hikashop_table('shipping') . ' WHERE shipping_id = ' . (int) $element->shipping_id;
$db->setQuery($query);
$name = $db->loadResult();
if (!HIKASHOP_J16) {
$query = 'UPDATE ' . hikashop_table('plugins', false) . ' SET published = 1 WHERE published = 0 AND element = ' . $db->Quote($name) . ' AND folder = ' . $db->Quote('hikashopshipping');
} else {
$query = 'UPDATE ' . hikashop_table('extensions', false) . ' SET enabled = 1 WHERE enabled = 0 AND type = ' . $db->Quote('plugin') . ' AND element = ' . $db->Quote($name) . ' AND folder = ' . $db->Quote('hikashopshipping');
}
$db->setQuery($query);
$db->query();
}
return $status;
}
示例10: load
function load($value)
{
$this->values = array();
$db = JFactory::getDBO();
$query = 'SELECT * FROM ' . hikashop_table('user') . ' WHERE user_partner_activated = 1 OR user_id=' . $db->Quote($value);
$db->setQuery($query);
$partners = $db->loadObjectList();
if (!empty($partners)) {
foreach ($partners as $partner) {
$this->values[] = JHTML::_('select.option', $partner->user_id, $partner->user_id . ' ' . $partner->user_partner_email);
}
}
}
示例11: load
function load($value)
{
$this->values = array();
$query = 'SELECT user_id,user_email FROM ' . hikashop_table('user');
$db = JFactory::getDBO();
$db->setQuery($query);
$users = $db->loadObjectList('user_id');
if (!empty($users)) {
foreach ($users as $user) {
$this->values[] = JHTML::_('select.option', (int) $user->user_id, $user->user_email . ' ' . $user->user_id);
}
}
}
示例12: wizard
function wizard()
{
$db = JFactory::getDBO();
hikashop_setTitle(JText::_('HIKA_WIZARD'), 'config', 'update&task=wizard');
if (!HIKASHOP_PHP5) {
$bar =& JToolBar::getInstance('toolbar');
} else {
$bar = JToolBar::getInstance('toolbar');
}
$bar->appendButton('Link', 'hikashop', JText::_('HIKA_SKIP'), hikashop_completeLink('update&task=post_install&fromversion=&update=0'));
$languagesCodes = array();
$languagesNames = array();
if (HIKASHOP_J25) {
$db->setQuery('SELECT * FROM ' . hikashop_table('languages', false) . ' WHERE `published` = 1');
$languages = $db->loadObjectList();
foreach ($languages as $language) {
$path = JLanguage::getLanguagePath(JPATH_ROOT) . DS . $language->lang_code . DS . $language->lang_code . '.com_hikashop.ini';
if (!JFile::exists($path)) {
$languagesCodes[] = $language->lang_code;
$languagesNames[] = $language->title;
}
}
}
if (!empty($languagesCodes)) {
$languageCodes = implode('_', $languagesCodes);
}
if (!empty($languagesNames)) {
$languagesNames = implode(', ', $languagesNames);
}
$this->assignRef('languageCodes', $languageCodes);
$this->assignRef('languageNames', $languagesNames);
$fieldsClass = hikashop_get('class.field');
$this->assignRef('fieldsClass', $fieldsClass);
static $Itemid;
if (isset($Itemid) && !empty($Itemid)) {
$url_itemid = '&item_id=' . $Itemid;
} else {
$url_itemid = '';
}
$address = new stdClass();
$extraFields = array();
$extraFields['address'] = $fieldsClass->getFields('frontcomp', $address, 'address', 'update&task=state' . $url_itemid);
$this->assignRef('extraFields', $extraFields);
$this->assignRef('address', $address);
$db->setQuery('SELECT * FROM ' . hikashop_table('currency') . ' WHERE 1 ORDER BY `currency_code`');
$currencies = $db->loadObjectList();
$this->assignRef('currencies', $currencies);
hikashop_loadJslib('jquery');
$app = JFactory::getApplication();
$app->enqueueMessage(JText::_('WELCOME_WIZARD', 'success'));
}
示例13: load
function load($type, $value = '', $inherit = true)
{
$filter = false;
if ($type == 'product_filter') {
$type = 'product';
$filter = true;
}
if (substr($type, 0, 1) != '#') {
$query = 'SELECT * FROM ' . hikashop_table($type);
} else {
$query = 'SELECT * FROM ' . hikashop_table(substr($type, 2), false);
}
$database = JFactory::getDBO();
$database->setQuery($query, 0, 1);
$arr = $database->loadAssoc();
$object = new stdClass();
if (!empty($arr)) {
if (!is_array($value) && !isset($arr[$value]) && !in_array($value, array('ordering', 'inherit'))) {
$arr[$value] = $value;
}
ksort($arr);
foreach ($arr as $key => $value) {
if (!empty($key)) {
$object->{$key} = $value;
}
}
}
$this->values = array();
if ($type == 'product') {
if (!$filter) {
$this->values['ordering'] = JHTML::_('select.option', 'ordering', JText::_('ORDERING'));
} else {
$this->values['all'] = JHTML::_('select.option', 'all', 'all');
}
}
if (!empty($object)) {
foreach (get_object_vars($object) as $key => $val) {
$this->values[$key] = JHTML::_('select.option', $key, $key);
}
if (JRequest::getCmd('from_display', false) == false && $inherit) {
$config = hikashop_config();
$defaultParams = $config->get('default_params');
$default = '';
if (isset($defaultParams['product_order']) && isset($this->values[$defaultParams['product_order']])) {
$default = ' (' . $this->values[$defaultParams['product_order']]->text . ')';
}
$this->values[] = JHTML::_('select.option', 'inherit', JText::_('HIKA_INHERIT') . $default);
}
}
}
示例14: onAfterOrderDelete
function onAfterOrderDelete($elements)
{
if (!is_array($elements)) {
$elements = array($elements);
}
$database = JFactory::getDBO();
foreach ($elements as $key => $val) {
$elements[$key] = $database->Quote($val);
}
$query = 'DELETE FROM ' . hikashop_table('history') . ' WHERE history_order_id IN (' . implode(',', $elements) . ')';
$database->setQuery($query);
$database->query();
return true;
}
示例15: load
function load($form)
{
$this->values = array();
$query = 'SELECT * FROM ' . hikashop_table('tax');
$db = JFactory::getDBO();
$db->setQuery($query);
$this->results = $db->loadObjectList();
if (!$form) {
$this->values[] = JHTML::_('select.option', '', JText::_('ALL_RATES'));
}
foreach ($this->results as $result) {
$this->values[] = JHTML::_('select.option', $result->tax_namekey, $result->tax_namekey . ' (' . $result->tax_rate * 100.0 . '%)');
}
}