本文整理汇总了PHP中hikashop_level函数的典型用法代码示例。如果您正苦于以下问题:PHP hikashop_level函数的具体用法?PHP hikashop_level怎么用?PHP hikashop_level使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了hikashop_level函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: load
function load($form = false)
{
$this->values = array();
if (!$form) {
$this->values[] = JHTML::_('select.option', '', JText::_('HIKA_ALL'));
}
$this->values[] = JHTML::_('select.option', 'address', JText::_('ADDRESS'));
if (hikashop_level(1)) {
$this->values[] = JHTML::_('select.option', 'user', JText::_('HIKA_USER'));
$this->values[] = JHTML::_('select.option', 'product', JText::_('PRODUCT'));
$this->values[] = JHTML::_('select.option', 'category', JText::_('CATEGORY'));
$this->values[] = JHTML::_('select.option', 'contact', JText::_('HIKA_CONTACT'));
if (hikashop_level(2)) {
$this->values[] = JHTML::_('select.option', 'order', JText::_('HIKASHOP_ORDER'));
$this->values[] = JHTML::_('select.option', 'item', JText::_('HIKASHOP_ITEM'));
$this->values[] = JHTML::_('select.option', 'entry', JText::_('HIKASHOP_ENTRY'));
}
if ($this->externalValues == null) {
$this->externalValues = array();
JPluginHelper::importPlugin('hikashop');
$dispatcher = JDispatcher::getInstance();
$dispatcher->trigger('onTableFieldsLoad', array(&$this->externalValues));
foreach ($this->externalValues as $externalValue) {
if (!empty($externalValue->table) && substr($externalValue->value, 0, 4) != 'plg.') {
$externalValue->value = 'plg.' . $externalValue->value;
}
$this->values[] = JHTML::_('select.option', $externalValue->value, $externalValue->text);
}
}
}
}
示例2: isMulti
function isMulti($inConfig = false, $level = true)
{
static $multi = array();
static $falang = false;
$this->falang =& $falang;
$key = (int) $inConfig . '_' . (int) $level;
if (!isset($multi[$key])) {
$multi[$key] = false;
$config =& hikashop_config();
if ((hikashop_level(1) || !$level) && ($config->get('multi_language_edit', 1) || $inConfig)) {
$oldQuery = $this->database->getQuery(false);
$query = 'SHOW TABLES LIKE ' . $this->database->Quote($this->database->getPrefix() . substr(hikashop_table('falang_content', false), 3));
$this->database->setQuery($query);
$table = $this->database->loadResult();
if (!empty($table)) {
$falang = true;
$multi[$key] = true;
} else {
$query = 'SHOW TABLES LIKE ' . $this->database->Quote($this->database->getPrefix() . substr(hikashop_table('jf_content', false), 3));
$this->database->setQuery($query);
$table = $this->database->loadResult();
if (!empty($table)) {
$multi[$key] = true;
}
}
$this->database->setQuery($oldQuery);
}
}
return $multi[$key];
}
示例3: chkHikashopLevel
/**
*
*/
private function chkHikashopLevel()
{
if (function_exists('hikashop_level')) {
return hikashop_level(1);
}
return false;
}
示例4: listing
function listing()
{
$app = JFactory::getApplication();
$pageInfo = new stdClass();
$pageInfo->filter = new stdClass();
$pageInfo->filter->order = new stdClass();
$pageInfo->limit = new stdClass();
$pageInfo->filter->order->value = $app->getUserStateFromRequest($this->paramBase . ".filter_order", 'filter_order', 'a.currency_id', 'cmd');
$pageInfo->filter->order->dir = $app->getUserStateFromRequest($this->paramBase . ".filter_order_Dir", 'filter_order_Dir', 'asc', 'word');
$pageInfo->limit->value = $app->getUserStateFromRequest($this->paramBase . '.list_limit', 'limit', $app->getCfg('list_limit'), 'int');
if (JRequest::getVar('search') != $app->getUserState($this->paramBase . ".search")) {
$app->setUserState($this->paramBase . '.limitstart', 0);
$pageInfo->limit->start = 0;
} else {
$pageInfo->limit->start = $app->getUserStateFromRequest($this->paramBase . '.limitstart', 'limitstart', 0, 'int');
}
$pageInfo->search = $app->getUserStateFromRequest($this->paramBase . ".search", 'search', '', 'string');
$pageInfo->search = JString::strtolower(trim($pageInfo->search));
$database = JFactory::getDBO();
$searchMap = array('a.currency_symbol', 'a.currency_code', 'a.currency_name', 'a.currency_id');
$filters = array();
if (!empty($pageInfo->search)) {
$searchVal = '\'%' . hikashop_getEscaped($pageInfo->search, true) . '%\'';
$filters[] = implode(" LIKE {$searchVal} OR ", $searchMap) . " LIKE {$searchVal}";
}
$query = 'FROM ' . hikashop_table('currency') . ' AS a';
if (!empty($filters)) {
$query .= ' WHERE (' . implode(') AND (', $filters) . ')';
}
if (!empty($pageInfo->filter->order->value)) {
$query .= ' ORDER BY ' . $pageInfo->filter->order->value . ' ' . $pageInfo->filter->order->dir;
}
$database->setQuery('SELECT a.* ' . $query, $pageInfo->limit->start, $pageInfo->limit->value);
$rows = $database->loadObjectList('currency_id');
$currencyClass = hikashop_get('class.currency');
$currencyClass->getCurrencies(null, $rows);
if (!empty($pageInfo->search)) {
$rows = hikashop_search($pageInfo->search, $rows, 'currency_id');
}
$database->setQuery('SELECT count(*) ' . $query);
$pageInfo->elements = new stdClass();
$pageInfo->elements->total = $database->loadResult();
$pageInfo->elements->page = count($rows);
hikashop_setTitle(JText::_($this->nameListing), $this->icon, $this->ctrl);
$config =& hikashop_config();
$manage = hikashop_isAllowed($config->get('acl_currency_manage', 'all'));
$this->assignRef('manage', $manage);
$this->toolbar = array(array('name' => 'confirm', 'check' => false, 'msg' => JText::_('UPDATE_RATES_WARNING'), 'icon' => 'upload', 'alt' => JText::_('UPDATE_RATES'), 'task' => 'update', 'display' => $manage && hikashop_level(2)), array('name' => 'addNew', 'display' => $manage), array('name' => 'editList', 'display' => $manage), array('name' => 'deleteList', 'display' => hikashop_isAllowed($config->get('acl_currency_delete', 'all'))), '|', array('name' => 'pophelp', 'target' => $this->ctrl . '-listing'), 'dashboard');
$toggleClass = hikashop_get('helper.toggle');
$this->assignRef('toggleClass', $toggleClass);
$this->assignRef('currency', $currencyClass);
$this->assignRef('rows', $rows);
$this->assignRef('pageInfo', $pageInfo);
$this->getPagination();
}
示例5: load
function load()
{
$this->values = array();
$this->values[] = JHTML::_('select.option', 'orders', JText::_('ORDERS'));
$this->values[] = JHTML::_('select.option', 'sales', JText::_('SALES'));
$this->values[] = JHTML::_('select.option', 'taxes', JText::_('TAXES'));
$this->values[] = JHTML::_('select.option', 'customers', JText::_('CUSTOMERS'));
if (hikashop_level(2)) {
$this->values[] = JHTML::_('select.option', 'partners', JText::_('PARTNERS'));
}
}
示例6: load
function load()
{
$this->values = array();
$this->values[] = JHTML::_('select.option', 'gauge', JText::_('GAUGE'));
$this->values[] = JHTML::_('select.option', 'graph', JText::_('GRAPH'));
$this->values[] = JHTML::_('select.option', 'listing', JText::_('LISTING'));
if (hikashop_level(2)) {
$this->values[] = JHTML::_('select.option', 'map', JText::_('MAP'));
}
$this->values[] = JHTML::_('select.option', 'pie', JText::_('PIE'));
}
示例7: newentry
function newentry()
{
if (hikashop_level(2)) {
JHTML::_('behavior.formvalidation');
$app = JFactory::getApplication();
$fieldsClass = hikashop_get('class.field');
$this->assignRef('fieldsClass', $fieldsClass);
$null = null;
$this->extraFields['entry'] = $fieldsClass->getFields('frontcomp', $null, 'entry');
$this->assignRef('extraFields', $this->extraFields);
$this->assignRef('entry', $null);
$id = JRequest::getInt('id');
$fieldsClass->suffix = '_' . $id;
$this->assignRef('id', $id);
}
}
示例8: downloadXML
function downloadXML()
{
if (hikashop_level(1)) {
$xml = $this->generateXML();
@ob_clean();
header("Pragma: public");
header("Expires: 0");
// set expiration time
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
header("Content-Disposition: attachment; filename=Google_data_feed_" . time() . ".xml;");
header("Content-Transfer-Encoding: binary");
header('Content-Length: ' . strlen($xml));
echo $xml;
exit;
}
}
示例9: display
function display($tpl = null, $title = '', $menu_style = '')
{
$this->assignRef('title', $title);
$this->assignRef('menu_style', $menu_style);
if (!HIKASHOP_PHP5) {
$doc =& JFactory::getDocument();
} else {
$doc = JFactory::getDocument();
}
$doc->addStyleSheet(HIKASHOP_CSS . 'menu.css');
$config = hikashop_config();
$function = $this->getLayout();
if (method_exists($this, $function)) {
$this->{$function}();
}
$plugin = JPluginHelper::getPlugin('system', 'hikashopaffiliate');
$menus = array('system' => array('name' => JText::_('SYSTEM'), 'check' => 'ctrl=config', 'acl' => 'config', 'task' => 'manage', 'icon' => 'icon-16-config', 'url' => !HIKASHOP_J16 || JFactory::getUser()->authorise('core.admin', 'com_hikashop') ? hikashop_completeLink('config') : '#', 'children' => array(array('name' => JText::_('HIKA_CONFIGURATION'), 'check' => 'ctrl=config', 'acl' => 'config', 'task' => 'manage', 'icon' => 'icon-16-config', 'url' => hikashop_completeLink('config'), 'display' => !HIKASHOP_J16 || JFactory::getUser()->authorise('core.admin', 'com_hikashop')), array('name' => JText::_('ZONES'), 'check' => 'ctrl=zone', 'acl' => 'zone', 'icon' => 'icon-16-language', 'url' => hikashop_completeLink('zone')), array('name' => JText::_('PAYMENT_METHODS'), 'check' => array('ctrl' => 'plugins', 'plugin_type' => 'payment'), 'acl' => 'plugins', 'icon' => 'icon-16-plugin', 'url' => hikashop_completeLink('plugins&plugin_type=payment')), array('name' => JText::_('SHIPPING_METHODS'), 'check' => array('ctrl' => 'plugins', 'plugin_type' => 'shipping'), 'acl' => 'plugins', 'icon' => 'icon-16-plugin', 'url' => hikashop_completeLink('plugins&plugin_type=shipping')), array('name' => JText::_('PLUGINS'), 'check' => array('ctrl' => 'plugins', 'plugin_type' => 'plugin'), 'acl' => 'plugins', 'icon' => 'icon-16-plugin', 'url' => hikashop_completeLink('plugins&plugin_type=plugin')), array('name' => JText::_('WAREHOUSE'), 'check' => array('ctrl' => 'warehouse'), 'acl' => 'warehouse', 'icon' => 'icon-16-warehouse', 'url' => hikashop_completeLink('warehouse')), array('name' => JText::_('TAXES'), 'check' => array('ctrl' => 'taxation'), 'acl' => 'taxation', 'icon' => 'icon-16-tax', 'url' => hikashop_completeLink('taxation')), array('name' => JText::_('CURRENCIES'), 'check' => array('ctrl' => 'currency'), 'acl' => 'currency', 'icon' => 'icon-16-currency', 'url' => hikashop_completeLink('currency')), array('name' => JText::_('ORDER_STATUSES'), 'check' => array('ctrl' => 'category', 'filter_id' => 'status'), 'acl' => 'config', 'icon' => 'icon-16-order', 'url' => hikashop_completeLink('category&filter_id=status')), array('name' => JText::_('EMAILS'), 'check' => array('ctrl' => 'email'), 'acl' => 'email', 'url' => hikashop_completeLink('email'), 'icon' => 'icon-16-email', 'display' => hikashop_level(2)), array('name' => JText::_('HIKA_MASSACTION'), 'check' => 'ctrl=massaction', 'acl' => 'massaction', 'url' => hikashop_completeLink('massaction'), 'icon' => 'icon-16-massaction'))), 'products' => array('name' => JText::_('PRODUCTS'), 'check' => array('ctrl' => 'product', '!task' => array('add')), 'acl' => 'product', 'icon' => 'icon-16-product', 'url' => hikashop_completeLink('product'), 'children' => array(array('name' => JText::_('ADD_PRODUCT'), 'check' => array('ctrl' => 'procut', 'task' => 'add'), 'acl' => 'product', 'task' => 'manage', 'icon' => 'icon-16-addproduct', 'url' => hikashop_completeLink('product&task=add')), array('name' => JText::_('PRODUCTS'), 'check' => array('ctrl' => 'product', '!task' => array('add')), 'acl' => 'product', 'icon' => 'icon-16-product', 'url' => hikashop_completeLink('product')), array('name' => JText::_('HIKA_CATEGORIES'), 'check' => array('ctrl' => 'category', 'filter_id' => 'product'), 'acl' => 'category', 'icon' => 'icon-16-category', 'url' => hikashop_completeLink('category&filter_id=product')), array('name' => JText::_('CHARACTERISTICS'), 'check' => 'ctrl=characteristic', 'acl' => 'characteristic', 'icon' => 'icon-16-characteristic', 'url' => hikashop_completeLink('characteristic')), array('name' => JText::_('MANUFACTURERS'), 'check' => array('ctrl' => 'category', 'filter_id' => 'manufacturer'), 'acl' => 'category', 'icon' => 'icon-16-category', 'url' => hikashop_completeLink('category&filter_id=manufacturer')), array('name' => JText::_('HIKA_BADGES'), 'check' => 'ctrl=badge', 'acl' => 'badge', 'icon' => 'icon-16-badge', 'url' => hikashop_completeLink('badge')), array('name' => JText::_('LIMIT'), 'check' => 'ctrl=limit', 'icon' => 'icon-16-limit', 'acl' => 'limit', 'url' => hikashop_completeLink('limit'), 'display' => hikashop_level(1)), array('name' => JText::_('IMPORT'), 'check' => 'ctrl=import', 'acl' => 'import', 'icon' => 'icon-16-import', 'url' => hikashop_completeLink('import&task=show')))), 'customers' => array('name' => JText::_('CUSTOMERS'), 'check' => array('ctrl' => 'user', 'filter_partner' => 0, '!task' => array('clicks')), 'acl' => 'user', 'icon' => 'icon-16-user', 'url' => hikashop_completeLink('user&filter_partner=0'), 'children' => array(array('name' => JText::_('CUSTOMERS'), 'check' => array('ctrl' => 'user', 'filter_partner' => 0, '!task' => array('clicks')), 'acl' => 'user', 'icon' => 'icon-16-user', 'url' => hikashop_completeLink('user&filter_partner=0')), array('name' => JText::_('VOTE'), 'check' => 'ctrl=vote', 'acl' => 'vote', 'icon' => 'icon-16-vote', 'url' => hikashop_completeLink('vote')), array('name' => JText::_('HIKASHOP_CHECKOUT_CART'), 'check' => array('ctrl' => 'cart', 'cart_type' => 'cart'), 'acl' => 'cart', 'icon' => 'icon-16-cart', 'url' => hikashop_completeLink('cart&cart_type=cart'), 'display' => hikashop_level(1)), array('name' => JText::_('WISHLISTS'), 'check' => array('ctrl' => 'cart', 'cart_type' => 'wishlist'), 'acl' => 'wishlist', 'icon' => 'icon-16-wishlist', 'url' => hikashop_completeLink('cart&cart_type=wishlist'), 'display' => hikashop_level(1) && $config->get('enable_wishlist', 0)), array('name' => JText::_('HIKA_WAITLIST'), 'check' => array('ctrl' => 'waitlist'), 'acl' => 'waitlist', 'icon' => 'icon-16-wishlist', 'url' => hikashop_completeLink('waitlist'), 'display' => hikashop_level(1) && $config->get('product_waitlist', 1)))), 'orders' => array('name' => JText::_('ORDERS'), 'check' => array('ctrl' => 'order', 'filter_partner' => 0), 'acl' => 'order', 'icon' => 'icon-16-order', 'url' => hikashop_completeLink('order&order_type=sale&filter_partner=0'), 'children' => array(array('name' => JText::_('ORDERS'), 'check' => array('ctrl' => 'order', 'filter_partner' => 0), 'acl' => 'order', 'icon' => 'icon-16-order', 'url' => hikashop_completeLink('order&order_type=sale&filter_partner=0')), array('name' => JText::_('DISCOUNTS'), 'check' => array('ctrl=discount', 'filter_type' => 'discount'), 'acl' => 'discount', 'icon' => 'icon-16-discount', 'url' => hikashop_completeLink('discount&filter_type=discount')), array('name' => JText::_('COUPONS'), 'check' => array('ctrl=discount', 'filter_type' => 'coupon'), 'acl' => 'discount', 'icon' => 'icon-16-discount', 'url' => hikashop_completeLink('discount&filter_type=coupon')), array('name' => JText::_('HIKASHOP_ENTRIES'), 'check' => 'ctrl=entry', 'acl' => 'entry', 'icon' => 'icon-16-article', 'url' => hikashop_completeLink('entry'), 'display' => hikashop_level(2)), array('name' => JText::_('HIKASHOP_REPORTS'), 'check' => 'ctrl=report', 'acl' => 'report', 'icon' => 'icon-16-report', 'url' => hikashop_completeLink('report'), 'display' => hikashop_level(1)))), 'affiliates' => array('name' => JText::_('AFFILIATES'), 'check' => array('ctrl' => 'user', 'filter_partner' => '1'), 'acl' => 'affiliates', 'icon' => 'icon-16-affiliate', 'url' => hikashop_completeLink('user&filter_partner=1'), 'display' => !empty($plugin) && hikashop_level(2), 'children' => array(array('name' => JText::_('PARTNERS'), 'check' => array('ctrl' => 'user', 'filter_partner' => '1'), 'acl' => 'affiliates', 'icon' => 'icon-16-affiliate', 'url' => hikashop_completeLink('user&filter_partner=1')), array('name' => JText::_('HIKA_BANNERS'), 'check' => 'ctrl=banner', 'acl' => 'banner', 'icon' => 'icon-16-banner', 'url' => hikashop_completeLink('banner')), array('name' => JText::_('AFFILIATES_SALES'), 'check' => array('ctrl' => 'order', 'filter_partner' => '1'), 'acl' => 'order', 'icon' => 'icon-16-order', 'url' => hikashop_completeLink('order&order_type=sale&filter_partner=1')), array('name' => JText::_('CLICKS'), 'check' => array('ctrl' => 'user', 'task' => 'clicks'), 'acl' => 'order', 'icon' => 'icon-16-click', 'url' => hikashop_completeLink('user&task=clicks')))), 'display' => array('name' => JText::_('DISPLAY'), 'check' => 'ctrl=view', 'acl' => 'view', 'icon' => 'icon-16-views', 'url' => hikashop_completeLink('view'), 'children' => array(array('name' => JText::_('VIEWS'), 'check' => 'ctrl=view', 'acl' => 'view', 'icon' => 'icon-16-views', 'url' => hikashop_completeLink('view')), array('name' => JText::_('CONTENT_MENUS'), 'check' => 'ctrl=menus', 'acl' => 'menus', 'icon' => 'icon-16-menu', 'url' => hikashop_completeLink('menus'), 'display' => !HIKASHOP_J30), array('name' => JText::_('CONTENT_MODULES'), 'check' => 'ctrl=modules', 'acl' => 'modules', 'icon' => 'icon-16-module', 'url' => hikashop_completeLink('modules'), 'display' => !HIKASHOP_J30), array('name' => JText::_('FIELDS'), 'check' => 'ctrl=field', 'acl' => 'field', 'icon' => 'icon-16-field', 'url' => hikashop_completeLink('field')), array('name' => JText::_('FILTERS'), 'check' => 'ctrl=filter', 'acl' => 'filter', 'icon' => 'icon-16-filter', 'url' => hikashop_completeLink('filter'), 'display' => hikashop_level(2)))), 'help' => array('name' => JText::_('DOCUMENTATION'), 'check' => 'ctrl=documentation', 'acl' => 'documentation', 'icon' => 'icon-16-help', 'url' => hikashop_completeLink('documentation'), 'children' => array(array('name' => JText::_('DOCUMENTATION'), 'check' => 'ctrl=documentation', 'acl' => 'documentation', 'icon' => 'icon-16-help', 'url' => hikashop_completeLink('documentation')), array('name' => JText::_('UPDATE_ABOUT'), 'check' => 'ctrl=update', 'acl' => 'update_about', 'icon' => 'icon-16-install', 'url' => hikashop_completeLink('update')), array('name' => JText::_('FORUM'), 'options' => 'target="_blank"', 'acl' => 'forum', 'icon' => 'icon-16-info', 'url' => HIKASHOP_URL . 'support/forum.html'))));
$this->_checkActive($menus);
$this->assignRef('menus', $menus);
parent::display($tpl);
}
示例10: load
function load($type = '')
{
$this->allValues = array('text' => array('name' => JText::_('FIELD_TEXT'), 'options' => array("size", "required", "default", "columnname", "filtering", "maxlength", "readonly", "placeholder", "translatable", "attribute")), 'link' => array('name' => JText::_('LINK'), 'options' => array("size", "required", "default", "columnname", "filtering", "maxlength", "readonly", "attribute")), 'textarea' => array('name' => JText::_('FIELD_TEXTAREA'), 'options' => array("cols", "rows", "required", "default", "columnname", "filtering", "readonly", "maxlength", "placeholder", "translatable", "attribute")), 'wysiwyg' => array('name' => JText::_('WYSIWYG'), 'options' => array("cols", "rows", "required", "default", "columnname", "filtering", "translatable")), 'radio' => array('name' => JText::_('FIELD_RADIO'), 'options' => array("multivalues", "required", "default", "columnname", "attribute")), 'checkbox' => array('name' => JText::_('FIELD_CHECKBOX'), 'options' => array("multivalues", "required", "default", "columnname", "attribute")), 'singledropdown' => array('name' => JText::_('FIELD_SINGLEDROPDOWN'), 'options' => array("multivalues", "required", "default", "columnname", "attribute")), 'multipledropdown' => array('name' => JText::_('FIELD_MULTIPLEDROPDOWN'), 'options' => array("multivalues", "size", "default", "columnname", "attribute")), 'date' => array('name' => JText::_('FIELD_DATE'), 'options' => array("required", "format", "size", "default", "columnname", "allow")), 'zone' => array('name' => JText::_('FIELD_ZONE'), 'options' => array("required", "zone", "default", "columnname", "pleaseselect", "attribute")));
if (hikashop_level(2)) {
if ($type == 'entry' || empty($type)) {
$this->allValues["coupon"] = array('name' => JText::_('HIKASHOP_COUPON'), 'options' => array("size", "required", "default", "columnname"));
}
$this->allValues["file"] = array('name' => JText::_('HIKA_FILE'), 'options' => array("required", "default", "columnname", "attribute"));
$this->allValues["image"] = array('name' => JText::_('HIKA_IMAGE'), 'options' => array("required", "default", "columnname", "attribute"));
$this->allValues['ajaxfile'] = array('name' => JText::_('FIELD_AJAX_FILE'), 'options' => array("required", "default", "columnname"));
$this->allValues['ajaximage'] = array('name' => JText::_('FIELD_AJAX_IMAGE'), 'options' => array("required", "default", "columnname", "imagesize"));
}
$this->allValues["customtext"] = array('name' => JText::_('CUSTOM_TEXT'), 'options' => array("customtext"));
if ($this->externalValues == null) {
$this->externalValues = array();
$this->externalOptions = array();
JPluginHelper::importPlugin('hikashop');
$dispatcher = JDispatcher::getInstance();
$dispatcher->trigger('onFieldsLoad', array(&$this->externalValues, &$this->externalOptions));
}
if (!empty($this->externalValues)) {
foreach ($this->externalValues as $value) {
if (substr($value->name, 0, 4) != 'plg.') {
$value->name = 'plg.' . $value->name;
}
$this->allValues[$value->name] = array('name' => $value->text, 'options' => @$value->options);
}
}
foreach ($this->allValues as $v) {
if (!empty($v['options'])) {
foreach ($v['options'] as $o) {
$this->options[$o] = $o;
}
}
}
}
示例11: check
function check(&$coupon, &$total, $zones, &$products, $display_error = true)
{
JPluginHelper::importPlugin('hikashop');
$dispatcher = JDispatcher::getInstance();
$error_message = '';
$do = true;
if (isset($coupon->discount_value)) {
$coupon = $this->get($coupon->discount_id);
}
$dispatcher->trigger('onBeforeCouponCheck', array(&$coupon, &$total, &$zones, &$products, &$display_error, &$error_message, &$do));
if ($do) {
$user = hikashop_get('class.user');
$currency = hikashop_get('class.currency');
if (empty($coupon)) {
$error_message = JText::_('COUPON_NOT_VALID');
} elseif ($coupon->discount_start > time()) {
$error_message = JText::_('COUPON_NOT_YET_USABLE');
} elseif ($coupon->discount_end && $coupon->discount_end < time()) {
$error_message = JText::_('COUPON_EXPIRED');
} elseif (hikashop_level(2) && !empty($coupon->discount_access) && $coupon->discount_access != 'all' && ($coupon->discount_access == 'none' || !hikashop_isAllowed($coupon->discount_access))) {
$error_message = JText::_('COUPON_NOT_FOR_YOU');
} elseif (empty($error_message) && hikashop_level(1) && !empty($coupon->discount_quota) && $coupon->discount_quota <= $coupon->discount_used_times) {
$error_message = JText::_('QUOTA_REACHED_FOR_COUPON');
} elseif (empty($error_message) && hikashop_level(1)) {
if (!empty($coupon->discount_quota_per_user)) {
$user_id = hikashop_loadUser();
if ($user_id) {
$db = JFactory::getDBO();
$config =& hikashop_config();
$cancelled_order_status = explode(',', $config->get('cancelled_order_status'));
$cancelled_order_status = "'" . implode("','", $cancelled_order_status) . "'";
$query = 'SELECT COUNT(order_id) AS already_used FROM ' . hikashop_table('order') . ' WHERE order_user_id=' . (int) $user_id . ' AND order_status NOT IN (' . $cancelled_order_status . ') AND order_discount_code=' . $db->Quote($coupon->discount_code) . ' GROUP BY order_id';
$db->setQuery($query);
$already_used = $db->loadResult();
if ($coupon->discount_quota_per_user <= $already_used) {
$error_message = JText::_('QUOTA_REACHED_FOR_COUPON');
}
}
}
if (empty($error_message) && $coupon->discount_zone_id) {
if (!is_array($coupon->discount_zone_id)) {
$coupon->discount_zone_id = explode(',', $coupon->discount_zone_id);
}
$class = hikashop_get('class.zone');
$zone = $class->getZones($coupon->discount_zone_id, 'zone_namekey', 'zone_namekey', true);
if ($zone && !count(array_intersect($zone, $zones))) {
$error_message = JText::_('COUPON_NOT_AVAILABLE_IN_YOUR_ZONE');
}
}
$ids = array();
$qty = 0;
foreach ($products as $prod) {
$qty += $prod->cart_product_quantity;
if (!empty($prod->product_parent_id)) {
$ids[$prod->product_parent_id] = (int) $prod->product_parent_id;
} else {
$ids[$prod->product_id] = (int) $prod->product_id;
}
}
if (empty($ids)) {
$error_message = JText::_('COUPON_NOT_FOR_EMPTY_CART');
}
if (!empty($coupon->discount_product_id) && is_string($coupon->discount_product_id)) {
$coupon->discount_product_id = explode(',', $coupon->discount_product_id);
}
if (empty($error_message) && !empty($coupon->discount_product_id) && count(array_intersect($ids, $coupon->discount_product_id)) == 0) {
$error_message = JText::_('COUPON_NOT_FOR_THOSE_PRODUCTS');
}
if (empty($error_message) && $coupon->discount_category_id) {
$db = JFactory::getDBO();
if (!is_array($coupon->discount_category_id)) {
$coupon->discount_category_id = explode(',', trim($coupon->discount_category_id, ','));
}
if ($coupon->discount_category_childs) {
$filters = array('b.category_type=\'product\'', 'a.product_id IN (' . implode(',', $ids) . ')');
$categoryClass = hikashop_get('class.category');
$categories = $categoryClass->getCategories($coupon->discount_category_id, 'category_left, category_right');
if (!empty($categories)) {
$categoriesFilters = array();
foreach ($categories as $category) {
$categoriesFilters[] = 'b.category_left >= ' . $category->category_left . ' AND b.category_right <= ' . $category->category_right;
}
if (count($categoriesFilters)) {
$filters[] = '((' . implode(') OR (', $categoriesFilters) . '))';
hikashop_addACLFilters($filters, 'category_access', 'b');
$select = 'SELECT a.product_id FROM ' . hikashop_table('category') . ' AS b LEFT JOIN ' . hikashop_table('product_category') . ' AS a ON b.category_id=a.category_id WHERE ' . implode(' AND ', $filters);
$db->setQuery($select);
$id = $db->loadRowList();
if (empty($id)) {
$error_message = JText::_('COUPON_NOT_FOR_PRODUCTS_IN_THOSE_CATEGORIES');
}
}
}
} else {
JArrayHelper::toInteger($coupon->discount_category_id);
$filters = array('b.category_id IN (' . implode(',', $coupon->discount_category_id) . ')', 'a.product_id IN (' . implode(',', $ids) . ')');
hikashop_addACLFilters($filters, 'category_access', 'b');
$select = 'SELECT a.product_id FROM ' . hikashop_table('category') . ' AS b LEFT JOIN ' . hikashop_table('product_category') . ' AS a ON b.category_id=a.category_id WHERE ' . implode(' AND ', $filters);
$db->setQuery($select);
$id = $db->loadRowList();
//.........这里部分代码省略.........
示例12: contact
function contact()
{
$user = hikashop_loadUser(true);
$this->assignRef('element', $user);
$doc = JFactory::getDocument();
$app = JFactory::getApplication();
$product_id = (int) hikashop_getCID('product_id');
$config =& hikashop_config();
$this->assignRef('config', $config);
$imageHelper = hikashop_get('helper.image');
$this->assignRef('imageHelper', $imageHelper);
$element = null;
if (!empty($product_id)) {
$filters = array('a.product_id=' . $product_id);
hikashop_addACLFilters($filters, 'product_access', 'a');
$query = 'SELECT a.*,b.product_category_id, b.category_id, b.ordering FROM ' . hikashop_table('product') . ' AS a LEFT JOIN ' . hikashop_table('product_category') . ' AS b ON a.product_id = b.product_id WHERE ' . implode(' AND ', $filters) . ' LIMIT 1';
$database = JFactory::getDBO();
$database->setQuery($query);
$element = $database->loadObject();
if (!empty($element)) {
if ($element->product_type == 'variant') {
$this->selected_variant_id = $product_id;
$filters = array('a.product_id=' . $element->product_parent_id);
hikashop_addACLFilters($filters, 'product_access', 'a');
$query = 'SELECT a.*,b.* FROM ' . hikashop_table('product') . ' AS a LEFT JOIN ' . hikashop_table('product_category') . ' AS b ON a.product_id = b.product_id WHERE ' . implode(' AND ', $filters) . ' LIMIT 1';
$database->setQuery($query);
$element = $database->loadObject();
if (empty($element)) {
return;
}
$product_id = $element->product_id;
}
$productClass = hikashop_get('class.product');
$productClass->addAlias($element);
if (!$element->product_published) {
return;
}
$query = 'SELECT file_id, file_name, file_description, file_path FROM ' . hikashop_table('file') . ' AS file WHERE file.file_type = \'product\' AND file_ref_id = ' . (int) $product_id . ' ORDER BY file_ordering ASC';
$database->setQuery($query);
$element->images = $database->loadObjectList();
global $Itemid;
$url_itemid = '';
if (!empty($Itemid)) {
$url_itemid = '&Itemid=' . $Itemid;
}
$product_url = hikashop_contentLink('product&task=show&cid=' . (int) $element->product_id . '&name=' . $element->alias . $url_itemid, $element);
$this->assignRef('product_url', $product_url);
}
}
if (hikashop_level(1)) {
$fieldsClass = hikashop_get('class.field');
$this->assignRef('fieldsClass', $fieldsClass);
$contactFields = $fieldsClass->getFields('frontcomp', $element, 'contact', 'checkout&task=state');
$null = array();
$fieldsClass->addJS($null, $null, $null);
$fieldsClass->jsToggle($contactFields, $element, 0);
$extraFields = array('contact' => &$contactFields);
$requiredFields = array();
$validMessages = array();
$values = array('contact' => $element);
$fieldsClass->checkFieldsForJS($extraFields, $requiredFields, $validMessages, $values);
$fieldsClass->addJS($requiredFields, $validMessages, array('contact'));
$this->assignRef('contactFields', $contactFields);
}
$this->assignRef('product', $element);
$js = "\nfunction checkFields(){\n\tvar send = true;\n\tvar name = document.getElementById('hikashop_contact_name');\n\tif(name != null){\n\t\tif(name.value == ''){\n\t\t\tname.className = name.className.replace('hikashop_red_border','') + ' hikashop_red_border';\n\t\t\tsend = false;\n\t\t}else{\n\t\t\tname.className=name.className.replace('hikashop_red_border','');\n\t\t}\n\t}\n\tvar email = document.getElementById('hikashop_contact_email');\n\tif(email != null){\n\t\tif(email.value == ''){\n\t\t\temail.className = email.className.replace('hikashop_red_border','') + ' hikashop_red_border';\n\t\t\tsend = false;\n\t\t}else{\n\t\t\temail.value = email.value.replace(/ /g,\"\");\n\t\t\tvar filter = /^([a-z0-9_'&\\.\\-\\+])+\\@(([a-z0-9\\-])+\\.)+([a-z0-9]{2,10})+\$/i;\n\t\t\tif(!email || !filter.test(email.value)){\n\t\t\t\temail.className = email.className.replace('hikashop_red_border','') + ' hikashop_red_border';\n\t\t\t\treturn false;\n\t\t\t}else{\n\t\t\t\temail.className=email.className.replace('hikashop_red_border','');\n\t\t\t}\n\t\t}\n\t}\n\tvar altbody = document.getElementById('hikashop_contact_altbody');\n\tif(altbody != null){\n\t\tif(altbody.value == ''){\n\t\t\taltbody.className = altbody.className.replace('hikashop_red_border','') + ' hikashop_red_border';\n\t\t\tsend = false;\n\t\t}else{\n\t\t\taltbody.className=altbody.className.replace('hikashop_red_border','');\n\t\t}\n\t}\n\tif(!hikashopCheckChangeForm('contact','hikashop_contact_form')){\n\t\tsend = false;\n\t}\n\tif(send == true){\n\t\tdocument.getElementById('toolbar').innerHTML='<img src=\"" . HIKASHOP_IMAGES . "spinner.gif\"/>';\n\t\twindow.hikashop.submitform('send_email', 'hikashop_contact_form');\n\t}\n}\nwindow.hikashop.ready(function(){\n\tvar name = document.getElementById('hikashop_contact_name');\n\tif(name != null){\n\t\tname.onclick=function(){\n\t\t\tname.className=name.className.replace('hikashop_red_border','');\n\t\t}\n\t}\n\tvar email = document.getElementById('hikashop_contact_email');\n\tif(email != null){\n\t\temail.onclick=function(){\n\t\t\temail.className=email.className.replace('hikashop_red_border','');\n\t\t}\n\t}\n\tvar altbody = document.getElementById('hikashop_contact_altbody');\n\tif(altbody != null){\n\t\taltbody.onclick=function(){\n\t\t\taltbody.className=altbody.className.replace('hikashop_red_border','');\n\t\t}\n\t}\n});\n\t\t";
$doc->addScriptDeclaration($js);
}
示例13: getOrderAdditionalInfo
function getOrderAdditionalInfo(&$order)
{
if (hikashop_level(2)) {
$query = 'SELECT * FROM ' . hikashop_table('entry') . ' WHERE order_id=' . $order->order_id;
$this->database->setQuery($query);
$order->entries = $this->database->loadObjectList();
}
$product_ids = array();
if (isset($order->cart->products)) {
$products =& $order->cart->products;
} else {
$products =& $order->products;
}
if (!empty($products)) {
foreach ($products as $product) {
if (!empty($product->product_id)) {
$product_ids[] = $product->product_id;
}
}
}
if (count($product_ids)) {
$query = 'SELECT * FROM ' . hikashop_table('product') . ' WHERE product_id IN (' . implode(',', $product_ids) . ') AND product_type=\'variant\'';
$this->database->setQuery($query);
$productInfos = $this->database->loadObjectList();
if (!empty($productInfos)) {
foreach ($productInfos as $product) {
foreach ($products as $item) {
if ($product->product_id == $item->product_id && !empty($product->product_parent_id)) {
$item->product_parent_id = $product->product_parent_id;
$product_ids[] = $product->product_parent_id;
}
}
}
}
$filters = array('a.file_ref_id IN (' . implode(',', $product_ids) . ')', 'a.file_type=\'file\'');
$query = 'SELECT b.*,a.* FROM ' . hikashop_table('file') . ' AS a LEFT JOIN ' . hikashop_table('download') . ' AS b ON b.order_id=' . $order->order_id . ' AND a.file_id = b.file_id WHERE ' . implode(' AND ', $filters) . ' ORDER BY a.file_ref_id ASC, a.file_ordering ASC, b.file_pos ASC';
$this->database->setQuery($query);
$files = $this->database->loadObjectList();
if (!empty($files)) {
foreach ($products as $k => $product) {
$products[$k]->files = array();
foreach ($files as $file) {
if ($product->product_id == $file->file_ref_id) {
$this->_setDownloadFile($file, $products, $k);
}
}
if (empty($products[$k]->files) && !empty($product->product_parent_id)) {
foreach ($files as $file) {
if ($product->product_parent_id == $file->file_ref_id) {
$this->_setDownloadFile($file, $products, $k);
}
}
}
}
}
$filters = array('a.file_ref_id IN (' . implode(',', $product_ids) . ')', 'a.file_type =\'product\'');
$query = 'SELECT a.* FROM ' . hikashop_table('file') . ' AS a WHERE ' . implode(' AND ', $filters) . ' ORDER BY file_ref_id ASC, file_ordering ASC';
$this->database->setQuery($query);
$images = $this->database->loadObjectList();
if (!empty($images)) {
foreach ($products as $k => $product) {
$products[$k]->images = array();
foreach ($images as $image) {
if ($product->product_id == $image->file_ref_id) {
$products[$k]->images[] = $image;
}
}
if (empty($products[$k]->files) && !empty($product->product_parent_id)) {
foreach ($images as $image) {
if ($product->product_parent_id == $image->file_ref_id) {
$products[$k]->images[] = $image;
}
}
}
}
}
}
}
示例14: implode
}
}
$shippings_data[] = $shipping_data;
}
if (!empty($shippings_data)) {
$vars['SHIPPING'] = '<ul><li>' . implode('</li><li>', $shippings_data) . '</li></ul>';
$vars['SHIPPING_TXT'] = ' - ' . implode("\r\n - ", $shippings_data);
}
}
unset($shippingClass);
} else {
$vars['SHIPPING'] = '';
}
ob_start();
$sep = '';
if (hikashop_level(2)) {
$fields = $fieldsClass->getFields('frontcomp', $data, 'order', '');
foreach ($fields as $fieldName => $oneExtraField) {
if (isset($data->{$fieldName}) && !isset($data->cart->{$fieldName})) {
$data->cart->{$fieldName} = $data->{$fieldName};
}
if (empty($data->cart->{$fieldName})) {
continue;
}
echo $sep . $fieldsClass->trans($oneExtraField->field_realname) . ' : ' . $fieldsClass->show($oneExtraField, $data->cart->{$fieldName}, 'user_email');
$sep = '<br />';
}
}
JPluginHelper::importPlugin('hikashop');
$dispatcher = JDispatcher::getInstance();
$dispatcher->trigger('onAfterOrderProductsListingDisplay', array(&$data->cart, 'email_notification_html'));
示例15: store
function store($new = false)
{
if (!HIKASHOP_PHP5) {
$app =& JFactory::getApplication();
} else {
$app = JFactory::getApplication();
}
$app = JFactory::getApplication();
JRequest::checkToken() || die('Invalid Token');
$image = hikashop_get('class.file');
$source = is_array($_POST['config']) ? 'POST' : 'REQUEST';
//to avoid strange bugs on some web servers where the config array might be only in one of the two global variable :/
$formData = JRequest::getVar('config', array(), $source, 'array');
$aclcats = JRequest::getVar('aclcat', array(), '', 'array');
if (!empty($aclcats)) {
if (JRequest::getString('acl_config', 'all') != 'all' && !hikashop_isAllowed($formData['acl_config_manage'])) {
$app->enqueueMessage(JText::_('ACL_WRONG_CONFIG'), 'notice');
unset($formData['acl_config_manage']);
}
$deleteAclCats = array();
$unsetVars = array('manage', 'delete', 'view');
foreach ($aclcats as $oneCat) {
if (JRequest::getString('acl_' . $oneCat) == 'all') {
foreach ($unsetVars as $oneVar) {
unset($formData['acl_' . $oneCat . '_' . $oneVar]);
}
$deleteAclCats[] = $oneCat;
}
}
}
$config =& hikashop_config();
$nameboxes = array('simplified_registration', 'partner_valid_status', 'order_status_for_download', 'payment_capture_order_status', 'cancellable_order_status', 'cancelled_order_status', 'invoice_order_statuses', 'order_unpaid_statuses');
foreach ($nameboxes as $namebox) {
if (!isset($formData[$namebox])) {
$formData[$namebox] = '';
} elseif (is_array($formData[$namebox])) {
$formData[$namebox] = implode($formData[$namebox], ',');
}
}
$status = $config->save($formData);
if (!empty($deleteAclCats)) {
$db = JFactory::getDBO();
$db->setQuery("DELETE FROM `#__hikashop_config` WHERE `config_namekey` LIKE 'acl_" . implode("%' OR `config_namekey` LIKE 'acl_", $deleteAclCats) . "%'");
$db->query();
}
$ids = $image->storeFiles('default_image', 0);
if (!empty($ids)) {
$data = $image->get($ids[0]);
$formData['default_image'] = $data->file_path;
}
if (hikashop_level(2)) {
$ids = $image->storeFiles('watermark', 0, 'watermark');
if (!empty($ids)) {
$data = $image->get($ids[0]);
$formData['watermark'] = $data->file_path;
}
}
$formData['store_address'] = JRequest::getVar('config_store_address', '', '', 'string', JREQUEST_ALLOWRAW);
if (!empty($formData['cart_item_limit']) && !is_numeric($formData['cart_item_limit'])) {
$formData['cart_item_limit'] = 0;
}
if (!isset($this->wizard) && !$this->_checkWorkflow($formData)) {
$app->enqueueMessage('Checkout workflow invalid. The modification is ignored. See <a style="font-size:1.2em;text-decoration:underline" href="http://www.hikashop.com/support/documentation/integrated-documentation/54-hikashop-config.html#main" target="_blank" >the documentation</a> for more information on how to configure that option.');
unset($formData['checkout']);
}
if (!isset($this->wizard)) {
if (empty($formData['category_sef_name']) && empty($formData['product_sef_name'])) {
$app->enqueueMessage('No SEF category and product names entered. Please complete at least one of these two fields. The system put back the default values');
$formData['category_sef_name'] = 'category';
$formData['product_sef_name'] = 'product';
}
}
if (!empty($formData['weight_symbols'])) {
$symbols = explode(',', $formData['weight_symbols']);
$weightHelper = hikashop_get('helper.weight');
$possibleSymbols = array_keys($weightHelper->conversion);
$possibleSymbols[] = 'l';
$possibleSymbols[] = 'ml';
$possibleSymbols[] = 'cl';
$okSymbols = array();
foreach ($symbols as $k => $symbol) {
if (!in_array($symbol, $possibleSymbols)) {
$app->enqueueMessage('The weight unit "' . $symbol . '" is not in the list of possible units : ' . implode(',', $possibleSymbols));
} else {
$okSymbols[] = $symbol;
}
}
$formData['weight_symbols'] = implode(',', $okSymbols);
}
if (!isset($this->wizard) && empty($formData['weight_symbols'])) {
$app->enqueueMessage('No valid weight unit entered. The system put back the default units.');
$formData['weight_symbols'] = 'kg,g,mg,lb,oz,ozt';
}
if (!empty($formData['volume_symbols'])) {
$symbols = explode(',', $formData['volume_symbols']);
$weightHelper = hikashop_get('helper.volume');
$possibleSymbols = array_keys($weightHelper->conversion);
$okSymbols = array();
foreach ($symbols as $k => $symbol) {
if (!in_array($symbol, $possibleSymbols)) {
//.........这里部分代码省略.........