add new button and new view to control panel

  • Posts: 57
  • Thank you received: 4
9 years 6 months ago #202198

Hi,

I need your help.
When I access to control panel I have this:



and I wan't to add a new one and a new view because I need another page with new customers information.
How can I add this?

To this case, i need:
  1. A NEW BOTTOM LIKE THESE
  2. A NEW VIEW WHERE WILL BE APEAR THE NEW INFORMATION THAT I WAN'T

Please, can you help me?

Thanks.

Attachments:

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

  • Posts: 82865
  • Thank you received: 13372
  • MODERATOR
9 years 6 months ago #202219

Hi,

You can add a button there by creating a hikashop plugin implementing the onUserAccountDisplay trigger:
www.hikashop.com/support/support/documen...onUserAccountDisplay
You can there direct to any page of your website. So it could be a joomla article with data injected in it with the extension sorcerer, or a custom component, etc.
It's up to you, but it will require PHP development skills.

The following user(s) said Thank You: rfernandes

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

  • Posts: 57
  • Thank you received: 4
9 years 6 months ago #202267

Hummm, i understood about the button, and PHP development skills isn't a problem for me too, but I don't understood if it's possible to create a new view in hikashop, like for example "address/address.php".
Isn't possible to do that without compromise the core of your hikashop component?
For example, with some override to don't compromisse.

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

  • Posts: 57
  • Thank you received: 4
9 years 6 months ago #202272

How can I reorder all of this items?

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

  • Posts: 57
  • Thank you received: 4
9 years 6 months ago #202287

rfernandes wrote: How can I reorder all of this items?


I have found one solution:

first, you need to create a new plugin where you need to use this function:
function onUserAccountDisplay(&$buttons)
{
	$buttons['YOUR_NEW_BUTTON']['link']           = 'new link';
	$buttons['YOUR_NEW_BUTTON']['level']          = 0;
	$buttons['YOUR_NEW_BUTTON']['image']          = 'ICON_NAME';
	$buttons['YOUR_NEW_BUTTON']['text']           = 'BUTTON_NAME';
	$buttons['YOUR_NEW_BUTTON']['description']    = 'BUTTON_DESCRIPTION';

	$cont = 0;
	$sort = array();
	
	foreach($buttons as $key => $val)
	{
		switch ($key)
		{
			case '0':
				$cont = 0;
			break;
		
			case 'YOUR_NEW_BUTTON':
				$cont = 1;
			break;
		
			case 'address':
				$cont = 2;
			break;
		
			case 'order':
				$cont = 3;
			break;
		
			case 'cart':
				$cont = 4;
			break;
		
			case 'wishlist':
				$cont = 5;
			break;
		
			case 'download':
				$cont = 6;
			break;
		}                  
		$sort['order'][$key] = $cont;
		$sort['level'][$key] = $val['level'];
	}
	array_multisort($sort['level'], SORT_ASC, $sort['order'], SORT_ASC, $buttons);    
}

And works.

Now the next step will be create a new view for this 'YOUR_NEW_BUTTON'.
Can you help me with this?

Thanks

Last edit: 9 years 6 months ago by rfernandes.

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

  • Posts: 13201
  • Thank you received: 2322
9 years 6 months ago #202270

Hi,

Once you have created the new button, you can redirect to the page you want, not necessarily an HikaShop page.
So I think that the easiest way will be to create a joomla article as Nicolas said, and thanks to the "sorcerer" extension add php code to load all the desired data, and display the informations as you want.

The problem when creating a view is to call it, it require an entry in the controller, etc, so core files.

You can re-order the entries by editig the view "user / cpanel", simply reorder before the foreach.
For the entries added by plugins, they will be after the other entries, and their ordering is based on the order of the plugins.

Last edit: 9 years 6 months ago by Xavier.
The following user(s) said Thank You: rfernandes

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

  • Posts: 57
  • Thank you received: 4
9 years 6 months ago #202786

Hi Xavier,

Thanks for your help.
Works great like you said.
Isn't a solution that I have planed but works great.
I have create a new option button in a control panel with a code that I have put here before and after that I have developed a new module with all what I wan't and after that I called this module inside a article.
Put some inline css to hide all edit options of the article page and block all changes in this pages to prevent some damage maked from another users and works great.

Thanks for your help.

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

Time to create page: 0.083 seconds
Powered by Kunena Forum