function load() { $class = hikashop_get('class.category'); $rows = $class->loadAllWithTrans('status'); foreach ($rows as $row) { if (!empty($row->translation)) { $this->values[$row->category_name] = JHTML::_('select.option', $row->category_name, hikashop_orderStatus($row->translation)); } else { $this->values[$row->category_name] = JHTML::_('select.option', $row->category_name, hikashop_orderStatus($row->category_name)); } } }
function trans($status) { foreach ($this->categories as $value) { if ($value->category_name == $status) { if ($this->type == 'status' && $value->value == $status) { return hikashop_orderStatus($status); } return $value->value; } } foreach ($this->categories as $value) { if ($value->category_namekey == $status) { if ($this->type == 'status' && $value->value == $status) { return hikashop_orderStatus($status); } return $value->value; } } if ($this->type == 'status') { return hikashop_orderStatus($status); } return $status; }
<?php $userClass = hikashop_get('class.user'); foreach ($this->order->history as $k => $history) { ?> <tr> <td><?php $val = preg_replace('#[^a-z0-9]#i', '_', strtoupper($history->history_type)); $trans = JText::_($val); if ($val != $trans) { $history->history_type = $trans; } echo $history->history_type; ?> </td> <td><?php echo hikashop_orderStatus($history->history_new_status); ?> </td> <td><?php echo $history->history_reason; ?> </td> <td><?php if (!empty($history->history_user_id)) { $user = $userClass->get($history->history_user_id); echo $user->username . ' / '; } echo $history->history_ip; ?> </td> <td><?php
</label></td> <td><span><?php echo @$this->order->order_invoice_number; ?> </span></td> </tr> <tr class="hikashop_order_status"> <td class="key"><label for="data[order][order_status]"><?php echo JText::_('ORDER_STATUS'); ?> </label></td> <td class="hikashop_order_status"><?php if (!isset($this->edit) || $this->edit !== true) { ?> <span><?php echo hikashop_orderStatus($this->order->order_status); ?> </span><?php } else { $extra = 'onchange="window.orderMgr.status_changed(this);"'; echo $this->order_status->display('data[order][order_status]', $this->order->order_status, $extra); } ?> </td> </tr> <tr id="hikashop_order_notify_line" style="display:none;" class="hikashop_order_notify"> <td class="key"><label for="data[notify]"><?php echo JText::_('NOTIFICATION'); ?> </label></td> <td><input type="checkbox" id="data[notify]" name="data[notify]"/><label style="display:inline-block" for="data[notify]"><?php
public function &getNameboxData($typeConfig, &$fullLoad, $mode, $value, $search, $options) { $ret = array(0 => array(), 1 => array()); static $multiTranslation = null; if ($multiTranslation === null) { $translationHelper = hikashop_get('helper.translation'); $multiTranslation = $translationHelper->isMulti(true); } $db = JFactory::getDBO(); $app = JFactory::getApplication(); $category_type = array('product', 'root', 'vendor', 'manufacturer'); if (!empty($typeConfig['params']['category_type'])) { $category_type = $typeConfig['params']['category_type']; } if (is_string($category_type)) { $category_type = explode(',', $category_type); } $fullLoad = false; $displayFormat = !empty($options['displayFormat']) ? $options['displayFormat'] : @$typeConfig['displayFormat']; $depth = (int) @$options['depth']; $start = (int) @$options['start']; $limit = (int) @$options['limit']; $page = (int) @$options['page']; if ($depth <= 0) { $depth = 1; } if ($limit <= 0) { $limit = $typeConfig['mode'] == 'list' ? 10 : 200; } $category_types = array(); foreach ($category_type as $t) { $category_types[] = $db->Quote($t); } $select = array('c.*'); $table = array(hikashop_table('category') . ' AS c'); $where = array('c.category_type IN (' . implode(',', $category_types) . ')'); if ($typeConfig['mode'] == 'list') { $where[] = 'c.category_namekey NOT IN (' . implode(',', $category_types) . ')'; } if (in_array('product', $category_type) && empty($search)) { if (empty($start)) { $where[] = 'c.category_depth >= 0 AND c.category_depth <= ' . $depth; } else { $where[] = 'c.category_depth >= cp.category_depth AND c.category_depth <= (cp.category_depth + ' . $depth . ')'; } } if (!empty($search)) { $searchStr = "'%" . (HIKASHOP_J30 ? $db->escape($search, true) : $db->getEscaped($search, true)) . "%'"; $where[] = '(c.category_name LIKE ' . $searchStr . ' OR c.category_id = ' . $start . ')'; } if ($start > 0) { $table[] = 'INNER JOIN ' . hikashop_table('category') . ' AS cp On cp.category_id = ' . $start; $where[] = '(c.category_left >= cp.category_left AND c.category_right <= cp.category_right)'; } if ($typeConfig['mode'] == 'list') { $order = ' ORDER BY c.category_name ASC'; } else { $order = ' ORDER BY c.category_parent_id ASC, c.category_ordering'; } $query = 'SELECT ' . implode(', ', $select) . ' FROM ' . implode(' ', $table) . ' WHERE ' . implode(' AND ', $where) . $order; $db->setQuery($query, $page, $limit); if (!$app->isAdmin() && $multiTranslation && class_exists('JFalangDatabase')) { $categories = $db->loadObjectList('category_id', 'stdClass', false); } elseif (!$app->isAdmin() && $multiTranslation && (class_exists('JFDatabase') || class_exists('JDatabaseMySQLx'))) { $categories = $db->loadObjectList('category_id', false); } else { $categories = $db->loadObjectList('category_id'); } if ($typeConfig['mode'] == 'list') { if (count($categories) < $limit) { $fullLoad = true; } if (!empty($typeConfig['params']['category_type']) && $typeConfig['params']['category_type'] == 'status') { foreach ($categories as $category) { if (!empty($category->translation)) { $ret[0][$category->category_name] = hikashop_orderStatus($category->translation); } else { $ret[0][$category->category_name] = hikashop_orderStatus($category->category_name); } } } elseif (!empty($typeConfig['params']['category_type']) && $typeConfig['params']['category_type'] == 'manufacturer') { foreach ($categories as $category) { $ret[0][$category->category_id] = !empty($category->translation) ? $category->translation : $category->category_name; } } else { foreach ($categories as $category) { $ret[0][$category->category_name] = !empty($category->translation) ? $category->translation : $category->category_name; } } } else { $tmp = array(); if (!empty($search)) { $base = ''; if ($start > 0) { $base = '(c.category_left <= ' . (int) $categories[$start]->category_left . ' AND c.category_right >= ' . (int) $categories[$start]->category_right . ') AND '; } $lookup_categories = array(); foreach ($categories as $c) { if (empty($lookup_categories[(int) $c->category_id])) { $lookup_categories[(int) $c->category_id] = (int) $c->category_left . ' AND c.category_right > ' . (int) $c->category_right; } } $query = 'SELECT c.* ' . ' FROM ' . hikashop_table('category') . ' AS c ' . ' WHERE ' . $base . '((c.category_left < ' . implode(') OR (c.category_left < ', $lookup_categories) . '))' . $order; $db->setQuery($query); if (!$app->isAdmin() && $multiTranslation && class_exists('JFalangDatabase')) { $category_tree = $db->loadObjectList('category_id', 'stdClass', false); } elseif (!$app->isAdmin() && $multiTranslation && (class_exists('JFDatabase') || class_exists('JDatabaseMySQLx'))) { $category_tree = $db->loadObjectList('category_id', false); } else { $category_tree = $db->loadObjectList('category_id'); } foreach ($category_tree as $k => $v) { if ($k == $start) { continue; } $o = new stdClass(); $o->status = 2; $o->name = JText::_($v->category_name); $o->value = $k; $o->data = array(); if (empty($v->category_parent_id)) { $o->status = 5; $o->icon = 'world'; $ret[0][] =& $o; } else { if ((int) $v->category_parent_id == 1 || !isset($tmp[(int) $v->category_parent_id])) { $ret[0][] =& $o; } else { $tmp[(int) $v->category_parent_id]->data[] =& $o; } } $tmp[$k] =& $o; unset($o); } } foreach ($categories as $k => $v) { if ($k == $start) { continue; } $o = new stdClass(); if ($v->category_left + 1 == $v->category_right) { $o->status = 4; } else { $o->status = 3; } $o->name = !empty($v->translation) ? $v->translation : JText::_($v->category_name); $o->value = $k; $o->data = array(); if (empty($v->category_parent_id)) { $o->status = 5; $o->icon = 'world'; $ret[0][] =& $o; } else { if ((int) $v->category_parent_id == 1 || !isset($tmp[(int) $v->category_parent_id])) { $ret[0][] =& $o; } else { $tmp[(int) $v->category_parent_id]->status = 2; $tmp[(int) $v->category_parent_id]->data[] =& $o; } } $tmp[$k] =& $o; unset($o); } } if (!empty($value) && @$typeConfig['params']['category_type'] == 'status') { if ($mode == hikashopNameboxType::NAMEBOX_SINGLE && isset($ret[0][$value])) { $ret[1][$value] = $ret[0][$value]; return $ret; } if ($mode == hikashopNameboxType::NAMEBOX_MULTIPLE && is_array($value)) { foreach ($value as $v) { if (isset($ret[0][$v])) { $ret[1][$v] = $ret[0][$v]; } } return $ret; } } if (!empty($value)) { if (!is_array($value)) { $value = array($value); } $search = array(); $f = reset($value); if (is_int($f) || (int) $f > 0) { foreach ($value as $v) { $search[] = (int) $v; } $query = 'SELECT c.* ' . ' FROM ' . hikashop_table('category') . ' AS c ' . ' WHERE c.category_id IN (' . implode(',', $search) . ')'; } else { foreach ($value as $v) { $search[] = $db->Quote($v); } $query = 'SELECT c.* ' . ' FROM ' . hikashop_table('category') . ' AS c ' . ' WHERE c.category_name IN (' . implode(',', $search) . ')'; } $db->setQuery($query); if (!$app->isAdmin() && $multiTranslation && class_exists('JFalangDatabase')) { $categories = $db->loadObjectList('category_id', 'stdClass', false); } elseif (!$app->isAdmin() && $multiTranslation && (class_exists('JFDatabase') || class_exists('JDatabaseMySQLx'))) { $categories = $db->loadObjectList('category_id', false); } else { $categories = $db->loadObjectList('category_id'); } if (!empty($categories)) { if (!empty($options['tooltip'])) { $parent_categories = array(); foreach ($categories as $category) { $pid = (int) $category->category_parent_id; $parent_categories[$pid] = $pid; } $query = 'SELECT c.* ' . ' FROM ' . hikashop_table('category') . ' AS c ' . ' INNER JOIN ' . hikashop_table('category') . ' AS cp ON (c.category_left <= cp.category_left AND c.category_right >= cp.category_left) ' . ' WHERE cp.category_id IN (' . implode(',', $parent_categories) . ') AND c.category_id > 1'; $db->setQuery($query); if (!$app->isAdmin() && $multiTranslation && class_exists('JFalangDatabase')) { $parent_categories = $db->loadObjectList('category_id', 'stdClass', false); } elseif (!$app->isAdmin() && $multiTranslation && (class_exists('JFDatabase') || class_exists('JDatabaseMySQLx'))) { $parent_categories = $db->loadObjectList('category_id', false); } else { $parent_categories = $db->loadObjectList('category_id'); } } $orderedList = array(); foreach ($value as $v) { $orderedList[$v] = $categories[$v]; } $categories = $orderedList; foreach ($categories as $category) { $category->category_name = !empty($category->translation) ? $category->translation : JText::_($category->category_name); if (!empty($options['tooltip'])) { $tree = array(); $pid = (int) $category->category_parent_id; while (!empty($pid)) { if (isset($parent_categories[$pid])) { array_unshift($tree, !empty($parent_categories[$pid]->translation) ? $parent_categories[$pid]->translation : JText::_($parent_categories[$pid]->category_name)); $pid = (int) $parent_categories[$pid]->category_parent_id; } else { $pid = 0; } } if (!empty($tree)) { $tree[] = $category->category_name; $category->category_name = hikashop_tooltip(implode(' / ', $tree), '', '', $category->category_name, '', 0); } } $category->name = $category->category_name; $ret[1][$category->category_id] = $category; } } unset($categories); if ($mode == hikashopNameboxType::NAMEBOX_SINGLE) { $ret[1] = reset($ret[1]); } } return $ret; }
} ?> </td> <td align="center"> <?php echo hikashop_getDate($row->order_created, '%Y-%m-%d %H:%M'); ?> </td> <td align="center"> <?php echo hikashop_getDate($row->order_modified, '%Y-%m-%d %H:%M'); ?> </td> <td align="center"> <?php echo hikashop_orderStatus($row->order_status); ?> </td> <td align="center"> <?php echo $this->currencyHelper->format($row->order_full_price, $row->order_currency_id); ?> </td> <td width="1%" align="center"> <?php echo $row->order_id; ?> </td> </tr> <?php $k = 1 - $k;