- Posts: 431
- Thank you received: 22
Links on user control panel menu all wrong
1 year 10 months ago #364572
by mojweb
Links on user control panel menu all wrong was created by mojweb
-- 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
-- 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
Please Log in or Create an account to join the conversation.
1 year 10 months ago #364577
by nicolas
Replied by nicolas on topic Links on user control panel menu all wrong
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
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.
1 year 10 months ago - 1 year 10 months ago #364597
by mojweb
Replied by mojweb on topic Links on user control panel menu all wrong
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.
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: 1 year 10 months ago by mojweb.
Please Log in or Create an account to join the conversation.
1 year 10 months ago #364599
by nicolas
Replied by nicolas on topic Links on user control panel menu all wrong
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:
This code redirects to the user profile, no matter what.
Ideally, this code should be changed to:
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.
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:
Code:
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));
}
Ideally, this code should be changed to:
Code:
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));
}
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.
1 year 4 months ago #366896
by EnerW
Replied by EnerW on topic Links on user control panel menu all wrong
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.
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.225 seconds