Jump to content

Messages to customers not showing in Order detail page


il15

Recommended Posts

Hello,

 

I just update from 1.4.9 to 1.5.2 and I found one problem.

 

Once I leave a message to a customer in the order detail page, it is not showing in the order product like before, I have to go to the customer service tab.

 

Is there anyway to make the messages appear at the order page like before?

 

Thank you.

Link to comment
Share on other sites

  • 3 weeks later...

Prestashop, you are not listening to us shop owners. So what if you centralized messages in Customer Service tab? How are we going to provide awesome customer service when it's so hard to view messages left for that order? We need to be able to leave notes for a specific order like in the past and NOT threat every comment as a ticket.

You are a developer, not a store owner, you can't understand the pain we are having when you centralize all the messages without being able to leave order specific comment and view them in the BO order page.

I suggest you provide a patch we could use so that at least comments regarding the order is shown in BO order page.

 

People all find it hard to handle the orders because we can't leave notes to the order and view it quickly:

PSCFV-1323

PSCFV-5053

PSCFV-4831

http://www.prestashop.com/forums/topic/197912-messages-to-customers-not-showing-in-order-detail-page/

PSCFV-5486

  • Like 2
Link to comment
Share on other sites

  • 3 months later...

Yeah we use it to enter tracking info because we cannot use the default tracking system with our shipping. Now we cannot see if we sent the tracking info and spend hours dealing with customers that did not get tracking info or got double emails etc etc etc.

Link to comment
Share on other sites

  • 2 weeks later...

Prestashop has feedback in forge that they don't plan to tackle this issue at the moment. We will have to continue using the Customer Service message system until they decided on something else. Create a forge issue if you wana help push them to relook into this issue. I think the current message system is pretty crap. I wish they brought back the ability to leave and email messages via the order page and maybe improve it.

  • Like 2
Link to comment
Share on other sites

  • 2 weeks later...

Prestashop has feedback in forge that they don't plan to tackle this issue at the moment. We will have to continue using the Customer Service message system until they decided on something else. Create a forge issue if you wana help push them to relook into this issue. I think the current message system is pretty crap. I wish they brought back the ability to leave and email messages via the order page and maybe improve it.

 

Replace the original code by this code on line 91 until 114 (getMessagesByOrderId string) in Message.php class (in classes map). CREDITS GO TO hoplajetzt

 

public static function getMessagesByOrderId($id_order, $private = false, Context $context = null)
{
  if (!Validate::isBool($private))
die(Tools::displayError());
 if (!$context)
  $context = Context::getContext();
 $m = Db::getInstance()->executeS('
  SELECT m.*, c.`firstname` AS cfirstname, c.`lastname` AS clastname, e.`firstname` AS efirstname, e.`lastname` AS elastname,
  (COUNT(mr.id_message) = 0 AND m.id_customer != 0) AS is_new_for_me
  FROM `'._DB_PREFIX_.'message` m
  LEFT JOIN `'._DB_PREFIX_.'customer` c ON m.`id_customer` = c.`id_customer`
  LEFT JOIN `'._DB_PREFIX_.'message_readed` mr
ON mr.`id_message` = m.`id_message`
AND mr.`id_employee` = '.(isset($context->employee) ? (int)$context->employee->id : '\'\'').'
  LEFT OUTER JOIN `'._DB_PREFIX_.'employee` e ON e.`id_employee` = m.`id_employee`
  WHERE m.`id_order` = '.(int)$id_order.'
  '.(!$private ? ' AND m.`private` = 0' : '').'
  GROUP BY m.id_message
  ORDER BY m.date_add DESC
 ');

 $o = Db::getInstance()->executeS('
  SELECT ct.*, m.*, e.`firstname` AS efirstname, e.`lastname` AS elastname
  FROM `'._DB_PREFIX_.'customer_thread` ct
  LEFT JOIN `'._DB_PREFIX_.'customer_message` m ON m.`id_customer_thread` = ct.`id_customer_thread`
  LEFT OUTER JOIN `'._DB_PREFIX_.'employee` e ON e.`id_employee` = m.`id_employee`
  WHERE ct.`id_order` = '.(int)$id_order.'
  ORDER BY ct.`date_add` DESC'
 );

 return array_merge($o,$m);

}

 

Works perfect!

Edited by CVpeet (see edit history)
  • Like 9
Link to comment
Share on other sites

  • 2 weeks later...

Replace the original code by this code on line 91 until 114 (getMessagesByOrderId string) in Message.php class (in classes map). CREDITS GO TO hoplajetzt

 

public static function getMessagesByOrderId($id_order, $private = false, Context $context = null)
{
  if (!Validate::isBool($private))
die(Tools::displayError());
 if (!$context)
  $context = Context::getContext();
 $m = Db::getInstance()->executeS('
  SELECT m.*, c.`firstname` AS cfirstname, c.`lastname` AS clastname, e.`firstname` AS efirstname, e.`lastname` AS elastname,
  (COUNT(mr.id_message) = 0 AND m.id_customer != 0) AS is_new_for_me
  FROM `'._DB_PREFIX_.'message` m
  LEFT JOIN `'._DB_PREFIX_.'customer` c ON m.`id_customer` = c.`id_customer`
  LEFT JOIN `'._DB_PREFIX_.'message_readed` mr
ON mr.`id_message` = m.`id_message`
AND mr.`id_employee` = '.(isset($context->employee) ? (int)$context->employee->id : '\'\'').'
  LEFT OUTER JOIN `'._DB_PREFIX_.'employee` e ON e.`id_employee` = m.`id_employee`
  WHERE m.`id_order` = '.(int)$id_order.'
  '.(!$private ? ' AND m.`private` = 0' : '').'
  GROUP BY m.id_message
  ORDER BY m.date_add DESC
 ');

 $o = Db::getInstance()->executeS('
  SELECT ct.*, m.*, e.`firstname` AS efirstname, e.`lastname` AS elastname
  FROM `'._DB_PREFIX_.'customer_thread` ct
  LEFT JOIN `'._DB_PREFIX_.'customer_message` m ON m.`id_customer_thread` = ct.`id_customer_thread`
  LEFT OUTER JOIN `'._DB_PREFIX_.'employee` e ON e.`id_employee` = m.`id_employee`
  WHERE ct.`id_order` = '.(int)$id_order.'
  ORDER BY ct.`date_add` DESC'
 );

 return array_merge($o,$m);

}

 

Works perfect!

 

I have 1.5.4 and works perfect. Excellent guys!

Edited by lordshop (see edit history)
  • Like 2
Link to comment
Share on other sites

  • 2 weeks later...

Nice it's working for 1.5.3!

 

I little bit improved it to be less depending on future versions.

 

Instead of replacing the original classes/Messages.php this function makes use of the override. Just add this function in the override/classes/Messages.php so just below:

 

class Message extends MessageCore

{

 

 

public static function getMessagesByOrderId($id_order, $private = false, Context $context = null)
{
 $m=parent::getMessagesByOrderId($id_order, $private, $context);
  $o = Db::getInstance()->executeS('
SELECT ct.*, m.*, e.`firstname` AS efirstname, e.`lastname` AS elastname
FROM `'._DB_PREFIX_.'customer_thread` ct
LEFT JOIN `'._DB_PREFIX_.'customer_message` m ON m.`id_customer_thread` = ct.`id_customer_thread`
LEFT OUTER JOIN `'._DB_PREFIX_.'employee` e ON e.`id_employee` = m.`id_employee`
WHERE ct.`id_order` = '.(int)$id_order.'
ORDER BY ct.`date_add` DESC'
  );
  return array_merge($o,$m);
}

 

 

}

 

Thanks to the original person who posted this fix!

  • Like 3
Link to comment
Share on other sites

  • 3 weeks later...
  • 2 weeks later...

Hi,

 

WOW! Thanks! Saved us a lot of time and headaches.

 

S/O to hoplajetzt and CVpeet and shopimport.nl (for the clean override).

 

Confirming that the override works in PS v.1.5.4.1... the Message.php class isn't there in the override folder anymore, but you can just create it or transfer one from PS v.1.5.3 and modify that one.

 

Thanks again!

Edited by mytheory. (see edit history)
Link to comment
Share on other sites

  • 1 month later...

Hi,

 

WOW! Thanks! Saved us a lot of time and headaches.

 

S/O to hoplajetzt and CVpeet and shopimport.nl (for the clean override).

 

Confirming that the override works in PS v.1.5.4.1... the Message.php class isn't there in the override folder anymore, but you can just create it or transfer one from PS v.1.5.3 and modify that one.

 

Thanks again!

 

override sounds nice but it doesn't work for me.

So and again, I replace the code in 1.5.4.1

Link to comment
Share on other sites

  • 2 weeks later...

Hi, thank you for this tip !!!

Just, I want to know, if it is possible to mark the message as closed in the aftersales page in backoffice. When I answer an order message, in the page with all the messages, there is the green round near the message.

How could I do that please ?

 

thank you

Link to comment
Share on other sites

  • 1 month later...
  • 4 weeks later...
  • 3 months later...
  • 1 month later...
  • 2 weeks later...

Hi To person who posted this solution.

 

Many, Many, Many thanks for this as someone describe above, that guys on prestashop are good proggrammers, but bad customer support, we were lost now for trhee month since we upgrade to version 1.5, till today when all massages are back where they should be

 

Martin

Link to comment
Share on other sites

  • 1 month later...

Replace the original code by this code on line 91 until 114 (getMessagesByOrderId string) in Message.php class (in classes map). CREDITS GO TO hoplajetzt

 

public static function getMessagesByOrderId($id_order, $private = false, Context $context = null)
{
if (!Validate::isBool($private))
die(Tools::displayError());
if (!$context)
$context = Context::getContext();
$m = Db::getInstance()->executeS('
SELECT m.*, c.`firstname` AS cfirstname, c.`lastname` AS clastname, e.`firstname` AS efirstname, e.`lastname` AS elastname,
(COUNT(mr.id_message) = 0 AND m.id_customer != 0) AS is_new_for_me
FROM `'._DB_PREFIX_.'message` m
LEFT JOIN `'._DB_PREFIX_.'customer` c ON m.`id_customer` = c.`id_customer`
LEFT JOIN `'._DB_PREFIX_.'message_readed` mr
ON mr.`id_message` = m.`id_message`
AND mr.`id_employee` = '.(isset($context->employee) ? (int)$context->employee->id : '\'\'').'
LEFT OUTER JOIN `'._DB_PREFIX_.'employee` e ON e.`id_employee` = m.`id_employee`
WHERE m.`id_order` = '.(int)$id_order.'
'.(!$private ? ' AND m.`private` = 0' : '').'
GROUP BY m.id_message
ORDER BY m.date_add DESC
');

$o = Db::getInstance()->executeS('
SELECT ct.*, m.*, e.`firstname` AS efirstname, e.`lastname` AS elastname
FROM `'._DB_PREFIX_.'customer_thread` ct
LEFT JOIN `'._DB_PREFIX_.'customer_message` m ON m.`id_customer_thread` = ct.`id_customer_thread`
LEFT OUTER JOIN `'._DB_PREFIX_.'employee` e ON e.`id_employee` = m.`id_employee`
WHERE ct.`id_order` = '.(int)$id_order.'
ORDER BY ct.`date_add` DESC'
);

return array_merge($o,$m);

}

 

Works perfect!

 

Just to confirm this is working in 1.6.0.6...   

  • Like 1
Link to comment
Share on other sites

  • 1 month later...

Nice it's working for 1.5.3!

 

I little bit improved it to be less depending on future versions.

 

Instead of replacing the original classes/Messages.php this function makes use of the override. Just add this function in the override/classes/Messages.php so just below:

 

class Message extends MessageCore

{

 

 

public static function getMessagesByOrderId($id_order, $private = false, Context $context = null)
{
  $m=parent::getMessagesByOrderId($id_order, $private, $context);
   $o = Db::getInstance()->executeS('
	SELECT ct.*, m.*, e.`firstname` AS efirstname, e.`lastname` AS elastname
	FROM `'._DB_PREFIX_.'customer_thread` ct
	LEFT JOIN `'._DB_PREFIX_.'customer_message` m ON m.`id_customer_thread` = ct.`id_customer_thread`
	LEFT OUTER JOIN `'._DB_PREFIX_.'employee` e ON e.`id_employee` = m.`id_employee`
	WHERE ct.`id_order` = '.(int)$id_order.'
	ORDER BY ct.`date_add` DESC'
   );
   return array_merge($o,$m);
}

}

 

Thanks to the original person who posted this fix!

 

 

 

 

  • The override file name is Message.php (and not Messages.php)
  • delete your /cache/class_index.php for PS regenerate the cache class file.

 

 

 

I did the override, it works, but also shows this error above each message:

 

Notice: Undefined index: is_new_for_me in/(...)/cache/smarty/compile/4e/52/39/4e5239bf8b1be835172b156956001e177a76e7c4.file.view.tpl.phpon line 1270

Notice: Undefined index: is_new_for_me in/(...)/cache/smarty/compile/4e/52/39/4e5239bf8b1be835172b156956001e177a76e7c4.file.view.tpl.phpon line 1271

 

I'm using 1.5.6.2. Any solution?

 

Thanks

Link to comment
Share on other sites

I also have the following error when the it's a message from the client:

 

Notice: Undefined index: cfirstname in /(...)/cache/smarty/compile/4e/52/39/4e5239bf8b1be835172b156956001e177a76e7c4.file.view.tpl.php on line 1284

Notice: Undefined index: clastname in /(...)/cache/smarty/compile/4e/52/39/4e5239bf8b1be835172b156956001e177a76e7c4.file.view.tpl.php on line 1285

Link to comment
Share on other sites

I did the override, it works, but also shows this error above each message:

 

Notice: Undefined index: is_new_for_me in/(...)/cache/smarty/compile/4e/52/39/4e5239bf8b1be835172b156956001e177a76e7c4.file.view.tpl.phpon line 1270

Notice: Undefined index: is_new_for_me in/(...)/cache/smarty/compile/4e/52/39/4e5239bf8b1be835172b156956001e177a76e7c4.file.view.tpl.phpon line 1271

 

I'm using 1.5.6.2. Any solution?

 

Thanks

 

 

I also have the following error when the it's a message from the client:

 

Notice: Undefined index: cfirstname in /(...)/cache/smarty/compile/4e/52/39/4e5239bf8b1be835172b156956001e177a76e7c4.file.view.tpl.php on line 1284

 

Notice: Undefined index: clastname in /(...)/cache/smarty/compile/4e/52/39/4e5239bf8b1be835172b156956001e177a76e7c4.file.view.tpl.php on line 1285

 

 

I circumvented these errors by changing the admin/themes/default/template/controllers/orders/helpers/view/view.tlp file:

<div style="overflow:auto; width:400px;" {if isset($message['is_new_for_me'])}class="new_message"{/if}>
			{if (isset($message['is_new_for_me']))}
				<a class="new_message" title="{l s='Mark this message as \'viewed\''}" href="{$smarty.server.REQUEST_URI}&token={$smarty.get.token}&messageReaded={$message['id_message']}"><img src="../img/admin/enabled.gif" alt="" /></a>
			{/if}
			{l s='At'} <i>{dateFormat date=$message['date_add']}
			</i> {l s='from'} <b>{if ($message['elastname']|escape:'htmlall':'UTF-8')}{$message['efirstname']|escape:'htmlall':'UTF-8'} {$message['elastname']|escape:'htmlall':'UTF-8'}{else}{if (isset($message['cfirstname']))}{$message['cfirstname']|escape:'htmlall':'UTF-8'} {$message['clastname']|escape:'htmlall':'UTF-8'}{else}{l s='client'}{/if}{/if}</b>

But I would prefer a better patch...

Link to comment
Share on other sites

  • 3 weeks later...
  • 1 month later...
  • 2 months later...
  • 2 months later...

I found this, slightly modified version of the override class Message.php to work great with Prestashop 1.6.0.9:

 

Also attached the file - Message.php, put it into /override/classes/Message.php

class Message extends MessageCore
{

    public static function getMessagesByOrderId($id_order, $private = false, Context $context = null)
    {
	$m=parent::getMessagesByOrderId($id_order, $private, $context);
	$o = Db::getInstance()->executeS('
	    SELECT ct.*, m.*, e.`firstname` AS efirstname, e.`lastname` AS elastname
	    FROM `'._DB_PREFIX_.'customer_thread` ct
	    LEFT JOIN `'._DB_PREFIX_.'customer_message` m ON m.`id_customer_thread` = ct.`id_customer_thread`
	    LEFT OUTER JOIN `'._DB_PREFIX_.'employee` e ON e.`id_employee` = m.`id_employee`
	    WHERE ct.`id_order` = '.(int)$id_order.'
			AND e.`id_employee` <> 0
	    ORDER BY ct.`date_add` DESC'
	    );
	return array_merge($m,$o);
    }

}

 

  • Like 2
Link to comment
Share on other sites

  • 1 month later...
  • 3 months later...

Hi,

 

I have been testing this on 1.609 and i think this is the best solution.

<?php

class Message extends MessageCore
{

   public static function getMessagesByOrderId($id_order, $private = false, Context $context = null)
{
   if (!Validate::isBool($private))
	die(Tools::displayError());
  if (!$context)
   $context = Context::getContext();
  /*$m = Db::getInstance()->executeS('
   SELECT m.*, c.`firstname` AS cfirstname, c.`lastname` AS clastname, e.`firstname` AS efirstname, e.`lastname` AS elastname,
   (COUNT(mr.id_message) = 0 AND m.id_customer != 0) AS is_new_for_me
   FROM `'._DB_PREFIX_.'message` m
   LEFT JOIN `'._DB_PREFIX_.'customer` c ON m.`id_customer` = c.`id_customer`
   LEFT JOIN `'._DB_PREFIX_.'message_readed` mr
	ON mr.`id_message` = m.`id_message`
	AND mr.`id_employee` = '.(isset($context->employee) ? (int)$context->employee->id : '\'\'').'
   LEFT OUTER JOIN `'._DB_PREFIX_.'employee` e ON e.`id_employee` = m.`id_employee`
   WHERE m.`id_order` = '.(int)$id_order.'
   '.(!$private ? ' AND m.`private` = 0' : '').'
   GROUP BY m.id_message
   ORDER BY m.date_add DESC
  ');*/

  $o = Db::getInstance()->executeS('
   SELECT ct.*, m.*, e.`firstname` AS efirstname, e.`lastname` AS elastname
   FROM `'._DB_PREFIX_.'customer_thread` ct
   LEFT JOIN `'._DB_PREFIX_.'customer_message` m ON m.`id_customer_thread` = ct.`id_customer_thread`
   LEFT OUTER JOIN `'._DB_PREFIX_.'employee` e ON e.`id_employee` = m.`id_employee`
   WHERE ct.`id_order` = '.(int)$id_order.'
   ORDER BY ct.`date_add` DESC'
  );
 

  //return array_merge($o,$m);
  return $o;

}

}
?>

I think the $m query is not neccessary, it just duplicates the first client messaje and loads the database.

Just with the second query you get all messages.

 

This is better solution than the recommended for 1.609 version just a few posts above becouse that solution just shows the shop messages not the customers replies.

 

Hope it helps, you can delete the commented code between /* */ and the //

 

Save it as Message.php and put it on /override/classes/Message.php then rename /cache/class_index.php to /cache/class_index_bak.php

Edited by Calatravo (see edit history)
  • Like 2
Link to comment
Share on other sites

  • 5 months later...
  • 1 year later...

 

I found this, slightly modified version of the override class Message.php to work great with Prestashop 1.6.0.9:

 

Also attached the file - attachicon.gifMessage.php, put it into /override/classes/Message.php

class Message extends MessageCore
{

    public static function getMessagesByOrderId($id_order, $private = false, Context $context = null)
    {
	$m=parent::getMessagesByOrderId($id_order, $private, $context);
	$o = Db::getInstance()->executeS('
	    SELECT ct.*, m.*, e.`firstname` AS efirstname, e.`lastname` AS elastname
	    FROM `'._DB_PREFIX_.'customer_thread` ct
	    LEFT JOIN `'._DB_PREFIX_.'customer_message` m ON m.`id_customer_thread` = ct.`id_customer_thread`
	    LEFT OUTER JOIN `'._DB_PREFIX_.'employee` e ON e.`id_employee` = m.`id_employee`
	    WHERE ct.`id_order` = '.(int)$id_order.'
			AND e.`id_employee` <> 0
	    ORDER BY ct.`date_add` DESC'
	    );
	return array_merge($m,$o);
    }

}

 

excellent. I confirm that is working on a 1.6.1.11 version

just clear cache on site and browser

  • Like 1
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...