Jump to content

History of all customer messages in user's account


Tari

Recommended Posts

Hi guys,

 

I need to display history of all customer's messages in front-end. There is this feature in back-end, in service desk but i haven't found anything in user account area.

 

Is it possible? I need some ideas where I should 'dig' for this thing. Thank you in advance!

Link to comment
Share on other sites

Hello Тариa!

 

I think the best option for you is create new controller called hmm, maybe "MessagesHistory".

 

Here is a list of things that I would want to do if I want to display messages history on specific page in front-end:

 

1. Create messages-history.php in base PrestaShop folder.

 

Code something like that:

 

require_once(dirname(__FILE__).'/config/config.inc.php');
ControllerFactory::getController('MessagesHistoryController')->run();

 

2. File controllers/MessagesHistoryController.php

 

And here some example code:

 


class MessagesHistoryControllerCore extends FrontController
{
public $php_self = 'messages-history.php';

public function process()
{
parent::process();

if(self::$cookie->is_logged)
{
$messages = CustomerThread::getCustomerMessages(self::$cookie->id_customer);
self::$smarty->assign('messages',$messages);
}
}

public function displayContent()
{
self::$smarty->display(_PS_THEME_DIR_.'messages-history.tpl');
}
}

 

 

3. Now create messages-history.tpl in your theme directory and use $messages variable.

 

4. Now put link to this page for example in blockmyaccount

 

Of course is a only a example. Have fun with coding.

 

If you have more questions, just write.

Edited by Krystian Podemski (see edit history)
Link to comment
Share on other sites

  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...