public function sendNewProductToManagerAndOwner(Product $product)
    {
        $productOwner = $product->productOwner;
        $mailVars = [
            '{productId}' => $product->id,
            '{title}' => $product->translation->title,
            '{ownerId}' => $productOwner->id,
            '{ownerEmail}' => $productOwner->email,
            '{owner}' => !(empty($productOwner->profile->name . ' ' . $productOwner->profile->surname)) ?
                $productOwner->profile->name . ' ' . $productOwner->profile->surname : $productOwner->profile->info,
            '{link}' => Html::a(
                $product->translation->title,
                Url::toRoute('/shop/product/save?id=' . $product->id . '&languageId=' . Language::getCurrent()->id, true)),

        ];

        //Send mail to manager
        $mailTemplate = $this->createMailTemplate('new-product-to-manager', $mailVars);
        $partnerManagerEmail = \Yii::$app->getModule('shop')->partnerManagerEmail;

        if (!empty($mailTemplate) && !empty($partnerManagerEmail)) {
            $subject = $mailTemplate->getSubject();
            $bodyParams = ['bodyContent' => $mailTemplate->getBody()];

            $sendFrom = [\Yii::$app->get('shopMailer')->transport->getUsername() => \Yii::$app->name ?? parse_url(Url::base(true), PHP_URL_HOST)];

            $this->sendMessage($sendFrom, $partnerManagerEmail, $subject, $bodyParams);
        }

        //Send mail to partner
        $mailTemplate = $this->createMailTemplate('new-product-to-partner', $mailVars);
        if (!empty($mailTemplate) && !empty($productOwner->email)) {
            $subject = $mailTemplate->getSubject();
            $bodyParams = ['bodyContent' => $mailTemplate->getBody()];

            $sendFrom = [\Yii::$app->get('shopMailer')->transport->getUsername() => \Yii::$app->name ?? parse_url(Url::base(true), PHP_URL_HOST)];

            $this->sendMessage($sendFrom, $productOwner->email, $subject, $bodyParams);
        }
    }
public function sendNewProductToManagerAndOwner(Product $product)
    {
        $productOwner = $product->productOwner;
        $mailVars = [
            '{productId}' => $product->id,
            '{title}' => $product->translation->title,
            '{ownerId}' => $productOwner->id,
            '{ownerEmail}' => $productOwner->email,
            '{owner}' => !(empty($productOwner->profile->name . ' ' . $productOwner->profile->surname)) ?
                $productOwner->profile->name . ' ' . $productOwner->profile->surname : $productOwner->profile->info,
            '{link}' => Html::a(
                $product->translation->title,
                Url::toRoute('/shop/product/save?id=' . $product->id . '&languageId=' . Language::getCurrent()->id, true)),

        ];

        //Send mail to manager
        $mailTemplate = $this->createMailTemplate('new-product-to-manager', $mailVars);
        $partnerManagerEmail = \Yii::$app->getModule('shop')->partnerManagerEmail;

        if (!empty($mailTemplate) && !empty($partnerManagerEmail)) {
            $subject = $mailTemplate->getSubject();
            $bodyParams = ['bodyContent' => $mailTemplate->getBody()];

            $sendFrom = [\Yii::$app->get('shopMailer')->transport->getUsername() => \Yii::$app->name ?? parse_url(Url::base(true), PHP_URL_HOST)];

            $this->sendMessage($sendFrom, $partnerManagerEmail, $subject, $bodyParams);
        }

        //Send mail to partner
        $mailTemplate = $this->createMailTemplate('new-product-to-partner', $mailVars);
        if (!empty($mailTemplate) && !empty($productOwner->email)) {
            $subject = $mailTemplate->getSubject();
            $bodyParams = ['bodyContent' => $mailTemplate->getBody()];

            $sendFrom = [\Yii::$app->get('shopMailer')->transport->getUsername() => \Yii::$app->name ?? parse_url(Url::base(true), PHP_URL_HOST)];

            $this->sendMessage($sendFrom, $productOwner->email, $subject, $bodyParams);
        }
    }
public function sendNewProductToManagerAndOwner ( Product $ product ) { $ productOwner = $ product -> productOwner ; $ mailVars = [ '{productId}' => $ product -> id , '{title}' => $ product -> translation -> title , '{ownerId}' => $ productOwner -> id , '{ownerEmail}' => $ productOwner -> email , '{owner}' => ! ( empty ( $ productOwner -> profile -> name . ' ' . $ productOwner -> profile -> surname ) ) ? $ productOwner -> profile -> name . ' ' . $ productOwner -> profile -> surname : $ productOwner -> profile -> info , '{link}' => Html :: a ( $ product -> translation -> title , Url :: toRoute ( '/shop/product/save?id=' . $ product -> id . '&languageId=' . Language :: getCurrent ( ) -> id , true ) ) , ] ; //Send mail to manager $ mailTemplate = $ this -> createMailTemplate ( 'new-product-to-manager' , $ mailVars ) ; $ partnerManagerEmail = \ Yii :: $ app -> getModule ( 'shop' ) -> partnerManagerEmail ; if ( ! empty ( $ mailTemplate ) && ! empty ( $ partnerManagerEmail ) ) { $ subject = $ mailTemplate -> getSubject ( ) ; $ bodyParams = [ 'bodyContent' => $ mailTemplate -> getBody ( ) ] ; $ sendFrom = [ \ Yii :: $ app -> get ( 'shopMailer' ) -> transport -> getUsername ( ) => \ Yii :: $ app -> name ?? parse_url ( Url :: base ( true ) , PHP_URL_HOST ) ] ; $ this -> sendMessage ( $ sendFrom , $ partnerManagerEmail , $ subject , $ bodyParams ) ; } //Send mail to partner $ mailTemplate = $ this -> createMailTemplate ( 'new-product-to-partner' , $ mailVars ) ; if ( ! empty ( $ mailTemplate ) && ! empty ( $ productOwner -> email ) ) { $ subject = $ mailTemplate -> getSubject ( ) ; $ bodyParams = [ 'bodyContent' => $ mailTemplate -> getBody ( ) ] ; $ sendFrom = [ \ Yii :: $ app -> get ( 'shopMailer' ) -> transport -> getUsername ( ) => \ Yii :: $ app -> name ?? parse_url ( Url :: base ( true ) , PHP_URL_HOST ) ] ; $ this -> sendMessage ( $ sendFrom , $ productOwner -> email , $ subject , $ bodyParams ) ; } }
If user which has not 'createProductWithoutModeration' permission
email to manager and this user will be sent
@param Product $product
If user which has not createProductWithoutModeration permission email to manager and this user will be sent