diff --git a/src/com_tjvendors/site/events/vendor.php b/src/com_tjvendors/site/events/vendor.php index 54919ec1..588fc3fe 100644 --- a/src/com_tjvendors/site/events/vendor.php +++ b/src/com_tjvendors/site/events/vendor.php @@ -49,13 +49,19 @@ public function onAfterVendorSave($vendorDetails, $isNew) /* New Vendor is created */ case true: /* Send mail on Vendor create */ - $this->tjvendorsMailsHelper->onAfterVendorCreate((object) $vendorDetails); + if ($vendorDetails['notify_vendor']) + { + $this->tjvendorsMailsHelper->onAfterVendorCreate((object) $vendorDetails); + } break; /* Vendor is editted */ case false: /* Send mail on Vendor edit */ - $this->tjvendorsMailsHelper->onAfterVendorEdit((object) $vendorDetails); + if ($vendorDetails['notify_vendor']) + { + $this->tjvendorsMailsHelper->onAfterVendorEdit((object) $vendorDetails); + } break; } diff --git a/src/com_tjvendors/site/models/vendor.php b/src/com_tjvendors/site/models/vendor.php index 71142fe4..e53261b7 100644 --- a/src/com_tjvendors/site/models/vendor.php +++ b/src/com_tjvendors/site/models/vendor.php @@ -431,6 +431,12 @@ public function save($data) $data['other_city'] = ''; } + // Flag to notify the vendor on profile update/create + if (isset($data['notify_vendor']) === false) + { + $data['notify_vendor'] = 1; + } + // To check if editing in registration form if (!empty($data['vendor_id'])) {