Links on user control panel menu all wrong

  • Posts: 349
  • Thank you received: 19
  • Hikashop Business
5 months 1 week ago #364572

-- HikaShop version -- : 5.1.1
-- Joomla version -- : 5.2

1. If you create menu item for user control panel (hikashop) you get this:


All great and ok.
If you click on first item Customer Acount, you get:

All ok. But if you click on cancel, you get user profile summary and cant get back to CP. You are stuck in profile.

2. Non of the links for addresses, orders, carts and downloads have right urls. I created menu item for each and set my custom aliases.
Example:
My url/alias for cp is domain.com/uporabniska-nadzorna-plosca
My url/alias for downloads is domain.com/datoteke
When I click on Downloads in cp, I get domain.com/uporabniska-nadzorna-plosca/user/downloads. When I click back, I get domain.com/uporabniska-nadzorna-plosca/user/cpanel

Attachments:

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

  • Posts: 83674
  • Thank you received: 13545
  • MODERATOR
5 months 1 week ago #364577

Hi,

1. In the "HikaShop joomla user account link plugin" settings page via the Joomla plugins manager, you have a setting "Redirect back". Please make sure that this setting is activated.

2. There is indeed no mechanism to automatically search for a potential menu item for each page of the control panel to use instead of staying on the current menu item.
This would require development to support this in the cpanel function of the file components/com_hikashop/views/user/view.html.php

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

  • Posts: 349
  • Thank you received: 19
  • Hikashop Business
5 months 1 week ago #364597

1. I have allready enabled Redirect back option. I also try to enter Force menu item id. No change.
edit:
It works with save. But not working with cancel. It should go back to CP when click cancel.

2. Well, this is just esential functionality.

Last edit: 5 months 1 week ago by mojweb.

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

  • Posts: 83674
  • Thank you received: 13545
  • MODERATOR
5 months 6 days ago #364599

Hi,

1. For the cancel button, the problem is in Joomla. In the file components/com_users/src/Controller/ProfileController.php , near the end of the file, you have the "cancel" function:

public function cancel()
    {
        // Check for request forgeries.
        $this->checkToken();

        // Flush the data from the session.
        $this->app->setUserState('com_users.edit.profile', null);

        // Redirect to user profile.
        $this->setRedirect(Route::_('index.php?option=com_users&view=profile', false));
    }
This code redirects to the user profile, no matter what.
Ideally, this code should be changed to:
public function cancel()
    {
        // Check for request forgeries.
        $this->checkToken();

        // Flush the data from the session.
        $this->app->setUserState('com_users.edit.profile', null);

                $redirect = $app->getUserState('com_users.edit.profile.redirect');

                // Don't redirect to an external URL.
                if (!Uri::isInternal($redirect)) {
                    $redirect = null;
                }
                if (!$redirect) {
                    $redirect = 'index.php?option=com_users&view=profile';
                }


        // Redirect to user profile.
        $this->setRedirect(Route::_($redirect, false));
    }
The same way this is handled in the save function so that it takes into account the com_users.edit.profile.redirect state which allows 3rd party extensions to redirect back to their page.

2. While I agree that it would be a nice improvements to have, and I have noted this down on our todo list, I don't see why you think this is essential functionality. All the pages work fine without autodetecting the corresponding menu item.

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

  • Posts: 87
  • Thank you received: 5
  • Hikashop Business
10 hours 25 minutes ago #366896

Quick and dirty, create an override for com_users, just replace the cancel button with another that links to the cpanel menu ID.

com_users -> profile -> edit.php

original part:

<button type="submit" class="btn btn-primary validate" name="task" value="profile.save">
<span class="icon-check" aria-hidden="true"></span>
<?php echo Text::_('JSAVE'); ?>
</button>
<button type="submit" class="btn btn-danger" name="task" value="profile.cancel" formnovalidate>
<span class="icon-times" aria-hidden="true"></span>
<?php echo Text::_('JCANCEL'); ?>
</button>

modified part:

<button type="submit" class="btn btn-primary validate" name="task" value="profile.save">
<span class="icon-check" aria-hidden="true"></span>
<?php echo Text::_('JSAVE'); ?>
</button>
<a class="btn btn-danger" href="<?php echo JRoute::_('index.php?Itemid=158'); ?>"
title="<?php echo JText::_('JCANCEL'); ?>"><?php echo JText::_('JCANCEL'); ?>
</a>


Not nice and you need to remember that it's hard coded to the menu item ID, but at least your customers are not going around in circles.

The following user(s) said Thank You: nicolas

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

Time to create page: 0.076 seconds
Powered by Kunena Forum