"confirmed" orders as the default filter when opening "orders"

  • Posts: 220
  • Thank you received: 12
2 years 9 months ago #333857

-- HikaShop version -- : 4.4.2
-- Joomla version -- : 3.9.26
-- PHP version -- : 5.6.40

Hi,

I nearly have this project finished! Thanks for all the help over the last couple of weeks. I really appreciate it.

Is it possible to have "confirmed" orders as the default filter when opening "orders" - please see attached image.

Thanks,
Josh.

Attachments:
Last edit: 2 years 9 months ago by joshualdouglas.

Please Log in or Create an account to join the conversation.

  • Posts: 81504
  • Thank you received: 13064
  • MODERATOR
2 years 9 months ago #333858

Hi,

Yes. You need to edit the file menu / default.php for your backend template and add such line at the beginning:

<?php $this->menus['orders'][0]['url'] .= '&filter_status=confirmed'; ?>

The following user(s) said Thank You: joshualdouglas

Please Log in or Create an account to join the conversation.

  • Posts: 220
  • Thank you received: 12
2 years 9 months ago #333864

Hi Nicolas,

Thanks for getting back to me.

I put

<?php $this->menus['orders'][0]['url'] .= '&filter_status=confirmed'; ?>

into

menu / default.php

And it doesn't seem to work. Please see the entire file:
<?php
/**
 * @package	HikaShop for Joomla!
 * @version	4.4.2
 * @author	hikashop.com
 * @copyright	(C) 2010-2021 HIKARI SOFTWARE. All rights reserved.
 * @license	GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><nav class="hk-navbar hk-navbar-default">
	<div class="hk-container-fluid">
		<ul class="hk-nav hk-navbar-nav">
          <?php $this->menus['orders'][0]['url'] .= '&filter_status=confirmed'; ?>
<?php
$config = hikashop_config();
foreach($this->menus as $menu) {
	$task = !empty($menu['task']) ? $menu['task'] : 'view';
	$icon = !empty($menu['icon']) ? '<i class="'.$menu['icon'].'"></i> ' : '';

	$dropdown = false;
	if(!empty($menu['children'])) {
		foreach($menu['children'] as &$child) {
			$childTask = !empty($child['task']) ? $child['task'] : 'view';
			if(!empty($child['acl']) && !hikashop_isAllowed($config->get('acl_'.$child['acl'].'_'.$childTask, 'all'))) {
				$child = false;
				continue;
			}
			if(!empty($child['url']))
				$dropdown = true;
			if(isset($child['active']) && $child['active']) {
				$menu['active'] = true;
			}
		}
		unset($child);
	}

	if(!empty($menu['acl']) && !hikashop_isAllowed($config->get('acl_'.$menu['acl'].'_'.$task, 'all')) && !$dropdown)
		continue;

	$classes = !empty($menu['active']) ? ' active' : '';
	if(!isset($menu['options'])) $menu['options'] = '';

	if(!$dropdown) {
?>
			<li class="<?php echo trim($classes); ?>"><a href="<?php echo $menu['url']; ?>" <?php echo $menu['options']; ?>><?php echo $icon . $menu['name']; ?></a></li>
<?php
		continue;
	}

?>
			<li class="hkdropdown<?php echo $classes; ?>">
				<a href="#" class="hkdropdown-toggle" data-toggle="hkdropdown" role="button" aria-haspopup="true" aria-expanded="false"><?php echo $icon . $menu['name']; ?> <span class="caret"></span></a>
				<ul class="hkdropdown-menu">
<?php
	foreach($menu['children'] as $child) {
		if(empty($child))
			continue;
		$childTask = !empty($child['task']) ? $child['task'] : 'view';
		$childIcon = !empty($child['icon']) ? '<i class="'.$child['icon'].'"></i> ' : '';
		if(!isset($child['options'])) $child['options'] = '';
		$classes = !empty($child['active']) ? ' active' : '';

		if(!empty($child['url'])) {
			echo '<li><a class="'.trim($classes).'" href="'.$child['url'].'" '.$child['options'].'>' . $childIcon . $child['name'] . '</a></li>';
		} else {
			echo '<li role="separator" class="divider" '.$child['options'].'></li>';
		}
	}
?>
				</ul>
			</li>
<?php
}
?>
		</ul>
	</div>
</nav>

Have I put this is in the wrong place?

Thanks,
Josh.

Please Log in or Create an account to join the conversation.

  • Posts: 81504
  • Thank you received: 13064
  • MODERATOR
2 years 9 months ago #333870

Hi,

My bad, I had forgotten some code in my code. It should be :

<?php $this->menus['orders']['children'][0]['url'] .= '&filter_status=confirmed'; ?>

The following user(s) said Thank You: joshualdouglas

Please Log in or Create an account to join the conversation.

  • Posts: 220
  • Thank you received: 12
2 years 9 months ago #333883

Thanks, I will give this a proper try on Monday.

Please Log in or Create an account to join the conversation.

  • Posts: 220
  • Thank you received: 12
2 years 9 months ago #333928

All seems to work fine. Thank you!

Please Log in or Create an account to join the conversation.

Time to create page: 0.078 seconds
Powered by Kunena Forum