send mail when activate the new vendor account

  • Posts: 127
  • Thank you received: 3
8 years 1 month ago #251683

-- HikaShop version -- : hikashop_business_v2.6.4
-- HikaMarket version -- : hikamarket_multivendor_v1.7.1
-- Joomla version -- : 3.6.2

Hello

In hikamarket you can configure that the logging of new sellers either manually validated by the site administrator, the system will send an email when to the new vendor you register as such, but the system will not send an email when to the new vendor it is validated by the site administrator, how I can do to make the vendor receives an email when the administrator activate the new vendor account?

Thank you !

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
8 years 1 month ago #251685

Hi,

The best would be to send an email when the vendor is saved (from unpublished to published).
So in the HikaMarket vendor class (admin/comp/com_hikamarket/classes/vendor.php), in the function "save", just before the end and the call of the trigger "onAfterVendorCreate / onAfterVendorUpdate", you can add some code

// For manual validation ; the vendor is notified when his account is published.
//   Note: An email will be send each time the vendor is being published, not only the first time.
//
if(!$new && (int)$config->get('allow_registration', 0) == 1 && empty($vendor->old->vendor_published) && !empty($vendor->vendor_published)) {
	$user_id = (isset($vendor->vendor_admin_id) ? (int)$vendor->vendor_admin_id : (int)$vendor->old->vendor_admin_id);
	$userClass = hikamarket::get('shop.class.user');
	$shopuser = $userClass->get($user_id);

	$mailClass = hikamarket::get('shop.class.mail');
	$mailClass->mail_folder = HIKAMARKET_MEDIA . 'mail' . DS;
	$infos = new stdClass;
	$infos->vendor =& $vendor;
	$infos->vendor_name = $vendor->vendor_name;
	$infos->user =& $shopuser;

	$mail = $mailClass->get('market.vendor_registration', $infos);
	if(!empty($mail)) {
		$mail->subject = JText::sprintf($mail->subject, HIKASHOP_LIVE);
		$mail->from_name = $shopConfig->get('from_name');
		$mail->from_email = $shopConfig->get('from_email');
		$mail->dst_email = (!empty($infos->email)) ? $infos->email : $vendor->vendor_email;
		$mail->dst_name = (!empty($infos->name)) ? $infos->name : $vendor->vendor_name;

		if(!empty($mail->dst_email))
			$mailClass->sendMail($mail);
	}
}
Afterwards you should modify a little the email "vendor registration" in order to display specific text if the vendor is created or if he is being published.
You can read the configuration setting "allow_registration" to check if the manual validation is enable or not ; and you can also check the vendor_published state (and the old->vendor_published one too).

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 127
  • Thank you received: 3
8 years 1 month ago #251794

Hi, thanks for your response

well, in the mail code "vendor registration", I must add a conditional to know if $ vendor-> vendor_published is 1 or 0 and the according to the condition, the text of the mail, is that correct?

Regards !

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
8 years 1 month ago #251795

Hi,

Right.
With " $vendor->vendor_published " ( 0 or 1 ) you can know if the vendor is currently published or not.
And with " $vendor->old->vendor_published " you can know if the vendor was previously published or not.

So with

if($vendor->old->vendor_published == 0 && $vendor->vendor_published == 1) { /* ... */ }
You know that the vendor is being published.
If you do not have a " $vendor->old " you know that the vendor is being created.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
The following user(s) said Thank You: zetap

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

  • Posts: 127
  • Thank you received: 3
8 years 1 month ago #251864

Hello

Perfect I understand.

Now, I'm not clear where paste the code you sent me earlier, you said should go in fiunción "save" in "admin/comp/com_hikamarket/classes/vendor.php" just before the end and the call of the trigger "onAfterVendorCreate / onAfterVendorUpdate"
I have tried paste before the call of the trigger, after the call of the trigger, before "return $status" after "return $status", but does not send the email after recording the seller from unpublished to published, you can tell me in the code that I copy you, where you add the code to send the email?

	public function save(&$vendor) { 
				/*....*/
				}
			}

		/*Insert the code right here */

			if($new) {
				$dispatcher->trigger('onAfterVendorCreate', array(&$vendor));
			} else {
				$dispatcher->trigger('onAfterVendorUpdate', array(&$vendor));
			}
		}
		return $status;
	}

thanks greetings !

Last edit: 8 years 1 month ago by Jerome. Reason: cleaning code

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
8 years 1 month ago #251869

Hi,

I have edited your message to give you the indication where to paste the code I gave you before.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 127
  • Thank you received: 3
8 years 1 month ago #252086

Hi, thanks for your response

I paste the code where you indicated to me, but it did not work, after editing "vendor.php" I registered a new seller, then from the backend, I save the seller from unpublished to published and has not sent the mail notification.

that I may be doing wrong?

Thank you very much !

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
8 years 1 month ago #252143

Hi,

I am not able to reproduce your issue.
If I unpublish/publish a vendor in the backend, thanks to the "toogle" in the vendor listing or directly in the vendor page ; the notification email is sent to my vendor email.

Please note that the email is send only when the vendor registration is "manual validation", that your vendor need a "vendor email" and the email "Market: vendor registration" need to be published.
Please also note that the first time the vendor is registering, the email should also be sent.
If you made some override in the email ; please backup and revert them.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 127
  • Thank you received: 3
8 years 1 month ago #252151

Hello

I followed all your instructions, I do not understand why it does not work.
I have verified that the vendor that I want to activate, he has configured a "email vendor", when the new seller is registered, the email is sent correctly, but when upgrading unpublish / publish, email is not sent.
I attached screenshot hihamarket settings, mail code, which have not changed, and the class code vendor.php with the modifications you provided me.
I appreciate your help to solve this problem.

Regards !

Attachments:
Last edit: 8 years 1 month ago by Jerome.

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
8 years 1 month ago #252171

Hi,

Please do not include files from HikaShop or HikaMarket in the forum.
I see that you do not have HikaShop 1.7.2 ; I have exceptionnaly update the package in order to add the patch for the vendor notification.
Please update to the latest version.
www.hikashop.com/support/documentation/1...arket-changelog.html

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
The following user(s) said Thank You: zetap

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

  • Posts: 127
  • Thank you received: 3
8 years 1 month ago #252300

Hi, thanks for your response

Fortunately, with your help, I was able to resolve the issue of mail when activating the seller.

Greetings thank you !

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

  • Posts: 127
  • Thank you received: 3
8 years 1 month ago #252793

Hello

I return to the post because I desafortundamente noticed that I thought solved, not working properly.

you indicated me to use the following code in the mail "Market: Vendor registration"

if ($ vendor-> old-> == 0 && $ vendor_published vendor-> vendor_published == 1) {/ * ... * /}

Well,I add to conditional, a "else", to send the appropriate text according to whether it was vendor register or vendor activation
<? Php
if ($ vendor-> old-> == 0 && $ vendor_published vendor-> vendor_published == 1) {?>
                 / * Registered seller * /
{TXT: VENDOR_REGISTRATION_BEGIN_MESSAGE}

<? Php}
else {?>
                 / * Seller activated * /
{TXT: VENDOR_REGISTRATION_ACTIVE_MESSAGE}
<? Php}?>

The problem is, that always the option going for the "else", whether vendor registration or change unpublish / publish vendor.
I can indicate that I should change in the condition to do the right thing.

Thank you !

Last edit: 8 years 1 month ago by zetap.

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
8 years 1 month ago #252797

Hi,

The code I gave you is :

if($vendor->old->vendor_published == 0 && $vendor->vendor_published == 1) { /* ... */ }
It comes from the patch for the HikaMarket class I gave you before.

The code you paste is really different and does not sound like something valid.

Now, if you put that code directly in the HTML part ; you won't have a variable " $vendor " but you will have it under " $data->vendor ".
So that code
if($data->vendor->old->vendor_published == 0 && $data->vendor->vendor_published == 1) { /* ... */ }
will be more appropriate for the email content.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 127
  • Thank you received: 3
8 years 1 month ago #252829

Hello, thanks for the answer

According to what I indicas, replace

if ($ vendor-> old-> == 0 && $ vendor_published vendor-> vendor_published == 1)
by
if ($ data-> vendor-> old-> == 0 && vendor_published $ data-> vendor-> vendor_published == 1)
But continues out by the refusal of the conditional, no matter if is the record of the seller or is vendor state change unpublished/published

To check the values ​​of variables in both situations add the following code, prior to conditional
<P> <? Php echo $ data-> vendor-> old-> vendor_published; ?> - Old vendor </ p>
<P> <? Php echo $ data-> vendor-> vendor_published; ?> - Vendor </ p>

Result when vendor registers
- $ Data-> vendor-> old-> vendor_published = no value
- $ Data-> vendor-> vendor_published = no value
Result after change vendor state, unpublished/published
- $ Data-> vendor-> old-> vendor_published = 0
- $ Data-> vendor-> vendor_published = 1
With the values of the variables will always go for refusal conditional.

You could tell me how I can fix it?

Thank you very much !

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
8 years 1 month ago #252830

Hi,

You should really check the code you paste ; it's not what I gave you and it's not a something valid in PHP...

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 127
  • Thank you received: 3
8 years 1 month ago #252956

Hello

Well, I've already solved, now commands the same mail with different text according to action.

Thanks greetings !

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

Moderators: Obsidev
Time to create page: 0.080 seconds
Powered by Kunena Forum