function fetchElement($name, $value, &$node, $control_name) { if (!(include_once rtrim(JPATH_ADMINISTRATOR, DS) . DS . 'components' . DS . 'com_hikashop' . DS . 'helpers' . DS . 'helper.php')) { return 'This module can not work without the Hikashop Component'; } $config =& hikashop_config(); if (!hikashop_isAllowed($config->get('acl_modules_manage', 'all'))) { return 'Access to the HikaShop options of the modules is restricted'; } $id = hikashop_getCID('id'); if (!empty($id)) { $app = JFactory::getApplication(); if ($app->isAmdin()) { $link = JRoute::_('index.php?option=com_hikashop&ctrl=modules&task=edit&cid[]=' . $id); } else { $link = JURI::base() . 'administrator/index.php?option=com_hikashop&ctrl=modules&task=edit&cid[]=' . $id; } $text = '<a title="' . JText::_('HIKASHOP_OPTIONS') . '" href="' . $link . '" >' . JText::_('HIKASHOP_OPTIONS') . '</a>'; $config =& hikashop_config(); $level = $config->get('params_' . $id); } else { $text = JText::_('HIKASHOP_OPTIONS_EDIT'); } return $text; }
protected function getInput() { if (!defined('DS')) { define('DS', DIRECTORY_SEPARATOR); } if (!(include_once rtrim(JPATH_ADMINISTRATOR, DS) . DS . 'components' . DS . 'com_hikashop' . DS . 'helpers' . DS . 'helper.php')) { return 'This plugin can not work without the Hikashop Component'; } $id = JRequest::getInt('extension_id'); $plugins = hikashop_get('class.plugins'); $plugin = $plugins->get($id); $name = @$plugin->element; if (@$plugin->folder == 'hikashopshipping') { $group = 'shipping'; } elseif (@$plugin->folder == 'hikashop') { $group = 'plugin'; } else { $group = 'payment'; } $config =& hikashop_config(); if (!hikashop_isAllowed($config->get('acl_plugins_manage', 'all'))) { return 'Access to the HikaShop options of the plugins is restricted'; } $text = '<a style="float:left;" title="' . JText::_('HIKASHOP_OPTIONS') . '" href="' . JRoute::_('index.php?option=com_hikashop&ctrl=plugins&fromjoomla=1&task=listing&name=' . $name . '&plugin_type=' . $group) . '" >' . JText::_('HIKASHOP_OPTIONS') . '</a>'; return $text; }
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'); }
protected function getInput() { if (!defined('DS')) { define('DS', DIRECTORY_SEPARATOR); } if (!function_exists('hikashop_config') && !(include_once rtrim(JPATH_ADMINISTRATOR, DS) . DS . 'components' . DS . 'com_hikashop' . DS . 'helpers' . DS . 'helper.php')) { return 'This menu options cannot be displayed without the Hikashop Component'; } $id = JRequest::getInt('id'); if (HIKASHOP_J30) { $empty = ''; jimport('joomla.html.parameter'); $params = new HikaParameter($empty); $js = ''; $params->set('id', $this->id); $params->set('name', $this->name); $params->set('value', $this->value); $params->set('type', $this->getAttribute('content')); $params->set('menu', $this->getAttribute('menu')); $content = hikashop_getLayout('menus', 'options', $params, $js); $text = '</div></div>' . $content . '<div><div>'; } elseif (!empty($id)) { $config =& hikashop_config(); if (!hikashop_isAllowed($config->get('acl_menus_manage', 'all'))) { return 'Access to the HikaShop options of the menus is restricted'; } $text = '<a title="' . JText::_('HIKASHOP_OPTIONS') . '" href="' . JRoute::_('index.php?option=com_hikashop&ctrl=menus&fromjoomla=1&task=edit&cid[]=' . $id) . '" >' . JText::_('HIKASHOP_OPTIONS') . '</a>'; } else { $text = JText::_('HIKASHOP_OPTIONS_EDIT'); } return $text; }
function listing() { $app = JFactory::getApplication(); $pageInfo = new stdClass(); $pageInfo->filter = new stdClass(); $pageInfo->filter->order = new stdClass(); $pageInfo->limit = new stdClass(); $pageInfo->search = $app->getUserStateFromRequest($this->paramBase . ".search", 'search', '', 'string'); $pageInfo->filter->order->value = $app->getUserStateFromRequest($this->paramBase . ".filter_order", 'filter_order', 'a.waitlist_id', 'cmd'); $pageInfo->filter->order->dir = $app->getUserStateFromRequest($this->paramBase . ".filter_order_Dir", 'filter_order_Dir', 'desc', 'word'); $pageInfo->limit->value = $app->getUserStateFromRequest($this->paramBase . '.list_limit', 'limit', $app->getCfg('list_limit'), 'int'); $pageInfo->limit->start = $app->getUserStateFromRequest($this->paramBase . '.limitstart', 'limitstart', 0, 'int'); $database = JFactory::getDBO(); $filters = array(); $searchMap = array('a.waitlist_id', 'a.email', 'a.name', 'a.product_id', 'b.product_name', 'b.product_code'); if (!empty($pageInfo->search)) { $searchVal = '\'%' . hikashop_getEscaped(JString::strtolower(trim($pageInfo->search)), true) . '%\''; $filters[] = implode(" LIKE {$searchVal} OR ", $searchMap) . " LIKE {$searchVal}"; } $order = ''; if (!empty($pageInfo->filter->order->value)) { $order = ' ORDER BY ' . $pageInfo->filter->order->value . ' ' . $pageInfo->filter->order->dir; } if (!empty($filters)) { $filters = ' WHERE (' . implode(') AND (', $filters) . ')'; } else { $filters = ''; } $query = ' FROM ' . hikashop_table('waitlist') . ' AS a LEFT JOIN ' . hikashop_table('product') . ' AS b ON a.product_id=b.product_id ' . $filters . $order; $database->setQuery('SELECT *' . $query, (int) $pageInfo->limit->start, (int) $pageInfo->limit->value); $rows = $database->loadObjectList(); $class = hikashop_get('class.product'); foreach ($rows as $i => $element) { if ($element->product_type == 'variant') { $database->setQuery('SELECT * FROM ' . hikashop_table('variant') . ' AS a LEFT JOIN ' . hikashop_table('characteristic') . ' AS b ON a.variant_characteristic_id=b.characteristic_id WHERE a.variant_product_id=' . (int) $element->product_id . ' ORDER BY a.ordering'); $element->characteristics = $database->loadObjectList(); $parentProduct = $class->get((int) $element->product_parent_id); $class->checkVariant($element, $parentProduct); $rows[$i] = $element; } } if (!empty($pageInfo->search)) { $rows = hikashop_search($pageInfo->search, $rows, 'waitlist_id'); } $database->setQuery('SELECT COUNT(*)' . $query); $pageInfo->elements = new stdClass(); $pageInfo->elements->total = $database->loadResult(); $pageInfo->elements->page = count($rows); $toggleClass = hikashop_get('helper.toggle'); $this->assignRef('toggleClass', $toggleClass); $this->assignRef('rows', $rows); $this->assignRef('pageInfo', $pageInfo); $this->getPagination(); hikashop_setTitle(JText::_($this->nameListing), $this->icon, $this->ctrl); $config =& hikashop_config(); $manage = hikashop_isAllowed($config->get('acl_waitlist_manage', 'all')); $this->assignRef('manage', $manage); $this->toolbar = array(array('name' => 'addNew', 'display' => $manage), array('name' => 'editList', 'display' => $manage), array('name' => 'deleteList', 'display' => hikashop_isAllowed($config->get('acl_waitlist_delete', 'all'))), '|', array('name' => 'pophelp', 'target' => $this->ctrl . '-listing'), 'dashboard'); }
protected function getInput() { if (!defined('DS')) { define('DS', DIRECTORY_SEPARATOR); } if (!function_exists('hikashop_config') && !(include_once rtrim(JPATH_ADMINISTRATOR, DS) . DS . 'components' . DS . 'com_hikashop' . DS . 'helpers' . DS . 'helper.php')) { return 'This module can not work without the Hikashop Component'; } $config =& hikashop_config(); $id = JRequest::getInt('id'); if (HIKASHOP_J30 && !in_array(@$_REQUEST['option'], array('com_falang', 'com_joomfish'))) { if (preg_match('/hikashopmodule/', $this->name)) { $associated = false; $cid = JRequest::getVar('id', ''); if (empty($cid)) { $cid = hikashop_getCID(); } foreach ($config->values as $name => $values) { if (preg_match('#menu_[0-9]#', $name)) { $params = unserialize(base64_decode($values->config_value)); $modules = array(); if (isset($params['modules'])) { $modules = explode(',', $params['modules']); } if (in_array($cid, $modules)) { $associated = str_replace('menu_', '', $values->config_namekey); break; } } } if ($associated) { $app = JFactory::getApplication(); $app->enqueueMessage(JText::sprintf('USE_MENU_SETTINGS_INSTEAD_OF_ASSOCIATED_ONES', JRoute::_('index.php?option=com_menus&view=item&layout=edit&id=' . $associated))); } $layout = 'modules'; } else { $layout = 'cartmodules'; } $empty = ''; jimport('joomla.html.parameter'); $params = new HikaParameter($empty); $js = ''; $params->set('id', $this->id); $params->set('name', $this->name); $params->set('value', $this->value); $content = hikashop_getLayout($layout, 'options', $params, $js, true); $text = '</div></div>' . $content . '<div><div>'; } elseif (!empty($id)) { if (!hikashop_isAllowed($config->get('acl_modules_manage', 'all'))) { return 'Access to the HikaShop options of the modules is restricted'; } $text = '<a style="float:left;" title="' . JText::_('HIKASHOP_OPTIONS') . '" href="' . JRoute::_('index.php?option=com_hikashop&ctrl=modules&fromjoomla=1&task=edit&cid[]=' . $id) . '" >' . JText::_('HIKASHOP_OPTIONS') . '</a>'; } else { $text = JText::_('HIKASHOP_OPTIONS_EDIT'); } return $text; }
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(); }
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.characteristic_id', 'cmd'); $pageInfo->filter->order->dir = $app->getUserStateFromRequest($this->paramBase . ".filter_order_Dir", 'filter_order_Dir', 'asc', 'word'); $pageInfo->search = $app->getUserStateFromRequest($this->paramBase . ".search", 'search', '', 'string'); $pageInfo->search = JString::strtolower(trim($pageInfo->search)); $pageInfo->limit->value = $app->getUserStateFromRequest($this->paramBase . '.list_limit', 'limit', $app->getCfg('list_limit'), 'int'); $pageInfo->limit->start = $app->getUserStateFromRequest($this->paramBase . '.limitstart', 'limitstart', 0, 'int'); $database = JFactory::getDBO(); $searchMap = array('a.characteristic_value', 'a.characteristic_alias', 'a.characteristic_id'); $filters = array('a.characteristic_parent_id=0'); if (!empty($pageInfo->search)) { $searchVal = '\'%' . hikashop_getEscaped($pageInfo->search, true) . '%\''; $filters[] = implode(' LIKE ' . $searchVal . ' OR ', $searchMap) . ' LIKE ' . $searchVal; } $extrafilters = array(); JPluginHelper::importPlugin('hikashop'); $dispatcher = JDispatcher::getInstance(); $dispatcher->trigger('onBeforeCharacteristicListing', array($this->paramBase, &$extrafilters, &$pageInfo, &$filters)); $this->assignRef('extrafilters', $extrafilters); $query = ' FROM ' . hikashop_table('characteristic') . ' 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(); if (!empty($pageInfo->search)) { $rows = hikashop_search($pageInfo->search, $rows, 'characteristic_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_characteristic_manage', 'all')); $this->assignRef('manage', $manage); $this->toolbar = array(array('name' => 'addNew', 'display' => $manage), array('name' => 'editList', 'display' => $manage), array('name' => 'deleteList', 'display' => hikashop_isAllowed($config->get('acl_characteristic_view', 'all'))), '|', array('name' => 'pophelp', 'target' => $this->ctrl . '-listing'), 'dashboard'); $this->assignRef('rows', $rows); $this->assignRef('pageInfo', $pageInfo); $this->getPagination(); }
function listing() { $app = JFactory::getApplication(); $database = JFactory::getDBO(); $config =& hikashop_config(); $pageInfo = $this->getPageInfo('a.email_log_id'); $pageInfo->filter->filter_type = $app->getUserStateFromRequest($this->paramBase . ".filter_type", 'filter_type', '', 'string'); $filters = array(); $order = ''; $searchMap = array('a.email_log_recipient_email', 'a.email_log_id'); if (!empty($pageInfo->filter->filter_type)) { switch ($pageInfo->filter->filter_type) { case 'all': break; default: $filters[] = 'a.email_log_name = ' . $database->Quote($pageInfo->filter->filter_type); break; } } $filters[] = 'a.email_log_published = 1'; $this->processFilters($filters, $order, $searchMap); $query = ' FROM ' . hikashop_table('email_log') . ' AS a' . $filters . $order; $this->getPageInfoTotal($query, '*'); $database->setQuery('SELECT a.*' . $query, $pageInfo->limit->start, $pageInfo->limit->value); $rows = $database->loadObjectList(); $fields = array('email_log_recipient_email', 'email_log_reply_email', 'email_log_subject'); foreach ($rows as &$row) { foreach ($fields as $field) { if (isset($row->{$field})) { $row->{$field} = $this->escape($row->{$field}); } } } unset($row); if (!empty($pageInfo->search)) { $rows = hikashop_search($pageInfo->search, $rows, 'email_log_id'); } $emailType = hikashop_get('type.email_log'); $this->assignRef('filter_type', $emailType); $this->assignRef('rows', $rows); $this->assignRef('pageInfo', $pageInfo); $this->getPagination(); $this->getOrdering('a.email_log_date', true); $this->assignRef('order', $order); hikashop_setTitle(JText::_($this->nameListing), $this->icon, $this->ctrl); $manage = hikashop_isAllowed($config->get('acl_email_log_delete', 'all')); $this->assignRef('manage', $manage); $this->toolbar = array(array('name' => 'editList', 'display' => $manage), array('name' => 'deleteList', 'display' => hikashop_isAllowed($config->get('acl_email_log_delete', 'all'))), '|', array('name' => 'pophelp', 'target' => $this->ctrl . '-listing'), 'dashboard'); }
function display($map, $value) { $this->load(); if (count($this->values) == 1 && $this->type == 'style') { return '<a target="_blank" href="' . HIKASHOP_REDIRECT . 'hikashop-styles' . '">' . hikashop_tooltip(JText::_('STYLE_TOOLTIP_TEXT'), JText::_('STYLE_TOOLTIP_TITLE'), '', JText::_('STYLE_HIKASHOP')) . '</a>'; } $js = ' onchange="updateCSSLink(\'' . $this->type . '\',\'' . $this->type . '\',this.value);"'; $aStyle = empty($value) ? ' style="display:none"' : ''; $html = JHTML::_('select.genericlist', $this->values, $map, 'class="inputbox" size="1"', 'value', 'text', $value, $this->type . '_choice'); $config =& hikashop_config(); $manage = hikashop_isAllowed($config->get('acl_config_manage', 'all')); if ($manage) { $popup = hikashop_get('helper.popup'); $html .= $popup->display('<img src="' . HIKASHOP_IMAGES . 'edit.png" alt="' . JText::_('HIKA_EDIT') . '"/>', 'CSS', '\'' . 'index.php?option=com_hikashop&tmpl=component&ctrl=config&task=css&file=' . $this->type . '_\'+document.getElementById(\'' . $this->type . '_choice' . '\').value+\'&var=' . $this->type . '\'', $this->type . '_link', 760, 480, $aStyle, '', 'link', true); } return $html; }
function display($category, $actions) { $oneAction = reset($actions); $app = JFactory::getApplication(); if ($app->isAdmin() && !HIKASHOP_BACK_RESPONSIVE || !$app->isAdmin() && !HIKASHOP_RESPONSIVE) { $acltable = '<table class="acltable"><thead><tr><th></th>'; } else { $acltable = '<table class="table table-striped table-hover"><thead><tr><th></th>'; } foreach ($actions as $action) { $trans = JText::_('HIKA_' . strtoupper($action)); if ($trans == 'HIKA_' . strtoupper($action)) { $trans = JText::_(strtoupper($action)); } $acltable .= '<th style="cursor:pointer" onclick="updateAction(\'' . $category . '\',\'' . $action . '\')">' . $trans . '<input type="hidden" name="config[acl_' . $category . '_' . $action . ']" id="acl_' . $category . '_' . $action . '" value="' . $this->config->get('acl_' . $category . '_' . $action, 'all') . '"/></th>'; } $acltable .= '</tr></thead><tbody>'; $custom = false; foreach ($this->groups as $oneGroup) { $acltable .= '<tr class="aclline"><td valign="top" class="groupname" style="cursor:pointer" onclick="updateGroup(\'' . $category . '\',\'' . $oneGroup->value . '\',new Array(\'' . implode("','", $actions) . '\'))">' . $oneGroup->text . '</td>'; foreach ($actions as $action) { $acltable .= '<td class="checkfield">'; $value = $this->config->get('acl_' . $category . '_' . $action, 'all'); if (version_compare(JVERSION, '1.6.0', '>=') || !in_array($oneGroup->value, array(29, 30))) { if (hikashop_isAllowed($value, $oneGroup->value, 'group')) { $checked = 'checked="checked"'; } else { $custom = true; $checked = ''; } $acltable .= '<input type="checkbox" id="acl_' . $category . '_' . $oneGroup->value . '_' . $action . '" onclick="updateACLTable(\'' . $category . '\',\'' . $action . '\');" value="' . $oneGroup->value . '" ' . $checked . ' />'; } $acltable .= '</td>'; } $acltable .= '</tr>'; } $acltable .= '</tbody></table>'; $openDiv = JHTML::_('hikaselect.radiolist', $this->choice, "acl_{$category}", 'onclick="updateACLTable(\'' . $category . '\',\'' . $oneAction . '\');"', 'value', 'text', $custom ? 'special' : 'all'); $openDiv .= '<input type="hidden" name="aclcat[]" value="' . $category . '"/><div id="div_acl_' . $category . '"' . ($custom ? ' style="display:block"' : ' style="display:none"') . '>'; $return = $openDiv . $acltable . '</div>'; return $return; }
function fetchElement($name, $value, &$node, $control_name) { if (!(include_once rtrim(JPATH_ADMINISTRATOR, DS) . DS . 'components' . DS . 'com_hikashop' . DS . 'helpers' . DS . 'helper.php')) { return 'This menu options cannot be displayed without the Hikashop Component'; } $config =& hikashop_config(); if (!hikashop_isAllowed($config->get('acl_menus_manage', 'all'))) { return 'Access to the HikaShop options of the menus is restricted'; } $id = reset(JRequest::getVar('cid', array(), '', 'array')); if (!empty($id)) { $text = '<a title="' . JText::_('HIKASHOP_OPTIONS') . '" href="' . JRoute::_('index.php?option=com_hikashop&ctrl=menus&task=edit&cid[]=' . $id) . '" >' . JText::_('HIKASHOP_OPTIONS') . '</a>'; $config =& hikashop_config(); $hikashop_params = $config->get('menu_' . $id, null); if (empty($hikashop_params)) { $text .= '<br/>' . JText::_('HIKASHOP_SAVE_OPTIONS_ONCE'); } } else { $text = JText::_('HIKASHOP_OPTIONS_EDIT') . '<br/>' . JText::_('HIKASHOP_SAVE_OPTIONS_ONCE'); } return $text; }
function fetchElement($name, $value, &$node, $control_name) { if (!(include_once rtrim(JPATH_ADMINISTRATOR, DS) . DS . 'components' . DS . 'com_hikashop' . DS . 'helpers' . DS . 'helper.php')) { return 'This module can not work without the Hikashop Component'; } $id = hikashop_getCID('cid'); $plugins = hikashop_get('class.plugins'); $plugin = $plugins->get($id); $name = @$plugin->element; if (@$plugin->folder == 'hikashopshipping') { $group = 'shipping'; } elseif (@$plugin->folder == 'hikashop') { $group = 'plugin'; } else { $group = 'payment'; } $config =& hikashop_config(); if (!hikashop_isAllowed($config->get('acl_plugins_manage', 'all'))) { return 'Access to the HikaShop options of the plugins is restricted'; } $text = '<a style="float:left;" title="' . JText::_('HIKASHOP_OPTIONS') . '" href="' . JRoute::_('index.php?option=com_hikashop&ctrl=plugins&task=listing&name=' . $name . '&plugin_type=' . $group) . '" >' . JText::_('HIKASHOP_OPTIONS') . '</a>'; return $text; }
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(); if (empty($id)) { $error_message = JText::_('COUPON_NOT_FOR_PRODUCTS_IN_THOSE_CATEGORIES'); } } } $coupon->products = array(); if (!empty($coupon->discount_product_id)) { foreach ($products as $product) { if (!in_array($product->product_id, $coupon->discount_product_id)) { foreach ($products as $product2) { if ($product2->cart_product_id == $product->cart_product_parent_id && in_array($product2->product_id, $coupon->discount_product_id)) { $coupon->products[] = $product; } } } else { $coupon->products[] = $product; } } } else { if (!empty($id)) { foreach ($products as $product) { foreach ($id as $productid) { if ($product->product_id !== $productid[0]) { foreach ($products as $product2) { if ($product2->cart_product_id == $product->cart_product_parent_id && $product2->product_id == $productid[0]) { $coupon->products[] = $product; } } } else { $coupon->products[] = $product; } } } } else { foreach ($products as $product) { $coupon->products[] = $product; } $coupon->all_products = true; } } if (empty($error_message) && bccomp($coupon->discount_minimum_order, 0, 5)) { $currency->convertCoupon($coupon, $total->prices[0]->price_currency_id); $config =& hikashop_config(); $discount_before_tax = $config->get('discount_before_tax'); $var = 'price_value_with_tax'; if ($discount_before_tax) { $var = 'price_value'; } $total_amount = 0; if (!empty($coupon->products)) { foreach ($coupon->products as $product) { if ($product->cart_product_quantity > 0) { $total_amount += @$product->prices[0]->{$var}; } } } if ($coupon->discount_minimum_order > $total_amount) { $error_message = JText::sprintf('ORDER_NOT_EXPENSIVE_ENOUGH_FOR_COUPON', $currency->format($coupon->discount_minimum_order, $coupon->discount_currency_id)); } } if (empty($error_message) && (int) $coupon->discount_minimum_products > 0) { $qty = 0; if (!empty($coupon->products)) { foreach ($coupon->products as $product) { $qty += $product->cart_product_quantity; } } if ((int) $coupon->discount_minimum_products > $qty) { $error_message = JText::sprintf('NOT_ENOUGH_PRODUCTS_FOR_COUPON', (int) $coupon->discount_minimum_products); } } } } $dispatcher->trigger('onAfterCouponCheck', array(&$coupon, &$total, &$zones, &$products, &$display_error, &$error_message, &$do)); if (!empty($error_message)) { $class = hikashop_get('class.cart'); $class->update('', 0, 0, 'coupon'); if ($display_error) { JRequest::setVar('coupon_error_message', $error_message); } return null; } JRequest::setVar('coupon_error_message', ''); if ($do) { $currency->convertCoupon($coupon, $total->prices[0]->price_currency_id); if (!HIKASHOP_PHP5) { $coupon->total = $total; } else { if (!isset($coupon->total)) { $coupon->total = new stdClass(); } $coupon->total->prices = array(clone reset($total->prices)); } $this->recalculateDiscountValue($coupon, $products, $id); switch (@$coupon->discount_coupon_nodoubling) { case 1: case 2: $coupon = $this->addCoupon($coupon, $products, $currency, $coupon->discount_coupon_nodoubling); break; default: $currency->addCoupon($coupon->total, $coupon, $products, $id); break; } } return $coupon; }
function select_coupon() { $badge = JRequest::getVar('badge', 'false'); $this->assignRef('badge', $badge); $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.discount_id', 'cmd'); $pageInfo->filter->order->dir = $app->getUserStateFromRequest($this->paramBase . ".filter_order_Dir", 'filter_order_Dir', 'desc', 'word'); $pageInfo->search = $app->getUserStateFromRequest($this->paramBase . ".search", 'search', '', 'string'); $pageInfo->search = JString::strtolower(trim($pageInfo->search)); $pageInfo->filter->filter_type = $app->getUserStateFromRequest($this->paramBase . ".filter_type", 'filter_type', '', 'string'); $pageInfo->limit->value = $app->getUserStateFromRequest($this->paramBase . '.list_limit', 'limit', $app->getCfg('list_limit'), 'int'); if (empty($pageInfo->limit->value)) { $pageInfo->limit->value = 500; } $pageInfo->limit->start = $app->getUserStateFromRequest($this->paramBase . '.limitstart', 'limitstart', 0, 'int'); $database = JFactory::getDBO(); $searchMap = array('a.discount_code', 'a.discount_id'); $filters = array(); if ($badge != 'false') { $filters[] = 'a.discount_type="discount"'; } if (!empty($pageInfo->search)) { $searchVal = '\'%' . hikashop_getEscaped($pageInfo->search, true) . '%\''; $filters[] = implode(" LIKE {$searchVal} OR ", $searchMap) . " LIKE {$searchVal}"; } $query = ' FROM ' . hikashop_table('discount') . ' AS a'; if ($badge == 'false' && !empty($pageInfo->filter->filter_type)) { switch ($pageInfo->filter->filter_type) { case 'all': break; default: $filters[] = 'a.discount_type = ' . $database->Quote($pageInfo->filter->filter_type); break; } } 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(); if (!empty($pageInfo->search)) { $rows = hikashop_search($pageInfo->search, $rows, 'discount_id'); } $database->setQuery('SELECT count(*)' . $query); $pageInfo->elements = new stdClass(); $pageInfo->elements->total = $database->loadResult(); $pageInfo->elements->page = count($rows); if ($pageInfo->limit->value == 500) { $pageInfo->limit->value = 100; } hikashop_setTitle(JText::_($this->nameListing), $this->icon, $this->ctrl); $config =& hikashop_config(); $manage = hikashop_isAllowed($config->get('acl_discount_manage', 'all')); $this->assignRef('manage', $manage); $this->toolbar = array(array('name' => 'custom', 'icon' => 'copy', 'task' => 'copy', 'alt' => JText::_('HIKA_COPY'), 'display' => $manage), array('name' => 'addNew', 'display' => $manage), array('name' => 'editList', 'display' => $manage), array('name' => 'deleteList', 'display' => hikashop_isAllowed($config->get('acl_discount_delete', 'all'))), '|', array('name' => 'pophelp', 'target' => $this->ctrl . '-listing'), 'dashboard'); $discountType = hikashop_get('type.discount'); $this->assignRef('filter_type', $discountType); $toggleClass = hikashop_get('helper.toggle'); $this->assignRef('toggleClass', $toggleClass); $this->assignRef('rows', $rows); $this->assignRef('pageInfo', $pageInfo); $this->getPagination(); $currencyHelper = hikashop_get('class.currency'); $this->assignRef('currencyHelper', $currencyHelper); }
function listing() { $app = JFactory::getApplication(); $enabled = JPluginHelper::isEnabled('system', 'hikashopmassaction'); if (!$enabled) { if (HIKASHOP_J25) { $query = 'UPDATE ' . hikashop_table('extensions', false) . ' SET enabled = 1 WHERE type = "plugin" AND element = "hikashopmassaction" AND folder = "system";'; } else { $query = 'UPDATE ' . hikashop_table('plugins', false) . ' SET published = 1 WHERE element = "hikashopmassaction" AND folder = "system";'; } $db = JFactory::getDBO(); $db->setQuery($query); $success = $db->query(); if ($success) { $app->enqueueMessage(JText::_('HIKA_MASSACTION_SYSTEM_PLUGIN_PUBLISHED')); } } $pageInfo = new stdClass(); $pageInfo->filter = new stdClass(); $pageInfo->filter->order = new stdClass(); $pageInfo->limit = new stdClass(); $pageInfo->search = $app->getUserStateFromRequest($this->paramBase . ".search", 'search', '', 'string'); $pageInfo->filter->order->value = $app->getUserStateFromRequest($this->paramBase . ".filter_order", 'filter_order', 'a.massaction_id', 'cmd'); $pageInfo->filter->order->dir = $app->getUserStateFromRequest($this->paramBase . ".filter_order_Dir", 'filter_order_Dir', 'desc', 'word'); $pageInfo->limit->value = $app->getUserStateFromRequest($this->paramBase . '.list_limit', 'limit', $app->getCfg('list_limit'), 'int'); $pageInfo->limit->start = $app->getUserStateFromRequest($this->paramBase . '.limitstart', 'limitstart', 0, 'int'); $selectedType = $app->getUserStateFromRequest($this->paramBase . ".massaction_table", 'massaction_table', '', 'string'); $database = JFactory::getDBO(); $filters = array(); if (!empty($selectedType)) { $filters[] = 'a.massaction_table=' . $database->Quote($selectedType); } $searchMap = array('a.massaction_id', 'a.massaction_name', 'a.massaction_description', 'a.massaction_table'); if (!empty($pageInfo->search)) { $searchVal = '\'%' . hikashop_getEscaped(JString::strtolower(trim($pageInfo->search)), true) . '%\''; $filters[] = implode(" LIKE {$searchVal} OR ", $searchMap) . " LIKE {$searchVal}"; } $order = ''; if (!empty($pageInfo->filter->order->value)) { $order = ' ORDER BY ' . $pageInfo->filter->order->value . ' ' . $pageInfo->filter->order->dir; } if (!empty($filters)) { $filters = ' WHERE (' . implode(') AND (', $filters) . ')'; } else { $filters = ''; } $query = ' FROM ' . hikashop_table('massaction') . ' AS a ' . $filters . $order; $database->setQuery('SELECT a.*' . $query, (int) $pageInfo->limit->start, (int) $pageInfo->limit->value); $rows = $database->loadObjectList(); if (!empty($pageInfo->search)) { $rows = hikashop_search($pageInfo->search, $rows, 'massaction_id'); } $database->setQuery('SELECT COUNT(*)' . $query); $pageInfo->elements = new stdClass(); $pageInfo->elements->total = $database->loadResult(); $pageInfo->elements->page = count($rows); $toggleClass = hikashop_get('helper.toggle'); $this->assignRef('toggleClass', $toggleClass); $this->assignRef('rows', $rows); $this->assignRef('pageInfo', $pageInfo); $table = hikashop_get('type.masstable'); $this->assignRef('tabletype', $table); $this->assignRef('selectedType', $selectedType); hikashop_setTitle(JText::_($this->nameListing), $this->icon, $this->ctrl); $this->getPagination(); $config =& hikashop_config(); $manage = hikashop_isAllowed($config->get('acl_massaction_manage', 'all')); $this->assignRef('manage', $manage); $this->toolbar = array(array('name' => 'custom', 'icon' => 'copy', 'alt' => JText::_('HIKA_COPY'), 'task' => 'copy', 'display' => $manage), array('name' => 'addNew', 'display' => $manage), array('name' => 'editList', 'display' => $manage), array('name' => 'deleteList', 'display' => hikashop_isAllowed($config->get('acl_massaction_delete', 'all'))), '|', array('name' => 'pophelp', 'target' => $this->ctrl . '-listing'), 'dashboard'); }
function addHeader() { hikashop_setTitle(JText::_($this->nameListing), $this->icon, $this->ctrl); $config =& hikashop_config(); $manage = hikashop_isAllowed($config->get('acl_category_manage', 'all')); $this->assignRef('manage', $manage); $importIcon = 'upload'; if (HIKASHOP_J30) { $importIcon = 'import'; } $this->toolbar = array(array('name' => 'custom', 'icon' => $importIcon, 'alt' => JText::_('REBUILD'), 'task' => 'rebuild', 'check' => false, 'display' => $manage), array('name' => 'addNew', 'display' => $manage), array('name' => 'editList', 'display' => $manage), array('name' => 'deleteList', 'display' => hikashop_isAllowed($config->get('acl_category_delete', 'all'))), '|', array('name' => 'pophelp', 'target' => $this->ctrl . '-listing'), 'dashboard'); }
function listing() { $app = JFactory::getApplication(); $pageInfo = new stdClass(); $pageInfo->filter = new stdClass(); $pageInfo->filter->order = new stdClass(); $pageInfo->limit = new stdClass(); $pageInfo->filter->client_id = $app->getUserStateFromRequest(HIKASHOP_COMPONENT . '.client_id', 'client_id', 2, 'int'); $pageInfo->filter->template = $app->getUserStateFromRequest(HIKASHOP_COMPONENT . '.template', 'template', '', 'string'); $pageInfo->filter->component = $app->getUserStateFromRequest(HIKASHOP_COMPONENT . '.component', 'component', '', 'string'); $pageInfo->filter->viewType = $app->getUserStateFromRequest(HIKASHOP_COMPONENT . '.viewType', 'viewType', '', 'string'); $pageInfo->limit->value = $app->getUserStateFromRequest($this->paramBase . '.limit', 'limit', $app->getCfg('list_limit'), 'int'); if (empty($pageInfo->limit->value)) { $pageInfo->limit->value = 500; } 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->filter->order->value = $app->getUserStateFromRequest($this->paramBase . '.filter_order', 'filter_order', 'a.user_id', 'cmd'); $pageInfo->filter->order->dir = $app->getUserStateFromRequest($this->paramBase . '.filter_order_Dir', 'filter_order_Dir', 'desc', 'word'); $views = array(); switch ($pageInfo->filter->client_id) { case 0: $views[0] = HIKASHOP_FRONT . 'views' . DS; break; case 1: $views[1] = HIKASHOP_BACK . 'views' . DS; break; default: $views[0] = HIKASHOP_FRONT . 'views' . DS; $views[1] = HIKASHOP_BACK . 'views' . DS; break; } JPluginHelper::importPlugin('hikashop'); $dispatcher = JDispatcher::getInstance(); $pluginViews = array(); $dispatcher->trigger('onViewsListingFilter', array(&$pluginViews, $pageInfo->filter->client_id)); if (!empty($pluginViews)) { $i = 2; foreach ($pluginViews as $pluginView) { $views[$i++] = $pluginView; } } $this->assignRef('pluginViews', $pluginViews); jimport('joomla.filesystem.folder'); if (version_compare(JVERSION, '1.6', '<')) { require_once rtrim(JPATH_ADMINISTRATOR, DS) . DS . 'components' . DS . 'com_templates' . DS . 'helpers' . DS . 'template.php'; } $templates = array(); $templateValues = array(); foreach ($views as $client_id => $view) { $component_name = ''; $component = HIKASHOP_COMPONENT; if (is_array($view)) { $client_id = $view['client_id']; $component_name = $view['name']; $component = $view['component']; $view = $view['view']; } if (!empty($pageInfo->filter->component) && $pageInfo->filter->component != $component) { continue; } $folders = JFolder::folders($view); if (empty($folders)) { continue; } $clientTemplates = array(); foreach ($folders as $folder) { if (JFolder::exists($view . $folder . DS . 'tmpl')) { $files = JFolder::files($view . $folder . DS . 'tmpl'); if (!empty($files)) { foreach ($files as $file) { if (substr($file, -4) == '.php') { $obj = new stdClass(); $obj->path = $view . $folder . DS . 'tmpl' . DS . $file; $obj->filename = $file; $obj->folder = $view . $folder . DS . 'tmpl' . DS; $obj->client_id = $client_id; $obj->view = $folder; $obj->type = 'component'; $obj->type_name = $component; $obj->file = substr($file, 0, strlen($file) - 4); $clientTemplates[] = $obj; } } } } } if ($client_id == 0 && $component == HIKASHOP_COMPONENT) { $plugins_folder = rtrim(JPATH_PLUGINS, DS) . DS . 'hikashoppayment'; if (Jfolder::exists($plugins_folder)) { $files = Jfolder::files($plugins_folder); foreach ($files as $file) { if (preg_match('#^.*_(?!configuration).*\\.php$#', $file)) { $obj = new stdClass(); $obj->path = $plugins_folder . DS . $file; $obj->filename = $file; $obj->folder = $plugins_folder; $obj->client_id = $client_id; $obj->type = 'plugin'; $obj->view = ''; $obj->type_name = 'hikashoppayment'; $obj->file = substr($file, 0, strlen($file) - 4); $clientTemplates[] = $obj; } } } } if (!empty($clientTemplates)) { $client = JApplicationHelper::getClientInfo($client_id); $tBaseDir = $client->path . DS . 'templates'; if (version_compare(JVERSION, '1.6', '<')) { $joomlaTemplates = TemplatesHelper::parseXMLTemplateFiles($tBaseDir); } else { $query = 'SELECT * FROM ' . hikashop_table('extensions', false) . ' WHERE type=\'template\' AND client_id=' . (int) $client_id; $db = JFactory::getDBO(); $db->setQuery($query); $joomlaTemplates = $db->loadObjectList(); foreach ($joomlaTemplates as $k => $v) { $joomlaTemplates[$k]->assigned = $joomlaTemplates[$k]->protected; $joomlaTemplates[$k]->published = $joomlaTemplates[$k]->enabled; $joomlaTemplates[$k]->directory = $joomlaTemplates[$k]->element; } } for ($i = 0; $i < count($joomlaTemplates); $i++) { if (version_compare(JVERSION, '1.6', '<')) { $joomlaTemplates[$i]->assigned = TemplatesHelper::isTemplateAssigned($joomlaTemplates[$i]->directory); $joomlaTemplates[$i]->published = TemplatesHelper::isTemplateDefault($joomlaTemplates[$i]->directory, $client->id); } if ($joomlaTemplates[$i]->published || $joomlaTemplates[$i]->assigned) { if (!empty($pageInfo->filter->template) && $joomlaTemplates[$i]->directory != $pageInfo->filter->template) { continue; } $templateValues[$joomlaTemplates[$i]->directory] = $joomlaTemplates[$i]->directory; $templateFolder = $tBaseDir . DS . $joomlaTemplates[$i]->directory . DS; foreach ($clientTemplates as $template) { $templatePerJoomlaTemplate = clone $template; $templatePerJoomlaTemplate->template = $joomlaTemplates[$i]->directory; $templatePerJoomlaTemplate->component = $component_name; $templatePerJoomlaTemplate->override = $templateFolder . 'html' . DS . $template->type_name . DS; if ($template->type == 'component') { $templatePerJoomlaTemplate->override .= $template->view . DS; } $templatePerJoomlaTemplate->override .= $template->filename; $templatePerJoomlaTemplate->overriden = false; if (file_exists($templatePerJoomlaTemplate->override)) { $templatePerJoomlaTemplate->overriden = true; } $templatePerJoomlaTemplate->id = $templatePerJoomlaTemplate->client_id . '|' . $templatePerJoomlaTemplate->template . '|' . $templatePerJoomlaTemplate->type . '|' . $templatePerJoomlaTemplate->type_name . '|' . $templatePerJoomlaTemplate->view . '|' . $templatePerJoomlaTemplate->filename; $key = $templatePerJoomlaTemplate->client_id . '|' . $templatePerJoomlaTemplate->template . '|' . $templatePerJoomlaTemplate->type_name . '|' . $templatePerJoomlaTemplate->view . '|' . $templatePerJoomlaTemplate->filename; if (!empty($pageInfo->filter->viewType) && $templatePerJoomlaTemplate->view != $pageInfo->filter->viewType) { continue; } $templates[$key] = $templatePerJoomlaTemplate; } if (JFolder::exists($templateFolder . 'html' . DS . $component . DS)) { $folders = JFolder::folders($templateFolder . 'html' . DS . $component . DS); if (!empty($folders)) { foreach ($folders as $folder) { $files = JFolder::files($templateFolder . 'html' . DS . $component . DS . $folder); if (empty($files)) { continue; } foreach ($files as $file) { if (substr($file, -4) != '.php') { continue; } $filename = $templateFolder . 'html' . DS . $component . DS . $folder . DS . $file; $found = false; foreach ($templates as $tpl) { if ($tpl->override == $filename) { $found = true; break; } } if (!$found) { $obj = new stdClass(); $obj->path = $view . $folder . DS . 'tmpl' . DS . $file; $obj->filename = $file; $obj->folder = $view . $folder . DS . 'tmpl' . DS; $obj->client_id = $client_id; $obj->view = $folder; $obj->template = $joomlaTemplates[$i]->directory; $obj->type = 'component'; $obj->type_name = $component; $obj->file = substr($file, 0, strlen($file) - 4); $obj->override = $filename; $obj->overriden = true; $obj->id = $obj->client_id . '|' . $obj->template . '|' . $obj->type . '|' . $obj->type_name . '|' . $obj->view . '|' . $obj->filename; $key = $obj->client_id . '|' . $obj->template . '|' . $obj->view . '|' . $obj->filename; $templates[$key] = $obj; } } } } } } } } } ksort($templates); $searchMap = array('filename', 'view', 'template'); if (!empty($pageInfo->search)) { $unset = array(); foreach ($templates as $k => $template) { $found = false; foreach ($searchMap as $field) { if (strpos($template->{$field}, $pageInfo->search) !== false) { $found = true; } } if (!$found) { $unset[] = $k; } } if (!empty($unset)) { foreach ($unset as $u) { unset($templates[$u]); } } $templates = hikashop_search($pageInfo->search, $templates, 'id'); } $viewTypes = array('0' => JHTML::_('select.option', 0, JText::_('ALL_VIEWS'))); foreach ($templates as $temp) { if (!isset($viewTypes[strip_tags($temp->view)]) && !empty($temp->view)) { $viewTypes[strip_tags($temp->view)] = JHTML::_('select.option', strip_tags($temp->view), strip_tags($temp->view)); } } $pageInfo->elements = new stdClass(); $pageInfo->elements->total = count($templates); if ($pageInfo->limit->value == 500) { $pageInfo->limit->value = 100; } $this->assignRef('pageInfo', $pageInfo); $this->getPagination(); $templates = array_slice($templates, $this->pagination->limitstart, $this->pagination->limit); $pageInfo->elements->page = count($templates); $this->assignRef('viewTypes', $viewTypes); $this->assignRef('rows', $templates); $this->assignRef('templateValues', $templateValues); $viewType = hikashop_get('type.view'); $this->assignRef('viewType', $viewType); $templateType = hikashop_get('type.template'); $this->assignRef('templateType', $templateType); hikashop_setTitle(JText::_($this->nameListing), $this->icon, $this->ctrl); $config =& hikashop_config(); $manage = hikashop_isAllowed($config->get('acl_view_manage', 'all')); $this->assignRef('manage', $manage); $delete = hikashop_isAllowed($config->get('acl_view_delete', 'all')); $this->assignRef('delete', $delete); $this->toolbar = array(array('name' => 'pophelp', 'target' => $this->ctrl . '-listing'), 'dashboard'); jimport('joomla.client.helper'); $ftp = JClientHelper::setCredentialsFromRequest('ftp'); $this->assignRef('ftp', $ftp); }
function form() { $dashboard = false; $config =& hikashop_config(); $widget_id = hikashop_getCID('widget_id'); $class = hikashop_get('class.widget'); $db = JFactory::getDBO(); if (!empty($widget_id)) { $element = $class->get($widget_id); $task = 'edit'; } else { $element = new stdClass(); $element->widget_published = 1; $task = 'add'; $element->widget_params = new stdClass(); $element->widget_params->display = 'line'; $element->widget_params->content = 'sales'; $element->widget_params->date_group = '%j %Y'; $element->widget_params->date_type = 'created'; $element->widget_params->periodType = 'proposedPeriod'; $element->widget_params->proposedPeriod = 'thisMonth'; $element->widget_params->format = 'UTF-8'; $element->widget_params->period_compare = 'none'; $element->widget_name = 'New report ' . $widget_id; $element->widget_params->limit = '7'; } $class->loadDatas($element); if (isset($element->widget_params->table)) { $row_id = count($element->widget_params->table); $this->assignRef('row_id', $row_id); foreach ($element->widget_params->table as $row) { $class->loadDatas($row); } } else { $row_id = 0; $this->assignRef('row_id', $row_id); } if ($element->widget_params->display != 'table') { if ($element->widget_params->display != 'listing' && ($element->widget_params->content == 'products' || $element->widget_params->content == 'categories' || $element->widget_params->content == 'discount')) { $element->widget_params->content = 'orders'; } } hikashop_setTitle(JText::_($this->nameForm), $this->icon, $this->ctrl . '&task=' . $task . '&widget_id=' . $widget_id); $this->toolbar = array(array('name' => 'link', 'icon' => 'archive', 'alt' => JText::_('HIKA_EXPORT'), 'url' => hikashop_completeLink('report&task=csv&cid[]=' . $widget_id) . '&' . hikashop_getFormToken() . '=1', 'display' => hikashop_level(2) && !empty($widget_id) && hikashop_isAllowed($config->get('acl_report_view', 'all'))), '|', array('name' => 'save', 'display' => hikashop_isAllowed($config->get('acl_report_manage', 'all'))), array('name' => 'save2new', 'display' => version_compare(JVERSION, '1.7', '>=') && hikashop_isAllowed($config->get('acl_report_manage', 'all'))), array('name' => 'apply', 'display' => hikashop_isAllowed($config->get('acl_report_manage', 'all'))), 'cancel', '|', array('name' => 'pophelp', 'target' => $this->ctrl . '-form')); $this->assignRef('element', $element); $translation = false; $transHelper = hikashop_get('helper.translation'); if ($transHelper && $transHelper->isMulti()) { $translation = true; $transHelper->load('hikashop_widget', @$element->widget_id, $element); $config =& hikashop_config(); $multilang_display = $config->get('multilang_display', 'tabs'); if ($multilang_display == 'popups') { $multilang_display = 'tabs'; } $tabs = hikashop_get('helper.tabs'); $this->assignRef('tabs', $tabs); $this->assignRef('transHelper', $transHelper); } $toggle = hikashop_get('helper.toggle'); $this->assignRef('toggle', $toggle); $this->assignRef('translation', $translation); $currencyClass = hikashop_get('class.currency'); $this->assignRef('currencyHelper', $currencyClass); $periodType = hikashop_get('type.period'); $this->assignRef('periodType', $periodType); $widget_dataType = hikashop_get('type.widget_data'); $this->assignRef('widget_dataType', $widget_dataType); $status = hikashop_get('type.categorysub'); $status->type = 'status'; $this->assignRef('status', $status); $delay = hikashop_get('type.delay'); $this->assignRef('delay', $delay); $region = hikashop_get('type.region'); $this->assignRef('region', $region); if (hikashop_level(2)) { $encoding = hikashop_get('type.charset'); $this->assignRef('encoding', $encoding); } $widgetClass = hikashop_get('class.widget'); $this->assignRef('widgetClass', $widgetClass); $dateGroup = hikashop_get('type.dategroup'); $this->assignRef('dateGroup', $dateGroup); $dateType = hikashop_get('type.datetype'); $this->assignRef('dateType', $dateType); $shippingMethods = hikashop_get('type.plugins'); $shippingMethods->type = 'shipping'; $shippingMethods->manualOnly = true; $this->assignRef('shippingMethods', $shippingMethods); $paymentMethods = hikashop_get('type.plugins'); $paymentMethods->type = 'payment'; $paymentMethods->manualOnly = true; $this->assignRef('paymentMethods', $paymentMethods); $dashboard = JRequest::getVar('dashboard'); $this->assignRef('dashboard', $dashboard); $nameboxType = hikashop_get('type.namebox'); $this->assignRef('nameboxType', $nameboxType); JHTML::_('behavior.modal'); $script = "\r\n\tfunction deleteRow(divName,inputName,rowName){\r\n\t\tvar d = document.getElementById(divName);\r\n\t\tvar olddiv = document.getElementById(inputName);\r\n\t\tif(d && olddiv){\r\n\t\t\td.removeChild(olddiv);\r\n\t\t\tdocument.getElementById(rowName).style.display='none';\r\n\t\t}\r\n\t\treturn false;\r\n\t}\r\n\r\n\tfunction updatePeriodSelection(){\r\n\t\tselectedPeriod = document.getElementById('display_proposed_period').checked;\r\n\t\tdocument.getElementById('period_start').disabled=false;\r\n\t\tdocument.getElementById('period_end').disabled=false;\r\n\t\tdocument.getElementById('delayvalue1').disabled=false;\r\n\t\tdocument.getElementById('delaytype1').disabled=false;\r\n\t\tdocument.getElementById('datawidgetwidget_paramsproposedPeriod').disabled=false;\r\n\t\tif(selectedPeriod==true){\r\n\t\t\tdocument.getElementById('period_start').disabled=true;\r\n\t\t\tdocument.getElementById('period_end').disabled=true;\r\n\t\t\tdocument.getElementById('delayvalue1').disabled=true;\r\n\t\t\tdocument.getElementById('delaytype1').disabled=true;\r\n\t\t}else{\r\n\t\t\tdocument.getElementById('datawidgetwidget_paramsproposedPeriod').disabled=true;\r\n\t\t}\r\n\t}\r\n\r\n\tfunction updateCompare(){\r\n\t\tselectedCompare = document.getElementById('compare_with_values').checked;\r\n\t\tdocument.getElementById('compares_order_status').disabled=false;\r\n\t\tdocument.getElementById('compares_order_currency_id').disabled=false;\r\n\t\tdocument.getElementById('compares_order_payment_method').disabled=false;\r\n\t\tdocument.getElementById('compares_order_shipping_method').disabled=false;\r\n\t\tdocument.getElementById('compares_order_discount_code').disabled=false;\r\n\t\tdocument.getElementById('compares_products').disabled=false;\r\n\t\tdocument.getElementById('compares_categories').disabled=false;\r\n\t\tdocument.getElementById('compare_period').disabled=false;\r\n\t\tif(selectedCompare==true){\r\n\t\t\tdocument.getElementById('compare_period').disabled=true;\r\n\t\t}else{\r\n\t\t\tdocument.getElementById('compares_order_status').disabled=true;\r\n\t\t\tdocument.getElementById('compares_order_currency_id').disabled=true;\r\n\t\t\tdocument.getElementById('compares_order_payment_method').disabled=true;\r\n\t\t\tdocument.getElementById('compares_order_shipping_method').disabled=true;\r\n\t\t\tdocument.getElementById('compares_order_discount_code').disabled=true;\r\n\t\t\tdocument.getElementById('compares_products').disabled=true;\r\n\t\t\tdocument.getElementById('compares_categories').disabled=true;\r\n\t\t}\r\n\t}\r\n\r\n\tfunction updateDisplayType(){\r\n\t\ttheType=false;\r\n\t\tvalues = new Array('gauge', 'column', 'graph', 'line', 'pie', 'area', 'map', 'listing', 'table');\r\n\t\tfor(var i=0; i<values.length; i++){\r\n\t\t\tnewType = document.getElementById('widget_display_'+values[i]).checked;\r\n\t\t\tif(newType==true){\r\n\t\t\t\tdisplayType = document.getElementById('widget_display_'+values[i]).value;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(displayType=='pie'){\r\n\t\t\tvalues = new Array('orders', 'sales', 'taxes', 'partners', 'customers');\r\n\t\t\tfor(var i=0; i<values.length; i++){\r\n\t\t\t\tnewType = document.getElementById('type_'+values[i]).checked;\r\n\t\t\t\tif(newType==true){\r\n\t\t\t\t\t\ttheType = document.getElementById('type_'+values[i]).value;\r\n\t\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif(theType=='customers' || theType=='partners'){\r\n\t\t\t\t document.getElementById('type_orders').checked=true;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(displayType=='map'){\r\n\t\t\tvalues = new Array('orders', 'sales', 'taxes', 'partners', 'customers');\r\n\t\t\tfor(var i=0; i<values.length; i++){\r\n\t\t\t\tnewType = document.getElementById('type_'+values[i]).checked;\r\n\t\t\t\tif(newType==true){\r\n\t\t\t\t\ttheType = document.getElementById('type_'+values[i]).value;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tdocument.getElementById('map_options').style.display='none';\r\n\t\t\tdocument.getElementById('filters').style.display='';\r\n\t\t\tif(theType=='orders' || theType=='sales' || theType=='taxes'){\r\n\t\t\t\tdocument.getElementById('map_options').style.display='';\r\n\t\t\t}\r\n\t\t\tif(theType=='customers' || theType=='partners'){\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(displayType=='gauge' || displayType=='line' || displayType=='area' || displayType=='graph' || displayType=='column'){\r\n\t\t\tvalues = new Array('orders', 'sales', 'taxes', 'partners', 'customers');\r\n\t\t\tfor(var i=0; i<values.length; i++){\r\n\t\t\t\tnewType = document.getElementById('type_'+values[i]).checked;\r\n\t\t\t\tif(newType==true){\r\n\t\t\t\t\t\ttheType = document.getElementById('type_'+values[i]).value;\r\n\t\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif(theType==false){\r\n\t\t\t\ttheType='orders';\r\n\t\t\t \ttheType = document.getElementById('type_orders').checked=true;\r\n\t\t\t}\r\n\t\t\tdocument.getElementById('widget_compare').style.display='';\r\n\t\t\tif(theType=='orders' || theType=='sales' || theType=='taxes'){\r\n\t\t\t\tdocument.getElementById('widget_compare').style.display='';\r\n\t\t\t}\r\n\t\t\tif(theType=='customers' || theType=='partners'){\r\n\t\t\t\tdocument.getElementById('widget_compare').style.display='none';\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(displayType=='table'){\r\n\t\t\tdocument.getElementById('products_options').style.display='none';\r\n\t\t\tdocument.getElementById('filters').style.display='none';\r\n\t\t\tdocument.getElementById('customers_options').style.display='none';\r\n\t\t\tdocument.getElementById('partners_options').style.display='none';\r\n\t\t\tdocument.getElementById('orders_options').style.display='none';\r\n\t\t\tdocument.getElementById('product_datas').style.display='none';\r\n\t\t\tdocument.getElementById('widget_compare').style.display='none';\r\n\t\t\tdocument.getElementById('widget_limit').style.display='none';\r\n\t\t\tdocument.getElementById('widget_region').style.display='none';\r\n\t\t\tdocument.getElementById('map_options').style.display='none';\r\n\t\t}\r\n\t\tif(displayType!='listing'){ return 0; }\r\n\r\n\t\tvalues = new Array('orders', 'products', 'customers', 'partners', 'categories', 'discounts');\r\n\t\tfor(var i=0; i<values.length; i++){\r\n\t\t\tnewType = document.getElementById('type_'+values[i]).checked;\r\n\t\t\tif(newType==true){\r\n\t\t\t\ttheType = document.getElementById('type_'+values[i]).value;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(!theType){\r\n\t\t\tdocument.getElementById('type_orders').checked=true;\r\n\t\t\ttheType='orders';\r\n\t\t}\r\n\t\tdocument.getElementById('products_options').style.display='none';\r\n\t\tdocument.getElementById('filters').style.display='none';\r\n\t\tdocument.getElementById('customers_options').style.display='none';\r\n\t\tdocument.getElementById('partners_options').style.display='none';\r\n\t\tdocument.getElementById('orders_options').style.display='none';\r\n\t\tdocument.getElementById('product_datas').style.display='none';\r\n\r\n\t\tif(theType=='orders' || theType=='products' || theType=='categories' || theType=='discounts' || theType=='customers' || theType== 'partners'){\r\n\t\t\tdocument.getElementById('filters').style.display='';\r\n\t\t\tdocument.getElementById('product_datas').style.display='';\r\n\t\t\tif(theType=='categories'){\r\n\t\t\t\tdocument.getElementById('data_hits').style.display='none';\r\n\t\t\t\tclicksValue = document.getElementById('data_clicks').checked;\r\n\t\t\t\tif(clicksValue==true){\r\n\t\t\t\t\tdocument.getElementById('data_orders').checked=true;\r\n\t\t\t\t}\r\n\t\t\t}else if(theType=='products'){\r\n\t\t\t\tdocument.getElementById('data_hits').style.display='';\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(theType=='discounts'){\r\n\t\t\tdocument.getElementById('product_datas').style.display='none';\r\n\t\t}\r\n\t\tif(theType=='products' || theType=='categories' || theType=='discounts'){\r\n\t\t\tdocument.getElementById('products_options').style.display='';\r\n\t\t}\r\n\t\tif(theType=='customers'){\r\n\t\t\tdocument.getElementById('customers_options').style.display='';\r\n\t\t}\r\n\t\tif(theType=='partners'){\r\n\t\t\tdocument.getElementById('partners_options').style.display='';\r\n\t\t}\r\n\t\tif(theType=='orders'){\r\n\t\t\tdocument.getElementById('orders_options').style.display='';\r\n\t\t}\r\n\r\n\t}\r\n\twindow.hikashop.ready( function(){ updateDisplayType(); });\r\n\twindow.hikashop.ready( function(){ updatePeriodSelection(); });\r\n\twindow.hikashop.ready( function(){ updateCompare(); });\r\n\r\n\t\t\t\t"; if (!HIKASHOP_PHP5) { $doc =& JFactory::getDocument(); } else { $doc = JFactory::getDocument(); } $doc->addScriptDeclaration($script); $js = ''; $params = $element; echo hikashop_getLayout('dashboard', 'widget', $params, $js); }
function listing() { $app = JFactory::getApplication(); $pageInfo = new stdClass(); $pageInfo->filter = new stdClass(); $pageInfo->filter->order = new stdClass(); $pageInfo->limit = new stdClass(); $config =& hikashop_config(); $pageInfo->search = $app->getUserStateFromRequest($this->paramBase . ".search", 'search', '', 'string'); $pageInfo->limit->value = $app->getUserStateFromRequest($this->paramBase . '.limit', 'limit', $app->getCfg('list_limit'), 'int'); $pageInfo->limit->start = $app->getUserStateFromRequest($this->paramBase . '.limitstart', 'limitstart', 0, 'int'); $pageInfo->filter->order->value = $app->getUserStateFromRequest($this->paramBase . ".filter_order", 'filter_order', 'a.user_id', 'cmd'); $pageInfo->filter->order->dir = $app->getUserStateFromRequest($this->paramBase . ".filter_order_Dir", 'filter_order_Dir', 'desc', 'word'); jimport('joomla.filesystem.file'); $mail_folder = rtrim(str_replace('{root}', JPATH_ROOT, $config->get('mail_folder', HIKASHOP_MEDIA . 'mail' . DS)), '/\\') . DS; $files = array('cron_report', 'order_admin_notification', 'order_creation_notification', 'order_status_notification', 'order_notification', 'user_account', 'user_account_admin_notification', 'out_of_stock', 'order_cancel', 'waitlist_notification', 'waitlist_admin_notification', 'new_comment', 'contact_request', 'subscription_eot', 'massaction_notification'); $plugin_files = array(); JPluginHelper::importPlugin('hikashop'); $dispatcher = JDispatcher::getInstance(); $dispatcher->trigger('onMailListing', array(&$plugin_files)); if (!empty($plugin_files)) { $files = array_merge($files, $plugin_files); } $emails = array(); foreach ($files as $file) { $folder = $mail_folder; $filename = $file; $email = new stdClass(); if (is_array($file)) { $folder = $file['folder']; if (!empty($file['name'])) { $email->name = $file['name']; } $filename = $file['filename']; $file = $file['file']; } $email->file = $file; $email->overriden_text = JFile::exists($folder . $filename . '.text.modified.php'); $email->overriden_html = JFile::exists($folder . $filename . '.html.modified.php'); $email->overriden_preload = JFile::exists($folder . $filename . '.preload.modified.php'); $email->published = $config->get($file . '.published'); $emails[] = $email; } $pageInfo->elements = new stdClass(); $pageInfo->elements->total = count($emails); $emails = array_slice($emails, $pageInfo->limit->start, $pageInfo->limit->value); $pageInfo->elements->page = count($emails); $this->assignRef('rows', $emails); $this->assignRef('pageInfo', $pageInfo); hikashop_setTitle(JText::_($this->nameListing), $this->icon, $this->ctrl); $this->getPagination(); $this->toolbar = array(array('name' => 'pophelp', 'target' => $this->ctrl . '-listing'), 'dashboard'); $manage = hikashop_isAllowed($config->get('acl_email_manage', 'all')); $this->assignRef('manage', $manage); $delete = hikashop_isAllowed($config->get('acl_email_delete', 'all')); $this->assignRef('delete', $delete); jimport('joomla.client.helper'); $ftp = JClientHelper::setCredentialsFromRequest('ftp'); $this->assignRef('ftp', $ftp); $toggle = hikashop_get('helper.toggle'); $this->assignRef('toggleClass', $toggle); }
function listing() { $app = JFactory::getApplication(); $pageInfo = new stdClass(); $pageInfo->filter = new stdClass(); $pageInfo->filter->order = new stdClass(); $pageInfo->limit = new stdClass(); $pageInfo->search = $app->getUserStateFromRequest($this->paramBase . ".search", 'search', '', 'string'); $pageInfo->filter->order->value = $app->getUserStateFromRequest($this->paramBase . ".filter_order", 'filter_order', 'a.badge_id', 'cmd'); $pageInfo->filter->order->dir = $app->getUserStateFromRequest($this->paramBase . ".filter_order_Dir", 'filter_order_Dir', 'desc', 'word'); $pageInfo->limit->value = $app->getUserStateFromRequest($this->paramBase . '.list_limit', 'limit', $app->getCfg('list_limit'), 'int'); $pageInfo->limit->start = $app->getUserStateFromRequest($this->paramBase . '.limitstart', 'limitstart', 0, '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'); } $database = JFactory::getDBO(); $filters = array(); $searchMap = array('a.badge_id', 'a.badge_name', 'a.badge_position'); if (!empty($pageInfo->search)) { $searchVal = '\'%' . hikashop_getEscaped(JString::strtolower(trim($pageInfo->search)), true) . '%\''; $filters[] = implode(" LIKE {$searchVal} OR ", $searchMap) . " LIKE {$searchVal}"; } $order = ''; if (!empty($pageInfo->filter->order->value)) { $order = ' ORDER BY ' . $pageInfo->filter->order->value . ' ' . $pageInfo->filter->order->dir; } if (!empty($filters)) { $filters = ' WHERE (' . implode(') AND (', $filters) . ')'; } else { $filters = ''; } $query = ' FROM ' . hikashop_table('badge') . ' AS a' . $filters . $order; $database->setQuery('SELECT a.*' . $query, $pageInfo->limit->start, $pageInfo->limit->value); $rows = $database->loadObjectList(); if (!empty($pageInfo->search)) { $rows = hikashop_search($pageInfo->search, $rows, 'badge_id'); } $database->setQuery('SELECT count(*)' . $query); $pageInfo->elements = new stdClass(); $pageInfo->elements->total = $database->loadResult(); $pageInfo->elements->page = count($rows); if ($pageInfo->elements->page) { $types = array('product', 'category', 'discount'); foreach ($types as $type) { $ids = array(); $key = 'badge_' . $type . '_id'; foreach ($rows as $row) { if (empty($row->{$key})) { continue; } $row->{$key} = explode(',', $row->{$key}); foreach ($row->{$key} as $v) { if (is_numeric($v)) { $ids[$v] = $v; } else { $ids[$v] = $database->Quote($v); } } } if (!count($ids)) { continue; } $primary = $type . '_id'; if ($type == 'discount') { $name = $type . '_code'; } else { $name = $type . '_name'; } $query = 'SELECT * FROM ' . hikashop_table($type) . ' WHERE ' . $primary . ' IN (' . implode(',', $ids) . ')'; $database->setQuery($query); $elements = $database->loadObjectList(); foreach ($rows as $k => $row) { if (empty($row->{$key})) { continue; } $display = array(); foreach ($row->{$key} as $el) { foreach ($elements as $element) { if ($element->{$primary} == $el) { $display[] = $element->{$name}; $found = true; break; } } } if (!count($display)) { $display = array(JText::_(strtoupper($type) . '_NOT_FOUND')); } $rows[$k]->{$key} = implode(', ', $display); } } } $toggleClass = hikashop_get('helper.toggle'); $this->assignRef('toggleClass', $toggleClass); $image = hikashop_get('helper.image'); $this->assignRef('image', $image); $this->assignRef('rows', $rows); $this->assignRef('pageInfo', $pageInfo); $order = new stdClass(); $order->ordering = true; $order->orderUp = 'orderup'; $order->orderDown = 'orderdown'; $order->reverse = false; if ($pageInfo->filter->order->value == 'a.badge_ordering') { if ($pageInfo->filter->order->dir == 'desc') { $order->orderUp = 'orderdown'; $order->orderDown = 'orderup'; $order->reverse = true; } } $this->assignRef('order', $order); hikashop_setTitle(JText::_($this->nameListing), $this->icon, $this->ctrl); $this->getPagination(); $config =& hikashop_config(); $manage = hikashop_isAllowed($config->get('acl_badge_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_badge_delete', 'all'))), '|', array('name' => 'pophelp', 'target' => $this->ctrl . '-listing'), 'dashboard'); }
function process($toolbar) { $config =& hikashop_config(); if (!HIKASHOP_PHP5) { $bar =& JToolBar::getInstance('toolbar'); } else { $bar = JToolBar::getInstance('toolbar'); } foreach ($toolbar as $tool) { if (!empty($tool) && is_string($tool)) { $tool = array('name' => $tool); } if (empty($tool['name']) || isset($tool['display']) && $tool['display'] === false) { continue; } $toolname = $tool['name']; $standard = array('addNew' => array('new', 'add', 'New', false), 'makeDefault' => array('default', 'default', 'Default', false), 'assign' => array('assign', 'assign', 'Assign', false), 'publish' => array('publish', 'publish', 'Publish', false), 'publishList' => array('publish', 'publish', 'Publish', true), 'editList' => array('edit', 'edit', 'Edit', true), 'unpublish' => array('unpublish', 'unpublish', 'Unpublish', false), 'unpublishList' => array('unpublish', 'unpublish', 'Unpublish', true), 'trash' => array('trash', 'remove', 'Trash', true), 'apply' => array('apply', 'apply', 'Apply', false), 'copy' => array('copy', 'copy', 'HIKA_COPY', true), 'save' => array('save', 'save', 'Save', false), 'save2new' => array('save-new', 'save2new', 'JTOOLBAR_SAVE_AND_NEW', false), 'save2copy' => array('save-copy', 'save2copy', 'JTOOLBAR_SAVE_AS_COPY', false), 'cancel' => array('cancel', 'cancel', 'Cancel', false)); if (isset($standard[$toolname])) { $icon = $standard[$toolname][0]; $task = $standard[$toolname][1]; $alt = $standard[$toolname][2]; if (HIKASHOP_J16 && substr($alt, 0, 5) != 'JTOOL' && substr($alt, 0, 5) != 'HIKA_') { $alt = 'JTOOLBAR_' . strtoupper($alt); } $check = $standard[$toolname][3]; if (!empty($tool['icon'])) { $icon = $tool['icon']; } if (!empty($tool['task'])) { $task = $tool['task']; } if (isset($tool['alt'])) { $alt = $tool['alt']; } if (isset($tool['check'])) { $check = $tool['check']; } $bar->appendButton('Standard', $icon, $alt, $task, $check, false); continue; } $ret = $this->customTool($bar, strtolower($toolname), $tool); if (!$ret) { switch (strtolower($toolname)) { case '-': $width = ''; if (!empty($tool['width'])) { $width = (int) $tool['width']; } $bar->appendButton('Separator', 'spacer', $width); break; case '|': $bar->appendButton('Separator', 'divider'); break; case 'deletelist': $tool = array_merge(array('task' => 'remove', 'alt' => 'HIKA_DELETE', 'msg' => '', 'confirm' => true), $tool); if ($tool['confirm'] && empty($tool['msg'])) { $tool['msg'] = JText::_('HIKA_VALIDDELETEITEMS'); } if (!empty($tool['msg'])) { $bar->appendButton('Confirm', $tool['msg'], 'delete', $tool['alt'], $tool['task'], true); } else { $bar->appendButton('Standard', 'delete', $tool['alt'], $tool['task'], true); } break; case 'custom': $tool = array_merge(array('icon' => '', 'task' => '', 'alt' => '', 'check' => true, 'hide' => false), $tool); $bar->appendButton('Standard', $tool['icon'], $tool['alt'], $tool['task'], $tool['check'], $tool['hide']); break; case 'confirm': $tool = array_merge(array('icon' => '', 'task' => '', 'alt' => '', 'check' => true, 'hide' => false, 'msg' => ''), $tool); $bar->appendButton('Confirm', $tool['msg'], $tool['icon'], $tool['alt'], $tool['task'], $tool['check'], $tool['hide']); break; case 'preview': if (!empty($tool['target']) || !empty($tool['url'])) { $url = ''; if (!empty($tool['target'])) { $url = $tool['target']; } if (!empty($tool['url'])) { $url = $tool['url']; } $bar->appendButton('Popup', 'preview', 'Preview', $url . '&task=preview'); } break; case 'preferences': $tool = array_merge(array('component' => 'com_hikashop', 'path' => ''), $tool); $component = urlencode($tool['component']); $path = urlencode($tool['path']); if (HIKASHOP_J30) { $uri = (string) JUri::getInstance(); $return = urlencode(base64_encode($uri)); $bar->appendButton('Link', 'options', 'JToolbar_Options', 'index.php?option=com_config&view=component&component=' . $component . '&path=' . $path . '&return=' . $return); } else { $top = 0; $left = 0; $height = '550'; $width = '875'; $bar->appendButton('Popup', 'options', 'JToolbar_Options', 'index.php?option=com_config&view=component&component=' . $component . '&path=' . $path . '&tmpl=component', $width, $height, $top, $left, ''); } break; case 'help': break; case 'back': break; case 'link': $tool = array_merge(array('icon' => '', 'url' => '', 'alt' => ''), $tool); $bar->appendButton('Link', $tool['icon'], $tool['alt'], $tool['url']); break; case 'popup': $tool = array_merge(array('icon' => '', 'url' => '', 'alt' => '', 'width' => 640, 'height' => 480, 'top' => 0, 'left' => 0, 'onClose' => '', 'title' => '', 'footer' => ''), $tool); if (HIKASHOP_J30) { if (!empty($tool['id'])) { $tool['icon'] = $tool['id'] . '#' . $tool['icon']; } else { $tool['icon'] = $tool['icon'] . '#' . $tool['icon']; } } $bar->appendButton('HikaPopup', $tool['icon'], $tool['alt'], $tool['url'], $tool['width'], $tool['height'], $tool['top'], $tool['left'], $tool['onClose'], $tool['title'], $tool['footer']); break; case 'close': $bar->appendButton('Standard', 'cancel', JText::_('HIKA_CLOSE'), 'cancel', false, false); break; case 'hikacancel': $cancel_url = JRequest::getVar('cancel_redirect'); if (!empty($cancel_url) || !empty($tool['url'])) { if (!empty($cancel_url)) { $cancel_url = base64_decode($cancel_url); if (!hikashop_disallowUrlRedirect($cancel_url)) { $bar->appendButton('Link', 'cancel', JText::_('HIKA_CANCEL'), $cancel_url); } } else { $bar->appendButton('Link', 'cancel', JText::_('HIKA_CANCEL'), $tool['url']); } } else { $bar->appendButton('Standard', 'cancel', JText::_('HIKA_CANCEL'), 'cancel', false, false); } break; case 'pophelp': if (!empty($tool['target'])) { $bar->appendButton('Pophelp', $tool['target']); } break; case 'export': $bar->appendButton('Export'); break; case 'dashboard': if (hikashop_isAllowed($config->get('acl_dashboard_view', 'all'))) { $bar->appendButton('Link', 'hikashop', JText::_('HIKASHOP_CPANEL'), hikashop_completeLink('dashboard')); } break; } } } }
function listing() { $app = JFactory::getApplication(); $pageInfo = new stdClass(); $pageInfo->filter = new stdClass(); $pageInfo->filter->order = new stdClass(); $pageInfo->limit = new stdClass(); $pageInfo->search = $app->getUserStateFromRequest($this->paramBase . ".search", 'search', '', 'string'); $pageInfo->filter->order->value = $app->getUserStateFromRequest($this->paramBase . ".filter_order", 'filter_order', 'a.banner_id', 'cmd'); $pageInfo->filter->order->dir = $app->getUserStateFromRequest($this->paramBase . ".filter_order_Dir", 'filter_order_Dir', 'desc', 'word'); $pageInfo->limit->value = $app->getUserStateFromRequest($this->paramBase . '.list_limit', 'limit', $app->getCfg('list_limit'), 'int'); $pageInfo->limit->start = $app->getUserStateFromRequest($this->paramBase . '.limitstart', 'limitstart', 0, 'int'); $database = JFactory::getDBO(); $filters = array(); $searchMap = array('a.banner_id', 'a.banner_title', 'a.banner_url', 'a.banner_image_url'); if (!empty($pageInfo->search)) { $searchVal = '\'%' . hikashop_getEscaped(JString::strtolower(trim($pageInfo->search)), true) . '%\''; $filters[] = implode(" LIKE {$searchVal} OR ", $searchMap) . " LIKE {$searchVal}"; } $order = ''; if (!empty($pageInfo->filter->order->value)) { $order = ' ORDER BY ' . $pageInfo->filter->order->value . ' ' . $pageInfo->filter->order->dir; } if (!empty($filters)) { $filters = ' WHERE (' . implode(') AND (', $filters) . ')'; } else { $filters = ''; } $query = ' FROM ' . hikashop_table('banner') . ' AS a ' . $filters . $order; $database->setQuery('SELECT a.*' . $query, (int) $pageInfo->limit->start, (int) $pageInfo->limit->value); $rows = $database->loadObjectList(); if (!empty($pageInfo->search)) { $rows = hikashop_search($pageInfo->search, $rows, 'banner_id'); } $database->setQuery('SELECT COUNT(*)' . $query); $pageInfo->elements = new stdClass(); $pageInfo->elements->total = $database->loadResult(); $pageInfo->elements->page = count($rows); $toggleClass = hikashop_get('helper.toggle'); $this->assignRef('toggleClass', $toggleClass); $this->assignRef('rows', $rows); $this->assignRef('pageInfo', $pageInfo); $order = new stdClass(); $order->ordering = true; $order->orderUp = 'orderup'; $order->orderDown = 'orderdown'; $order->reverse = false; if ($pageInfo->filter->order->value == 'a.banner_ordering') { if ($pageInfo->filter->order->dir == 'desc') { $order->orderUp = 'orderdown'; $order->orderDown = 'orderup'; $order->reverse = true; } } $this->assignRef('order', $order); hikashop_setTitle(JText::_($this->nameListing), $this->icon, $this->ctrl); $this->getPagination(); $config =& hikashop_config(); $manage = hikashop_isAllowed($config->get('acl_banner_manage', 'all')); $this->assignRef('manage', $manage); $this->toolbar = array(array('name' => 'addNew', 'display' => $manage), array('name' => 'editList', 'display' => $manage), array('name' => 'deleteList', 'display' => hikashop_isAllowed($config->get('acl_banner_delete', 'all'))), '|', array('name' => 'pophelp', 'target' => $this->ctrl . '-listing'), 'dashboard'); }
function listing() { $app = JFactory::getApplication(); $db = JFactory::getDBO(); $config =& hikashop_config(); $this->assignRef('config', $config); $toggle = hikashop_get('helper.toggle'); $this->assignRef('toggleClass', $toggle); $manage = hikashop_isAllowed($config->get('acl_user_manage', 'all')); $this->assignRef('manage', $manage); hikashop_setTitle(JText::_($this->nameListing), $this->icon, $this->ctrl); $cfg = array('table' => 'user', 'main_key' => 'user_id', 'order_sql_value' => 'huser.user_id', 'order_sql_accept' => array('huser.', 'juser.')); $searchMap = array('huser.user_id', 'huser.user_email', 'juser.username', 'juser.email', 'juser.name'); $pageInfo = $this->getPageInfo($cfg['order_sql_value']); $pageInfo->filter->filter_partner = $app->getUserStateFromRequest($this->paramBase . '.filter_partner', 'filter_partner', '', 'int'); $filters = array(); $order = ''; if (!empty($pageInfo->filter->filter_partner)) { if ($pageInfo->filter->filter_partner == 1) { $filters[] = 'huser.user_partner_activated = 1'; $db->setQuery('DROP TABLE IF EXISTS ' . hikashop_table('click_view') . ', ' . hikashop_table('sale_view') . ', ' . hikashop_table('lead_view')); $db->query(); $query = 'CREATE OR REPLACE VIEW ' . hikashop_table('click_view') . ' AS SELECT a.user_id, SUM(b.click_partner_price) AS click_price FROM ' . hikashop_table('user') . ' AS a LEFT JOIN ' . hikashop_table('click') . ' AS b ON a.user_id=b.click_partner_id AND (CASE WHEN a.user_currency_id=0 THEN ' . hikashop_getCurrency() . ' ELSE a.user_currency_id END)=b.click_partner_currency_id WHERE a.user_partner_activated=1 AND b.click_partner_paid=0 GROUP BY b.click_partner_id;'; $db->setQuery($query); $db->query(); $partner_valid_status_list = explode(',', $config->get('partner_valid_status', 'confirmed,shipped')); foreach ($partner_valid_status_list as $k => $partner_valid_status) { $partner_valid_status_list[$k] = $db->Quote($partner_valid_status); } $query = 'CREATE OR REPLACE VIEW ' . hikashop_table('sale_view') . ' AS SELECT a.user_id, SUM(b.order_partner_price) AS sale_price FROM ' . hikashop_table('user') . ' AS a LEFT JOIN ' . hikashop_table('order') . ' AS b ON a.user_id=b.order_partner_id AND (CASE WHEN a.user_currency_id=0 THEN ' . hikashop_getCurrency() . ' ELSE a.user_currency_id END)=b.order_partner_currency_id WHERE a.user_partner_activated=1 AND b.order_partner_paid=0 AND b.order_type=\'sale\' AND b.order_status IN (' . implode(',', $partner_valid_status_list) . ') GROUP BY b.order_partner_id;'; $db->setQuery($query); $db->query(); $query = 'CREATE OR REPLACE VIEW ' . hikashop_table('lead_view') . ' AS SELECT a.user_id, SUM(b.user_partner_price) AS lead_price FROM ' . hikashop_table('user') . ' AS a LEFT JOIN ' . hikashop_table('user') . ' AS b ON a.user_id=b.user_partner_id AND (CASE WHEN a.user_currency_id=0 THEN ' . hikashop_getCurrency() . ' ELSE a.user_currency_id END)=b.user_partner_currency_id WHERE a.user_partner_activated=1 AND b.user_partner_paid=0 GROUP BY b.user_partner_id;'; $db->setQuery($query); $db->query(); $db->setQuery('UPDATE ' . hikashop_table('user') . ' SET user_unpaid_amount=0'); $db->query(); $query = 'UPDATE ' . hikashop_table('user') . ' AS a JOIN ' . hikashop_table('click_view') . ' AS b ON a.user_id=b.user_id SET a.user_unpaid_amount=b.click_price WHERE a.user_partner_activated=1'; $db->setQuery($query); $db->query(); $query = 'UPDATE ' . hikashop_table('user') . ' AS a JOIN ' . hikashop_table('sale_view') . ' AS b ON a.user_id=b.user_id SET a.user_unpaid_amount=a.user_unpaid_amount+b.sale_price WHERE a.user_partner_activated=1'; $db->setQuery($query); $db->query(); $query = 'UPDATE ' . hikashop_table('user') . ' AS a JOIN ' . hikashop_table('lead_view') . ' AS b ON a.user_id=b.user_id SET a.user_unpaid_amount=a.user_unpaid_amount+b.lead_price WHERE a.user_partner_activated=1'; $db->setQuery($query); $db->query(); $db->setQuery('DROP VIEW IF EXISTS ' . hikashop_table('click_view') . ', ' . hikashop_table('sale_view') . ', ' . hikashop_table('lead_view')); $db->query(); $currencyClass = hikashop_get('class.currency'); $this->assignRef('currencyHelper', $currencyClass); } else { $filters[] = 'huser.user_partner_activated=0'; } } $fieldsClass = hikashop_get('class.field'); $this->assignRef('fieldsClass', $fieldsClass); $fields = $fieldsClass->getData('backend_listing', 'user', false); $this->assignRef('fields', $fields); foreach ($fields as $field) { $searchMap[] = 'huser.' . $field->field_namekey; } $this->processFilters($filters, $order, $searchMap, $cfg['order_sql_accept']); $query = ' FROM ' . hikashop_table($cfg['table']) . ' AS huser LEFT JOIN ' . hikashop_table('users', false) . ' AS juser ON huser.user_cms_id = juser.id ' . $filters . $order; $db->setQuery('SELECT huser.*, juser.* ' . $query, (int) $pageInfo->limit->start, (int) $pageInfo->limit->value); $rows = $db->loadObjectList(); $fieldsClass->handleZoneListing($fields, $rows); foreach ($rows as $k => $row) { if (!empty($row->user_params)) { $rows[$k]->user_params = unserialize($row->user_params); } } if (!empty($pageInfo->search)) { $rows = hikashop_search($pageInfo->search, $rows, $cfg['main_key']); } $this->assignRef('rows', $rows); $db->setQuery('SELECT COUNT(*) ' . $query); $pageInfo->elements = new stdClass(); $pageInfo->elements->total = $db->loadResult(); $pageInfo->elements->page = count($rows); $this->getPagination(); $this->getOrdering('huser.user_id', true); $partner = hikashop_get('type.user_partner'); $this->assignRef('partner', $partner); $affiliate_plugin = JPluginHelper::getPlugin('system', 'hikashopaffiliate'); $affiliate_active = !empty($affiliate_plugin); $this->assignRef('affiliate_active', $affiliate_active); if ($pageInfo->filter->filter_partner == 1) { $acl = 'acl_affiliates_delete'; } else { $acl = 'acl_user_delete'; } $this->toolbar = array(array('name' => 'editList', 'display' => $manage), array('name' => 'deleteList', 'check' => JText::_('HIKA_VALIDDELETEITEMS'), 'display' => hikashop_isAllowed($config->get($acl, 'all'))), '|', array('name' => 'pophelp', 'target' => $this->ctrl . '-listing'), 'dashboard'); return true; }
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)) { $app->enqueueMessage('The dimension unit "' . $symbol . '" is not in the list of possible units : ' . implode(',', $possibleSymbols)); } else { $okSymbols[] = $symbol; } } $formData['volume_symbols'] = implode(',', $okSymbols); } if (!isset($this->wizard) && empty($formData['volume_symbols'])) { $app->enqueueMessage('No valid dimension unit entered. The system put back the default units.'); $formData['volume_symbols'] = 'm,dm,cm,mm,in,ft,yd'; } if (!isset($this->wizard) && $formData['force_ssl'] == 'url' && empty($formData['force_ssl_url'])) { $formData['force_ssl'] = 'no'; $app->enqueueMessage('No ssl url specified, force ssl parametre setted to no'); } if (!empty($formData['order_number_format'])) { $formData['order_number_format'] = str_replace('"}"', '"}', $formData['order_number_format']); } $config =& hikashop_config(); $status = $config->save($formData); if ($status) { $app->enqueueMessage(JText::_('HIKASHOP_SUCC_SAVED')); } else { $app->enqueueMessage(JText::_('ERROR_SAVING'), 'error'); } $pluginsClass = hikashop_get('class.plugins'); $paramsPlugins = JRequest::getVar('params', array(), '', 'array'); foreach ($paramsPlugins as $group => $paramsPluginsOneGroup) { foreach ($paramsPluginsOneGroup as $name => $paramsPlugin) { $plugin = $pluginsClass->getByName($group, $name); if (!empty($plugin)) { $plugin->params = $paramsPlugin; $pluginsClass->save($plugin); } } } $js = "\r\n\t\t\tfunction setVisible(value){\r\n\t\t\t\tvalue=parseInt(value);\r\n\t\t\t\tif(value==1){\r\n\t\t\t\t\tdocument.getElementById('sef_cat_name').style.display = '';\r\n\t\t\t\t\tdocument.getElementById('sef_prod_name').style.display = '';\r\n\t\t\t\t}else{\r\n\t\t\t\t\tdocument.getElementById('sef_cat_name').style.display = 'none';\r\n\t\t\t\t\tdocument.getElementById('sef_prod_name').style.display = 'none';\r\n\t\t\t\t}\r\n\t\t\t}"; if (!HIKASHOP_PHP5) { $doc =& JFactory::getDocument(); } else { $doc = JFactory::getDocument(); } $doc->addScriptDeclaration($js); $config->load(); }
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.zone_id', 'cmd'); $pageInfo->filter->order->dir = $app->getUserStateFromRequest($this->paramBase . ".filter_order_Dir", 'filter_order_Dir', 'asc', 'word'); $selectedType = $app->getUserStateFromRequest($this->paramBase . ".filter_type", 'filter_type', '', 'string'); $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)); if (empty($pageInfo->limit->value)) { $pageInfo->limit->value = 500; } $database = JFactory::getDBO(); $searchMap = array('a.zone_code_3', 'a.zone_code_2', 'a.zone_name_english', 'a.zone_name', 'a.zone_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('zone') . ' AS a'; if (!empty($selectedType)) { $filters[] = 'a.zone_type = ' . $database->Quote($selectedType); if ($selectedType == 'state') { $selectedCountry = $app->getUserStateFromRequest($this->paramBase . ".filter_country", 'filter_country', 0, 'int'); if ($selectedCountry) { $query = ' FROM ' . hikashop_table('zone') . ' AS c LEFT JOIN ' . hikashop_table('zone_link') . ' AS b ON c.zone_namekey=b.zone_parent_namekey LEFT JOIN ' . hikashop_table('zone') . ' AS a ON b.zone_child_namekey=a.zone_namekey'; $filters[] = 'c.zone_id = ' . $database->Quote($selectedCountry); } } } 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(); if (!empty($pageInfo->search)) { $rows = hikashop_search($pageInfo->search, $rows, 'zone_id'); } $database->setQuery('SELECT count(*)' . $query); $pageInfo->elements = new stdClass(); $pageInfo->elements->total = $database->loadResult(); $pageInfo->elements->page = count($rows); if ($pageInfo->limit->value == 500) { $pageInfo->limit->value = 100; } hikashop_setTitle(JText::_($this->nameListing), $this->icon, $this->ctrl); $config =& hikashop_config(); $manage = hikashop_isAllowed($config->get('acl_zone_manage', 'all')); $this->assignRef('manage', $manage); $this->toolbar = array(array('name' => 'publishList', 'display' => $manage), array('name' => 'unpublishList', 'display' => $manage), '|', array('name' => 'custom', 'icon' => 'copy', 'alt' => JText::_('HIKA_COPY'), 'task' => 'copy', 'display' => $manage), array('name' => 'addNew', 'display' => $manage), array('name' => 'editList', 'display' => $manage), array('name' => 'deleteList', 'display' => hikashop_isAllowed($config->get('acl_zone_delete', 'all'))), '|', array('name' => 'pophelp', 'target' => $this->ctrl . '-listing'), 'dashboard'); $filters = new stdClass(); $zoneType = hikashop_get('type.zone'); $filters->type = $zoneType->display('filter_type', $selectedType); if ($selectedType == 'state') { $countryType = hikashop_get('type.country'); $filters->country = $countryType->display('filter_country', $selectedCountry); } else { $filters->country = ''; } $toggleClass = hikashop_get('helper.toggle'); $this->assignRef('filters', $filters); $this->assignRef('toggleClass', $toggleClass); $this->assignRef('rows', $rows); $this->assignRef('pageInfo', $pageInfo); $this->getPagination(); }
function variant_legacy() { $app = JFactory::getApplication(); $database = JFactory::getDBO(); $filters = array(); $product_id = JRequest::getInt('parent_id'); if (empty($product_id)) { $product_id = hikashop_getCID('product_id'); } $characteristics = false; $filters[] = 'a.variant_product_id = ' . $product_id; $query = 'SELECT a.* FROM ' . hikashop_table('variant') . ' AS a WHERE ' . implode(' AND ', $filters) . ' ORDER BY a.variant_product_id ASC'; $database->setQuery($query); $variants = $database->loadObjectList(); if (count($variants)) { $filters = array(); $filters[] = 'a.product_parent_id = ' . $product_id; $query = 'SELECT a.* FROM ' . hikashop_table('product') . ' AS a WHERE ' . implode(' AND ', $filters); $database->setQuery($query); $rows = $database->loadObjectList(); $characteristics = $this->_getCharacteristics($product_id); if (count($rows)) { $this->_loadPrices($rows); $ids = array(); foreach ($rows as $row) { $ids[] = $row->product_id; } $query = 'SELECT a.variant_product_id,b.* FROM ' . hikashop_table('variant') . ' AS a LEFT JOIN ' . hikashop_table('characteristic') . ' AS b ON a.variant_characteristic_id=b.characteristic_id WHERE variant_product_id IN (' . implode(',', $ids) . ')'; $database->setQuery($query); $variants = $database->loadObjectList(); if (!empty($variants)) { foreach ($variants as $variant) { foreach ($rows as $k => $row) { if ($variant->variant_product_id == $row->product_id) { $name = false; foreach ($characteristics as $characteristic) { if ($characteristic->characteristic_id == $variant->characteristic_parent_id) { $name = $characteristic->characteristic_value; break; } } if ($name !== false) { $rows[$k]->characteristics[$name] = $variant->characteristic_value; } break; } } } } } $config =& hikashop_config(); $this->toolbar = array(array('name' => 'publishList'), array('name' => 'unpublishList'), '|', array('name' => 'link', 'icon' => 'new', 'alt' => JText::_('HIKA_NEW'), 'url' => hikashop_completeLink('product&task=edit&variant=1&parent_id=' . $product_id)), array('name' => 'editList'), array('name' => 'deleteList', 'display' => hikashop_isAllowed($config->get('acl_product_delete', 'all')))); $this->assignRef('rows', $rows); $this->assignRef('characteristics', $characteristics); } else { $app->enqueueMessage(JText::_('CHARACTERISTICS_FIRST')); } hikashop_setTitle(JText::_('VARIANTS'), $this->icon, 'product&task=variant&cid=' . $product_id); $this->toolbar[] = array('name' => 'link', 'icon' => 'cancel', 'alt' => JText::_('GO_TO_MAIN_PRODUCT'), 'url' => hikashop_completeLink('product&task=edit&cid=' . $product_id)); $this->toolbar[] = '|'; $this->toolbar[] = array('name' => 'pophelp', 'target' => $this->ctrl . 'variant-listing'); $this->toolbar[] = 'dashboard'; $currencyClass = hikashop_get('class.currency'); $this->assignRef('currencyHelper', $currencyClass); $this->assignRef('product_id', $product_id); $toggle = hikashop_get('helper.toggle'); $this->assignRef('toggleClass', $toggle); $fieldsClass = hikashop_get('class.field'); $query = 'SELECT category_id FROM ' . hikashop_table('product_category') . ' WHERE product_id =' . (int) $product_id; $database->setQuery($query); if (!HIKASHOP_J25) { $cat_ids = $database->loadResultArray(); } else { $cat_ids = $database->loadColumn(); } $parent_cat_ids = array(); if (!empty($cat_ids)) { $categoryClass = hikashop_get('class.category'); $parents = $categoryClass->getParents($cat_ids, true, array(), '', 0, 0); if (!empty($parents)) { foreach ($parents as $parent) { $parent_cat_ids[] = $parent->category_id; } } } $categories = array('originals' => $cat_ids, 'parents' => $parent_cat_ids); $fields = $fieldsClass->getData('backend_listing', 'product', false, $categories); $this->assignRef('fields', $fields); $this->assignRef('fieldsClass', $fieldsClass); }
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.taxation_id', 'cmd'); $pageInfo->filter->order->dir = $app->getUserStateFromRequest($this->paramBase . ".filter_order_Dir", 'filter_order_Dir', 'desc', 'word'); $pageInfo->limit->value = $app->getUserStateFromRequest($this->paramBase . '.list_limit', 'limit', $app->getCfg('list_limit'), 'int'); $pageInfo->limit->start = $app->getUserStateFromRequest($this->paramBase . '.limitstart', 'limitstart', 0, 'int'); $pageInfo->filter->taxation_date_start = $app->getUserStateFromRequest(HIKASHOP_COMPONENT . '.taxation_date_start', 'taxation_date_start', '', 'string'); $pageInfo->filter->taxation_date_end = $app->getUserStateFromRequest(HIKASHOP_COMPONENT . '.taxation_date_end', 'taxation_date_end', '', 'string'); $pageInfo->filter->tax_namekey = $app->getUserStateFromRequest(HIKASHOP_COMPONENT . '.tax_namekey', 'tax_namekey', '', 'string'); $pageInfo->filter->taxation_type = $app->getUserStateFromRequest(HIKASHOP_COMPONENT . '.taxation_type', 'taxation_type', '', 'string'); $pageInfo->filter->taxation_site_id = $app->getUserStateFromRequest(HIKASHOP_COMPONENT . '.taxation_site_id', 'taxation_site_id', '', 'string'); $database = JFactory::getDBO(); $filters = array(); if (!empty($pageInfo->filter->taxation_date_start)) { $filters[] = '(' . hikashop_getTime($pageInfo->filter->taxation_date_start) . '<=a.taxation_date_start' . ' OR ' . hikashop_getTime($pageInfo->filter->taxation_date_start) . '<=a.taxation_date_end' . ' OR a.taxation_date_end=0' . ')'; } if (!empty($pageInfo->filter->taxation_date_end)) { $filters[] = '(' . 'a.taxation_date_start<=' . hikashop_getTime($pageInfo->filter->taxation_date_end) . ' OR (a.taxation_date_start<=a.taxation_date_end AND a.taxation_date_end<=' . hikashop_getTime($pageInfo->filter->taxation_date_end) . ')' . ' OR a.taxation_date_start=0' . ')'; } if (!empty($pageInfo->filter->tax_namekey)) { $filters[] = 'a.tax_namekey=' . $database->Quote($pageInfo->filter->tax_namekey); } if (!empty($pageInfo->filter->taxation_type)) { $filters[] = '(a.taxation_type=' . $database->Quote($pageInfo->filter->taxation_type) . ' OR taxation_type LIKE \'%' . hikashop_getEscaped($pageInfo->filter->taxation_type, true) . '%\')'; } if (!empty($pageInfo->filter->taxation_site_id) && $pageInfo->filter->taxation_site_id != '[unselected]') { $filters[] = 'a.taxation_site_id=' . $database->Quote($pageInfo->filter->taxation_site_id); } JPluginHelper::importPlugin('hikashop'); $dispatcher = JDispatcher::getInstance(); $dispatcher->trigger('onBeforeTaxationListing', array($this->paramBase, &$this->extrafilters, &$pageInfo, &$filters)); $order = ''; if (!empty($pageInfo->filter->order->value)) { $order = ' ORDER BY ' . $pageInfo->filter->order->value . ' ' . $pageInfo->filter->order->dir; } if (!empty($filters)) { $filters = ' WHERE (' . implode(') AND (', $filters) . ')'; } else { $filters = ''; } $query = ' FROM ' . hikashop_table('taxation') . ' AS a LEFT JOIN ' . hikashop_table('tax') . ' AS b ON a.tax_namekey=b.tax_namekey LEFT JOIN ' . hikashop_table('category') . ' AS c ON a.category_namekey=c.category_namekey AND a.category_namekey!=\'\' AND c.category_type=\'tax\'' . $filters . $order; $database->setQuery('SELECT b.*,c.*,a.*' . $query, (int) $pageInfo->limit->start, (int) $pageInfo->limit->value); $rows = $database->loadObjectList(); $database->setQuery('SELECT COUNT(*)' . $query); $pageInfo->elements = new stdClass(); $pageInfo->elements->total = $database->loadResult(); $pageInfo->elements->page = count($rows); $config =& hikashop_config(); $this->assignRef('config', $config); if ($pageInfo->elements->page) { $zones = array(); foreach ($rows as $row) { if (empty($row->zone_namekey)) { continue; } $tax_zones = explode(',', $row->zone_namekey); foreach ($tax_zones as $zone) { if (!empty($zone)) { $zones[] = $database->Quote($zone); } } } if (count($zones)) { $database->setQuery('SELECT * FROM #__hikashop_zone WHERE zone_namekey IN (' . implode(',', $zones) . ');'); $zones = $database->loadObjectList('zone_namekey'); foreach ($rows as $k => $row) { if (empty($row->zone_namekey)) { continue; } $tax_zones = explode(',', $row->zone_namekey); $rows[$k]->zone_namekey = array(); foreach ($tax_zones as $zone) { if (empty($zone)) { continue; } if (isset($zones[$zone])) { $rows[$k]->zone_namekey[] = $zones[$zone]; } else { $rows[$k]->zone_namekey[] = $zone; } } } } foreach ($rows as $k => $row) { $restrictions = array(); if (!empty($row->zone_namekey)) { $zones = array(); foreach ($row->zone_namekey as $zone) { if (is_string($zone)) { $zones[] = $zone; continue; } if (hikashop_isAllowed($config->get('acl_zone_manage', 'all'))) { $zones[] = $zone->zone_name_english . '<a href="' . hikashop_completeLink('zone&task=edit&zone_id=' . $zone->zone_id) . '"><img class="hikashop_go" src="' . HIKASHOP_IMAGES . 'go.png" alt="go" /></a>'; } else { $zones[] = $zone->zone_name_english; } } if (count($zones)) { $restrictions['ZONE'] = implode(', ', $zones); } } if (!empty($row->taxation_post_code)) { $restrictions['POST_CODE'] = $row->taxation_post_code; } if (!empty($row->taxation_type)) { $row->taxation_type = explode(',', strtoupper(trim($row->taxation_type, ','))); $types = array(); foreach ($row->taxation_type as $type) { $types[] = JText::_($type); } $restrictions['CUSTOMER_TYPE'] = implode(', ', $types); } if (!empty($row->taxation_date_start)) { $restrictions['START_DATE'] = hikashop_getDate($row->taxation_date_start, '%Y-%m-%d %H:%M'); } if (!empty($row->taxation_end_start)) { $restrictions['END_DATE'] = hikashop_getDate($row->taxation_end_start, '%Y-%m-%d %H:%M'); } $rows[$k]->restrictions = $restrictions; } } $toggleClass = hikashop_get('helper.toggle'); $this->assignRef('toggleClass', $toggleClass); $this->assignRef('rows', $rows); $this->assignRef('pageInfo', $pageInfo); $taxType = hikashop_get('type.tax'); $this->assignRef('taxType', $taxType); $ratesType = hikashop_get('type.rates'); $this->assignRef('ratesType', $ratesType); hikashop_setTitle(JText::_($this->nameListing), $this->icon, $this->ctrl); $this->getPagination(); $manage = hikashop_isAllowed($config->get('acl_taxation_manage', 'all')); $this->assignRef('manage', $manage); $this->toolbar = array(array('name' => 'link', 'icon' => 'edit', 'alt' => JText::_('MANAGE_TAX_CATEGORIES'), 'url' => hikashop_completeLink('category&filter_id=tax'), 'display' => $manage), array('name' => 'link', 'icon' => 'edit', 'alt' => JText::_('MANAGE_RATES'), 'url' => hikashop_completeLink('tax&return=taxation'), 'display' => $manage), array('name' => '|', 'display' => $manage), array('name' => 'addNew', 'display' => $manage), array('name' => 'editList', 'display' => $manage), array('name' => 'deleteList', 'display' => hikashop_isAllowed($config->get('acl_taxation_delete', 'all'))), '|', array('name' => 'pophelp', 'target' => $this->ctrl . '-listing'), 'dashboard'); JHTML::_('behavior.modal'); }
function listing() { $db = JFactory::getDBO(); $filter = ''; if (hikashop_level(1)) { $app = JFactory::getApplication(); $selectedType = $app->getUserStateFromRequest($this->paramBase . ".filter_table", 'filter_table', '', 'string'); if (!empty($selectedType)) { $filter = ' WHERE a.field_table=' . $db->Quote($selectedType); } $table = hikashop_get('type.table'); $this->assignRef('tabletype', $table); } else { $filter = ' WHERE a.field_table=\'address\' OR a.field_table LIKE \'plg.%\''; } $db->setQuery('SELECT a.* FROM ' . hikashop_table('field') . ' AS a' . $filter . ' ORDER BY a.`field_table` ASC, a.`field_ordering` ASC'); $rows = $db->loadObjectList(); $config =& hikashop_config(); $manage = hikashop_isAllowed($config->get('acl_field_manage', 'all')); $this->assignRef('manage', $manage); $this->toolbar = array(array('name' => 'addNew', 'display' => $manage), array('name' => 'editList', 'display' => $manage), array('name' => 'deleteList', 'display' => hikashop_isAllowed($config->get('acl_field_delete', 'all'))), '|', array('name' => 'pophelp', 'target' => 'field-listing'), 'dashboard'); $total = count($rows); $pagination = hikashop_get('helper.pagination', $total, 0, $total); hikashop_setTitle(JText::_('FIELDS'), 'field', 'field'); $this->assignRef('rows', $rows); $toggle = hikashop_get('helper.toggle'); $this->assignRef('toggleClass', $toggle); $this->assignRef('pagination', $pagination); $this->assignRef('selectedType', $selectedType); $type = hikashop_get('type.fields'); $type->load(); $this->assignRef('fieldtype', $type); $fieldClass = hikashop_get('class.field'); $this->assignRef('fieldsClass', $fieldClass); }
$i++; } } if (!empty($html)) { if (!HIKASHOP_BACK_RESPONSIVE) { $html = '<ul>' . "\r\n" . $html . '</ul>'; } else { $html = '<ul class="dropdown-menu">' . "\r\n" . $html . '</ul>'; } } } $task = 'view'; if (!empty($menu['task'])) { $task = $menu['task']; } if (!empty($menu['acl']) && !hikashop_isAllowed($config->get('acl_' . $menu['acl'] . '_' . $task, 'all'))) { if (empty($html)) { continue; } $menu['url'] = '#'; } $liclasses = ''; $classes = ''; if (isset($menu['active']) && $menu['active']) { $classes .= ' sel'; $liclasses .= ' sel'; } $icon = ''; if (!empty($menu['icon'])) { if (!HIKASHOP_BACK_RESPONSIVE) { $classes .= ' ' . $menu['icon'];