Post by Opencart_k » Thu Jun 15, 2017 5:33 pm

Hello,
I am using Multimerch and I would like to ask, if anyone knows if I can allow from the admin panel the messages to be sent between customers and vendors.
I would like to control which messages could be sent and which could not be sent, after I read them.

Any ideas how to do that?

Thank you in advance.

Newbie

Posts

Joined
Thu May 25, 2017 9:27 pm

Post by affect » Thu Jun 15, 2017 9:20 pm

Martin, founder of MultiMerch here - thanks for using our product!

At the moment MultiMerch does not have a moderation/preapproval system for private messages. You as the administrator can monitor all conversations between customers and vendors as well as take part in conversations yourself, but it's not possible to block specific messages from getting sent or approve them manually.

This is possible as a custom modification, but I generally advise against this as it makes the conversation system slow and inefficient. Instead, I recommend explicitly defining conversation rules and focusing on building a user base of trusted vendors who will not break them :)

MultiMerch Multivendor Marketplace for OpenCart

Image Image Image Image Image


User avatar
Active Member

Posts

Joined
Sat Aug 13, 2011 5:04 pm


Post by Opencart_k » Thu Jun 15, 2017 11:27 pm

Hello Martin,
Thank you for your answer!

Except from defining conversation rules and communicating with them too, how can I manually notify them if they try to send a phone number or email? This would be great to have.
Can I add some piece of code to alert them when they are in the message box?

Newbie

Posts

Joined
Thu May 25, 2017 9:27 pm

Post by affect » Fri Jun 16, 2017 2:55 pm

Which version of MultiMerch are you currently using?

If you really need a filter like that, you can add an extra check to our message submission function in the conversation controller that would try to match a phone number (or anything else) via regex in the message being submitted and prevent submission if it's the case.

MultiMerch Multivendor Marketplace for OpenCart

Image Image Image Image Image


User avatar
Active Member

Posts

Joined
Sat Aug 13, 2011 5:04 pm


Post by Opencart_k » Sun Jun 18, 2017 1:45 am

I use Multimerch_marketplace_8.7.2.

I developed a php script where it checks if an email or a telephone number appears in a string and prompts some message.
The message submission function in the conversation controller is located in ../admin/controller/multimerch/conversation.php?
The script should take as a parameter the message (instead of the sample string I created) and allow the submission or not if it finds email/telephone number.

Newbie

Posts

Joined
Thu May 25, 2017 9:27 pm

Post by affect » Mon Jun 19, 2017 3:25 pm

Front store messaging controller is located in catalog/controller/account/msmessage.php, you're looking for the jxSendMessage() function.

MultiMerch Multivendor Marketplace for OpenCart

Image Image Image Image Image


User avatar
Active Member

Posts

Joined
Sat Aug 13, 2011 5:04 pm


Post by Opencart_k » Mon Jun 19, 2017 7:26 pm

That is great thank you!

My script was

Code: Select all

<?php 

$string = "bla bla pickachudomain.com MIME-Version: balbasurdomain.com bla bla bla papakidomain.com 222 eurw ";
$matches = array();
$pattern = '/[a-z\d._%+-]+@[a-z\d.-]+\.[a-z]{2,4}\b/i';

$matches2 = array();
$pattern2 = '/[0-9]{3}[\-][0-9]{7}|[0-9]{3}[\s][0-9]{7}|[0-9]{3}[\s][0-9]{3}[\s][0-9]{4}|[0-9]{10}|[0-9]{3}[\-][0-9]{3}[\-][0-9]{4}/';
preg_match_all($pattern,$string,$matches);
preg_match_all($pattern2,$string,$matches2);
print_r($matches);
print_r($matches2);

if (empty($matches[0])&&empty($matches2[0])    ) {
	echo "Arrays are empty. Submit the message.";
}

else {
	echo "Found matches. Do not submit the message or prompt alert" ;
}

?>
I tried to enable inside the function by writing :

Code: Select all

$json = array();
	
	
	
		$matches = array();
		$pattern = '/[a-z\d._%+-]+@[a-z\d.-]+\.[a-z]{2,4}\b/i';
		$matches2 = array();
		$pattern2 = '/[0-9]{3}[\-][0-9]{7}|[0-9]{3}[\s][0-9]{7}|[0-9]{3}[\s][0-9]{3}[\s][0-9]{4}|[0-9]{10}|[0-9]{3}[\-][0-9]{3}[\-][0-9]{4}/';
		preg_match_all($pattern,$message_text,$matches);
		preg_match_all($pattern2,$message_text,$matches2);
		
		if (empty($matches[0])&&empty($matches2[0])    ) {
			echo "Arrays are empty. Submit the message.";
		}

		else {
			$json['errors'][] = $this->language->get('ms_error_empty_message');
			$this->response->setOutput(json_encode($json));
			return;
		}

		
		
		
		if (empty($message_text)) {
			$json['errors'][] = $this->language->get('ms_error_empty_message');
			$this->response->setOutput(json_encode($json));
			return;
		}
but I could not get the messages I was trying to output. Any ideas on how to implement it?

Newbie

Posts

Joined
Thu May 25, 2017 9:27 pm

Post by affect » Thu Jun 22, 2017 1:29 am

This function is called via ajax, so it needs to return the value as a $json array instead of simply outputting it. If you're displaying a new error message, you need to initialize the $json['errors'] array and return it via setOutput in the same way we do it by default:

$json['errors'][] = $this->language->get('ms_error_empty_message');
$this->response->setOutput(json_encode($json));

MultiMerch Multivendor Marketplace for OpenCart

Image Image Image Image Image


User avatar
Active Member

Posts

Joined
Sat Aug 13, 2011 5:04 pm

Who is online

Users browsing this forum: No registered users and 13 guests