order the menu items

  • Posts: 7
  • Thank you received: 1
  • Hikaauction Standard Hikamarket Multivendor Hikashop Business
13 hours 49 minutes ago #370022

-- HikaShop version -- : 6.2.0
-- Joomla version -- : 6
-- PHP version -- : 8.4
-- Browser(s) name and version -- : all

Hello, is there a way to order the menu item order for registered user inside hikamarket?

Also, since I deal with auctions only, I would like to hide 'carts', is there a way?



Thank you

Attachments:

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

  • Posts: 84951
  • Thank you received: 13838
  • MODERATOR
10 hours 8 minutes ago #370026

Hi,

Yes, you can reorder, hide, or modify the menu items in the customer control panel sidebar via a view override.

How to create the view override:
- Go to the HikaShop backend: Display > Views
- Find the view user / cpanel and click to edit it
- This creates an override where you can modify $this->buttons directly
- You can read more about view overrides here: www.hikashop.com/support/documentation/1...-display.html#layout

Example 1: Hide the "Carts" button:
At the beginning of your cpanel.php override, add:

<?php
// Hide the cart button
if(isset($this->buttons['cart'])) {
    unset($this->buttons['cart']);
}
?>
Example 2: Reorder buttons (put "Orders" first):
<?php
// Define your preferred order
$preferredOrder = array('order', 'address', 'cart', 'wishlist', 'download');
$orderedButtons = array();
// First, add buttons in preferred order
foreach($preferredOrder as $key) {
    if(isset($this->buttons[$key])) {
        $orderedButtons[$key] = $this->buttons[$key];
    }
}
// Then add any remaining buttons (from plugins like HikaMarket, HikaAuction)
foreach($this->buttons as $key => $btn) {
    if(!isset($orderedButtons[$key])) {
        $orderedButtons[$key] = $btn;
    }
}
$this->buttons = $orderedButtons;
?>
Example 3: For auctions only - hide carts and put auction-related buttons first
<?php
// 1. Remove buttons you don't want
$buttonsToHide = array('cart', 'wishlist');
foreach($buttonsToHide as $hide) {
    if(isset($this->buttons[$hide])) {
        unset($this->buttons[$hide]);
    }
}
// 2. Define your preferred order (auction buttons from HikaAuction first)
$preferredOrder = array('bids', 'order', 'address', 'download');
$orderedButtons = array();
foreach($preferredOrder as $key) {
    if(isset($this->buttons[$key])) {
        $orderedButtons[$key] = $this->buttons[$key];
    }
}
// Add any remaining plugin buttons
foreach($this->buttons as $key => $btn) {
    if(!isset($orderedButtons[$key])) {
        $orderedButtons[$key] = $btn;
    }
}
$this->buttons = $orderedButtons;
?>

The default HikaShop buttons use these keys:
address - Addresses
order - Orders
cart - Carts (Essential/Business only)
wishlist - Wishlists (Essential/Business only)
download - Downloads (Essential/Business only)
other extensions, like HikaMarket and HikaAuction, can add their own buttons using the onUserAccountDisplay event of HikaShop, and you can include their respective keys in your ordering.
you can add the code:
<?php var_dump($this->buttons); ?>
to see which buttons are added and what keys are used exactly.

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

Time to create page: 0.063 seconds
Powered by Kunena Forum