diff --git a/app/appfront/config/appfront.php b/app/appfront/config/appfront.php index 4d85e9e94322fc7f8288fbabf987fc0414c6f16e..bfc90525a9aa2b4bc1f34d5ea9ea8458a1caa1b7 100644 --- a/app/appfront/config/appfront.php +++ b/app/appfront/config/appfront.php @@ -54,11 +54,11 @@ return [ */ //'authTimeout' => 56666, ], - + # 404页面对应的链接。 'errorHandler' => [ 'errorAction' => 'site/helper/error', ], - + # 首页对应的url 'urlManager' => [ 'rules' => [ '' => 'cms/home/index', diff --git a/app/appfront/modules/Checkout/block/onepage/Placeorder.php b/app/appfront/modules/Checkout/block/onepage/Placeorder.php index ffc90a85c92d1e824d118f4cc690e60ce71cfd2c..47b439875bb24888ab1941b7df5875966c26cd76 100644 --- a/app/appfront/modules/Checkout/block/onepage/Placeorder.php +++ b/app/appfront/modules/Checkout/block/onepage/Placeorder.php @@ -48,6 +48,11 @@ class Placeorder{ # 将购物车数据,生成订单。 $genarateStatus = Yii::$service->order->generateOrderByCart($this->_billing,$this->_shipping_method,$this->_payment_method); if($genarateStatus){ + # 得到当前的订单信息 + $orderInfo = Yii::$service->order->getCurrentOrderInfo(); + # 发送新订单邮件 + Yii::$service->email->order->sendCreateEmail($orderInfo); + # 得到支付跳转前的准备页面。 $startUrl = Yii::$service->payment->getStandardStartUrl(); Yii::$service->url->redirect($startUrl); exit; diff --git a/config/services/Email.php b/config/services/Email.php index b03b8b3a4015e4da2fdb5edaad8dcf178e5ee4f5..3e8d8931302ca4e8a218a540005bd8864ce962e8 100644 --- a/config/services/Email.php +++ b/config/services/Email.php @@ -10,18 +10,16 @@ return [ 'class' => 'fecshop\services\Email', - /* + /** + * 下面为配置邮箱的smtp部分,你可以配置多个smtp, + * 在具体的邮件使用中,选择下面的数组的相应的key即可。 'mailerConfig' => [ # 默认通用配置 'default' => [ - 'class' => 'yii\swiftmailer\Mailer', 'transport' => [ 'class' => 'Swift_SmtpTransport', 'host' => 'smtp.qq.com', - //'username' => '2358269014@qq.com', - //'password' => 'bjxpkyzfwkxnebai', - 'username' => '372716335@qq.com', 'password' => 'wffmbummgnhhcbbj', @@ -36,49 +34,49 @@ return [ 'login' => [ - 'class' => 'yii\swiftmailer\Mailer', 'transport' => [ 'class' => 'Swift_SmtpTransport', 'host' => 'smtp.qq.com', - //'username' => '2358269014@qq.com', - //'password' => 'bjxpkyzfwkxnebai', - 'username' => '372716335@qq.com', 'password' => 'wffmbummgnhhcbbj', - 'port' => '587', 'encryption' => 'tls', ], 'messageConfig'=>[ 'charset'=>'UTF-8', ], - ], ], */ + + # 公用配置 + 'mailerInfo' => [ + #在邮件中显示的Store的名字 + 'storeName' => 'FecShop', + # 在邮件中显示的电话 + 'phone' => 'xxxxxxxxxx', + # 在邮件中显示的联系邮箱地址。 + 'contacts' => [ + 'emailAddress' => '2358269014@qq.com', + ], + + ], + + 'childService' => [ + /** + * 用户中心部分的邮件的设置。 + */ 'customer' => [ 'class' => 'fecshop\services\email\Customer', - # 公用配置 - 'mailer' => [ - #在邮件中显示的Store的名字 - 'storeName' => 'FecShop', - # 在邮件中显示的电话 - 'phone' => 'xxxxxxxxxx', - # 在邮件中显示的联系邮箱地址。 - 'contacts' => [ - 'emailAddress' => '2358269014@qq.com', - ], - # 通过邮箱找回密码,发送的resetToken过期的秒数 - 'user.passwordResetTokenExpire' => 3600*24*1, # 一天 - - ], + # 各个邮件的模板部分: 'emailTheme' => [ + # 注册账户发送的邮件的模板配置 'register' => [ 'enable' => true, # 邮件内容的动态数据提供部分 @@ -107,7 +105,7 @@ return [ */ 'mailerConfig' => 'default', ], - + # 登录用户发送邮件的模板的设置。 'login' => [ 'enable' => true, # 邮件内容的动态数据提供部分 @@ -117,17 +115,19 @@ return [ # 如果不定义 mailerConfig,则会使用email service里面的默认配置 'mailerConfig' => 'default', ], - + # 忘记密码发送邮件的模板的设置 'forgotPassword' => [ 'enable' => true, 'widget' => 'fecshop\services\email\widgets\customer\account\forgotpassword\Body', # 邮件内容的view部分 'viewPath' => '@fecshop/services/email/views/customer/account/forgotpassword', + #忘记密码邮件发送后的超时时间。 + 'passwordResetTokenExpire' => 86400, # 3600*24*1, # 一天 # 如果不定义 mailerConfig,则会使用email service里面的默认配置 + # 通过邮箱找回密码,发送的resetToken过期的秒数 'mailerConfig' => 'default', ], - - + # 联系我们发送的邮件模板 'contacts' => [ 'enable' => true, # 联系我们的邮箱地址 @@ -140,8 +140,7 @@ return [ # 如果不定义 mailerConfig,则会使用email service里面的默认配置 //'mailerConfig' => 'default', ], - - + # 订阅newsletter后发送的邮件模板。 'newsletter' => [ # 订阅邮件成功后,是否发送邮件给用户 'enable' => true, @@ -154,6 +153,53 @@ return [ ], ], ], + + 'order' => [ + 'class' => 'fecshop\services\email\Order', + # 各个邮件的模板部分: + 'emailTheme' => [ + # 游客发送的邮件的模板配置 + 'guestCreate' => [ + 'enable' => true, + # 邮件内容的动态数据提供部分 + 'widget' => 'fecshop\services\email\widgets\order\create\Body', + # 邮件内容的view部分 + 'viewPath' => '@fecshop/services/email/views/order/create/guest', + /** + * 1.默认是default,譬如下面的 'mailerConfig' => 'default',你可以不填写,因为默认就是default + * 2.您可以使用上面email服务的配置项mailerConfig中的设置的各个项,譬如填写default 或者 login等。 + * 3.您还可以直接填写数组的配置(完整配置),譬如: + * 'register' => [ + * 'class' => 'yii\swiftmailer\Mailer', + * 'transport' => [ + * 'class' => 'Swift_SmtpTransport', + * 'host' => 'smtp.qq.com', + * 'username' => '372716335@qq.com', + * 'password' => 'wffmbummgnhhcbbj', + * 'port' => '587', + * 'encryption' => 'tls', + * ], + * 'messageConfig'=>[ + * 'charset'=>'UTF-8', + * ], + * + * ], + */ + 'mailerConfig' => 'default', + ], + # 登录用户发送邮件的模板的设置。 + 'loginedCreate' => [ + 'enable' => true, + # 邮件内容的动态数据提供部分 + 'widget' => 'fecshop\services\email\widgets\order\create\Body', + # 邮件内容的view部分 + 'viewPath' => '@fecshop/services/email/views/order/create/logined', + # 如果不定义 mailerConfig,则会使用email service里面的默认配置 + 'mailerConfig' => 'default', + ], + + ], + ], ], ], diff --git a/models/mysqldb/Customer.php b/models/mysqldb/Customer.php index 6e38768ce5a782843e6647531a2e8d8ff27ae4e6..bace9bd17e8d79d5e43c6bf5773ee3b9a7b68509 100644 --- a/models/mysqldb/Customer.php +++ b/models/mysqldb/Customer.php @@ -50,7 +50,7 @@ class Customer extends ActiveRecord implements IdentityInterface /** * @inheritdoc */ - # ͨid ҵidentity + # 通过id 找到identity public static function findIdentity($id) { return static::findOne(['id' => $id, 'status' => self::STATUS_ACTIVE]); @@ -59,12 +59,12 @@ class Customer extends ActiveRecord implements IdentityInterface /** * @inheritdoc */ - # ͨaccess_token ҵidentity + # 通过access_token 找到identity public static function findIdentityByAccessToken($token, $type = null) { return static::findOne(['access_token' => $token, 'status' => self::STATUS_ACTIVE]); } - # access_token + # 生成access_token public function generateAccessToken() { $this->access_token = Yii::$app->security->generateRandomString(); @@ -87,7 +87,7 @@ class Customer extends ActiveRecord implements IdentityInterface * @param string $token password reset token * @return static|null */ - # ˴ʹõ + # 此处是忘记密码所使用的 public static function findByPasswordResetToken($token) { if (!static::isPasswordResetTokenValid($token)) { @@ -111,10 +111,10 @@ class Customer extends ActiveRecord implements IdentityInterface if (empty($token)) { return false; } - $timestamp = (int) substr($token, strrpos($token, '_') + 1); - $expire = Yii::$app->params['user.passwordResetTokenExpire']; - return $timestamp + $expire >= time(); + //$expire = Yii::$app->params['user.passwordResetTokenExpire']; + $expire = Yii::$service->email->customer->getPasswordResetTokenExpire(); + return $timestamp + $expire >= time(); } /** diff --git a/services/Email.php b/services/Email.php index f2773bdb56ee0ea3fa627afc1a01070147a12cc9..8f40885d6c3d86df1b87e7902a0f9e98b9898a5a 100644 --- a/services/Email.php +++ b/services/Email.php @@ -19,6 +19,7 @@ class Email extends Service { public $mailerConfig; public $defaultForm; + public $mailerInfo; /** * 邮件模板部分动态数据提供类的返回数据的函数名字,使用默认值即可。 */ @@ -29,19 +30,37 @@ class Email extends Service protected $_from; - /** - * @property $email_address | String 邮箱地址字符串 - * @return boolean 如果格式正确,返回true + * 在邮箱中显示的 邮箱地址 */ - protected function actionValidateFormat($email_address){ - if(preg_match("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$^",$email_address)){ - return true; - }else{ - return false; + public function contactsEmailAddress(){ + $mailerInfo = $this->mailerInfo; + if(isset($mailerInfo['contacts']['emailAddress'])){ + return $mailerInfo['contacts']['emailAddress']; + } + } + /** + * 在邮箱中显示的 商城名字(Store Name) + */ + public function storeName(){ + $mailerInfo = $this->mailerInfo; + if(isset($mailerInfo['storeName'])){ + return $mailerInfo['storeName']; + } + } + /** + * 在邮件中显示的 联系手机号 + * Yii::$service->email->customer->contactsPhone(); + */ + public function contactsPhone(){ + $mailerInfo = $this->mailerInfo; + if(isset($mailerInfo['phone'])){ + return $mailerInfo['phone']; } - } + + + /** * 得到MailConfig */ @@ -63,7 +82,6 @@ class Email extends Service if(!empty($mailerConfig['transport']['username'])){ return $mailerConfig['transport']['username']; } - } return ; } @@ -276,4 +294,17 @@ class Email extends Service } } + + /** + * @property $email_address | String 邮箱地址字符串 + * @return boolean 如果格式正确,返回true + */ + protected function actionValidateFormat($email_address){ + if(preg_match("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$^",$email_address)){ + return true; + }else{ + return false; + } + + } } diff --git a/services/Order.php b/services/Order.php index 7fc80950e227b7d2567e46ff7d742c5824164105..cdf0fbfafda4b9fa93deaaded267253feed400c3 100644 --- a/services/Order.php +++ b/services/Order.php @@ -36,6 +36,7 @@ class Order extends Service public $orderCountThatReturnPendingStock = 30; protected $checkout_type; + protected $_currentOrderInfo; const CHECKOUT_TYPE_STANDARD = 'standard'; const CHECKOUT_TYPE_EXPRESS = 'express'; const CURRENT_ORDER_CREAMENT_ID = 'current_order_creament_id'; @@ -87,7 +88,49 @@ class Order extends Service return new MyOrder; } } + /** + * 通过从session中取出来订单的increment_id + * 在通过increment_id(订单编号)取出来订单信息。 + */ + protected function actionGetCurrentOrderInfo(){ + if(!$this->_currentOrderInfo){ + $increment_id = Yii::$service->order->getSessionIncrementId(); + $this->_currentOrderInfo = Yii::$service->order->getOrderInfoByIncrementId($increment_id); + } + return $this->_currentOrderInfo; + } + + /** + * @property $increment_id | String 订单编号 + * @return Array + * 通过order_id 从数据库中取出来订单数据,然后在进行了二次处理后的订单数据。 + */ + protected function actionGetOrderInfoByIncrementId($increment_id){ + $one = $this->getByIncrementId($increment_id); + if(!$one){ + return ; + } + + $primaryKey = $this->getPrimaryKey(); + if(!isset($one[$primaryKey]) || empty($one[$primaryKey])){ + return ; + } + $order_info = []; + foreach($one as $k=>$v){ + $order_info[$k] = $v; + } + $order_info['customer_address_state_name'] =Yii::$service->helper->country->getStateByContryCode($order_info['customer_address_country'],$order_info['customer_address_state']); + $order_info['customer_address_country_name'] = Yii::$service->helper->country->getCountryNameByKey($order_info['customer_address_country']); + $order_info['currency_symbol'] = Yii::$service->page->currency->getSymbol($order_info['order_currency_code']); + $order_info['products'] = Yii::$service->order->item->getByOrderId($one[$primaryKey]); + return $order_info; + } + /** + * @property $order_id | Int + * @return Array + * 通过order_id 从数据库中取出来订单数据,然后在进行了二次处理后的订单数据。 + */ protected function actionGetOrderInfoById($order_id){ if(!$order_id){ return ; @@ -272,6 +315,11 @@ class Order extends Service $state = $address['state']; //echo "$shipping_method,$country,$state";exit; $cartInfo = Yii::$service->cart->getCartInfo($shipping_method,$country,$state); + # 检查cartInfo中是否存在产品 + if(!is_array($cartInfo) && empty($cartInfo)){ + Yii::$service->helper->errors->add('current cart product is empty'); + return false; + } # 检查产品是否有库存,如果没有库存则返回false $deductStatus = Yii::$service->product->stock->checkItemsStock($cartInfo['products']); if(!$deductStatus){ diff --git a/services/email/Customer.php b/services/email/Customer.php index 9e015dd3f787a38cffefe90464323494a8df47f7..815c2d18c6e6e94355a5ef8054a162536fd8e5c5 100644 --- a/services/email/Customer.php +++ b/services/email/Customer.php @@ -17,43 +17,13 @@ use yii\base\InvalidValueException; */ class Customer { - /** - * 公用配置部分配置 - */ - public $mailer; + /** * 邮件模板部分配置 */ public $emailTheme; - /** - * 得到联系我们的邮箱地址 - */ - public function contactsEmailAddress(){ - $mailerConfig = $this->mailer; - if(isset($mailerConfig['contacts']['emailAddress'])){ - return $mailerConfig['contacts']['emailAddress']; - } - } - /** - * 得到Store Name - */ - public function storeName(){ - $mailerConfig = $this->mailer; - if(isset($mailerConfig['storeName'])){ - return $mailerConfig['storeName']; - } - } - /** - * 得到联系的手机 - * Yii::$service->email->customer->contactsPhone(); - */ - public function contactsPhone(){ - $mailerConfig = $this->mailer; - if(isset($mailerConfig['phone'])){ - return $mailerConfig['phone']; - } - } + /** * @property $toEmail | String send to email address. @@ -152,6 +122,15 @@ class Customer } } } + /** + * 超时时间:忘记密码发送邮件,内容中的修改密码链接的超时时间。 + */ + public function getPasswordResetTokenExpire(){ + $forgotPasswordInfo = $this->emailTheme['forgotPassword']; + if(isset($forgotPasswordInfo['passwordResetTokenExpire']) && $forgotPasswordInfo['passwordResetTokenExpire']){ + return $forgotPasswordInfo['passwordResetTokenExpire']; + } + } /** * @property $emailInfo | Array , 数组 diff --git a/services/email/Order.php b/services/email/Order.php new file mode 100644 index 0000000000000000000000000000000000000000..fdcc24351f1b8c35df3f48bfada1e28b3e31a7e2 --- /dev/null +++ b/services/email/Order.php @@ -0,0 +1,67 @@ + + * @since 1.0 + */ +class Order +{ + + /** + * 邮件模板部分配置 + */ + public $emailTheme; + + + + /** + * @property $toEmail | String send to email address. + * 新订单邮件 + * + */ + public function sendCreateEmail($orderInfo){ + $toEmail = $orderInfo['customer_email']; + if(Yii::$app->user->isGuest){ + $emailThemeInfo = $this->emailTheme['guestCreate']; + }else{ + $emailThemeInfo = $this->emailTheme['loginedCreate']; + } + if(isset($emailThemeInfo['enable']) && $emailThemeInfo['enable']){ + $mailerConfigParam = ''; + if(isset($emailThemeInfo['mailerConfig']) && $emailThemeInfo['mailerConfig']){ + $mailerConfigParam = $emailThemeInfo['mailerConfig']; + } + if(isset($emailThemeInfo['widget']) && $emailThemeInfo['widget']){ + $widget = $emailThemeInfo['widget']; + } + if(isset($emailThemeInfo['viewPath']) && $emailThemeInfo['viewPath']){ + $viewPath = $emailThemeInfo['viewPath']; + } + if($widget && $viewPath){ + list($subject,$htmlBody) = Yii::$service->email->getSubjectAndBody($widget,$viewPath,'',$orderInfo); + $sendInfo = [ + 'to' => $toEmail, + 'subject' => $subject, + 'htmlBody' => $htmlBody, + 'senderName'=> Yii::$service->store->currentStore, + ]; + //var_dump($sendInfo);exit; + Yii::$service->email->send($sendInfo,$mailerConfigParam); + return true; + } + } + } + + +} diff --git a/services/email/views/order/create/guest/body_en.php b/services/email/views/order/create/guest/body_en.php new file mode 100644 index 0000000000000000000000000000000000000000..5dcb1c824c7c86bd50b3cb42bc627b2f44df57ba --- /dev/null +++ b/services/email/views/order/create/guest/body_en.php @@ -0,0 +1,167 @@ + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + +
+

+ Hello,

+

+ Thank you for your order from . + Once your package ships we will send an email with a link to track your order. + If you have any questions about your order please contact us at or call us at Monday - Friday, 8am - 5pm PST. +

+

Your order confirmation is below. Thank you again for your business.

+
+

Your Order # (placed on )

+
+ + + + + + + + + + + + + + + + +
Billing Information:Payment Method:
+
+
+ , ,
+
+ T: +
  +

PayPal -

+ +
+
+ + + + + + + + + + + + + + + + +
Shipping Information:Shipping Method:
+
+
+ , ,
+
+ T: + +
  + +   +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ImageNameSkuQtySubTotal
+ + <?= $product['name'] ?> + + + + + +
    + $val){ ?> + +
  • page->translate->__($label.':') ?>page->translate->__($val) ?>
  • + + +
+ +
Subtotal
Shipping & handling
Discount
Total
+

+

Thank you,

+
+
+ + + diff --git a/services/email/views/order/create/guest/subject_en.php b/services/email/views/order/create/guest/subject_en.php new file mode 100644 index 0000000000000000000000000000000000000000..e55266b5739c15dfe05f55ede3a7cf0f7b6b5ba8 --- /dev/null +++ b/services/email/views/order/create/guest/subject_en.php @@ -0,0 +1 @@ + New Order # \ No newline at end of file diff --git a/services/email/views/order/create/logined/body_en.php b/services/email/views/order/create/logined/body_en.php new file mode 100644 index 0000000000000000000000000000000000000000..700089e04a0fcbcbb6a954b545af07b1da13e7b6 --- /dev/null +++ b/services/email/views/order/create/logined/body_en.php @@ -0,0 +1,165 @@ + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + +
+

Hello,

+

+ Thank you for your order from . + Once your package ships we will send an email with a link to track your order. + You can check the status of your order by " style="color:#1E7EC8;">logging into your account. + If you have any questions about your order please contact us at or call us at Monday - Friday, 8am - 5pm PST. +

+

Your order confirmation is below. Thank you again for your business.

+
+

Your Order # (placed on )

+
+ + + + + + + + + + + + + + + + +
Billing Information:Payment Method:
+
+
+ , ,
+
+ T: +
  +

PayPal -

+ +
+
+ + + + + + + + + + + + + + + + +
Shipping Information:Shipping Method:
+
+
+ , ,
+
+ T: + +
  + +   +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ImageNameSkuQtySubTotal
+ + <?= $product['name'] ?> + + + + + +
    + $val){ ?> + +
  • page->translate->__($label.':') ?>page->translate->__($val) ?>
  • + + +
+ +
Subtotal
Shipping & handling
Discount
Total
+

+

Thank you,

+
+
+ + + diff --git a/services/email/views/order/create/logined/subject_en.php b/services/email/views/order/create/logined/subject_en.php new file mode 100644 index 0000000000000000000000000000000000000000..e55266b5739c15dfe05f55ede3a7cf0f7b6b5ba8 --- /dev/null +++ b/services/email/views/order/create/logined/subject_en.php @@ -0,0 +1 @@ + New Order # \ No newline at end of file diff --git a/services/email/widgets/customer/account/forgotpassword/Body.php b/services/email/widgets/customer/account/forgotpassword/Body.php index dacd0ab4368329f4813ba8c5c1791b4e2ea4f101..3fc31decf335d714d28f6eab386e21bcbdb58e2b 100644 --- a/services/email/widgets/customer/account/forgotpassword/Body.php +++ b/services/email/widgets/customer/account/forgotpassword/Body.php @@ -29,9 +29,9 @@ class Body extends BodyBase 'name' => $identity['firstname'].' '. $identity['lastname'], 'email' => $identity['email'], 'resetUrl' => $resetUrl, - 'storeName' => Yii::$service->email->customer->storeName(), - 'contactsEmailAddress' => Yii::$service->email->customer->contactsEmailAddress(), - 'contactsPhone' => Yii::$service->email->customer->contactsPhone(), + 'storeName' => Yii::$service->email->storeName(), + 'contactsEmailAddress' => Yii::$service->email->contactsEmailAddress(), + 'contactsPhone' => Yii::$service->email->contactsPhone(), 'homeUrl' => Yii::$service->url->homeUrl(), 'logoImg' => Yii::$service->image->getImgUrl('mail/logo.png','appfront'), diff --git a/services/email/widgets/customer/account/login/Body.php b/services/email/widgets/customer/account/login/Body.php index 810b5181620364774dc928b51297e90db1021142..8e344556768822207612bc502f2942e72ad10e09 100644 --- a/services/email/widgets/customer/account/login/Body.php +++ b/services/email/widgets/customer/account/login/Body.php @@ -26,9 +26,9 @@ class Body extends BodyBase 'name' => $identity['firstname'].' '. $identity['lastname'], 'email' => $identity['email'], 'password' => 'xxx', - 'storeName' => Yii::$service->email->customer->storeName(), - 'contactsEmailAddress' => Yii::$service->email->customer->contactsEmailAddress(), - 'contactsPhone' => Yii::$service->email->customer->contactsPhone(), + 'storeName' => Yii::$service->email->storeName(), + 'contactsEmailAddress' => Yii::$service->email->contactsEmailAddress(), + 'contactsPhone' => Yii::$service->email->contactsPhone(), 'homeUrl' => Yii::$service->url->homeUrl(), 'logoImg' => Yii::$service->image->getImgUrl('mail/logo.png','appfront'), diff --git a/services/email/widgets/customer/account/register/Body.php b/services/email/widgets/customer/account/register/Body.php index 3385778c64a888d9bc7aac25a801383a6145dfc2..f889da04e4f9e662fefef5bf83677c2743244a3e 100644 --- a/services/email/widgets/customer/account/register/Body.php +++ b/services/email/widgets/customer/account/register/Body.php @@ -26,9 +26,9 @@ class Body extends BodyBase 'name' => $identity['firstname'].' '. $identity['lastname'], 'email' => $identity['email'], 'password' => $identity['password'], - 'storeName' => Yii::$service->email->customer->storeName(), - 'contactsEmailAddress' => Yii::$service->email->customer->contactsEmailAddress(), - 'contactsPhone' => Yii::$service->email->customer->contactsPhone(), + 'storeName' => Yii::$service->email->storeName(), + 'contactsEmailAddress' => Yii::$service->email->contactsEmailAddress(), + 'contactsPhone' => Yii::$service->email->contactsPhone(), 'homeUrl' => Yii::$service->url->homeUrl(), 'logoImg' => Yii::$service->image->getImgUrl('mail/logo.png','appfront'), diff --git a/services/email/widgets/order/create/Body.php b/services/email/widgets/order/create/Body.php new file mode 100644 index 0000000000000000000000000000000000000000..27d95f9b497f692a92f705ddffa814152cba61ef --- /dev/null +++ b/services/email/widgets/order/create/Body.php @@ -0,0 +1,45 @@ + + * @since 1.0 + */ +class Body extends BodyBase +{ + public function getLastData(){ + $order = $this->params; + //echo Yii::$service->image->getImgUrl('mail/logo.png','appfront');exit; + $countryCode = $order['customer_address_country']; + $stateCode = $order['customer_address_state']; + $countryName = Yii::$service->helper->country->getCountryNameByKey($countryCode); + $stateName = Yii::$service->helper->country->getStateByContryCode($countryCode,$stateCode); + return [ + 'name' => $order['customer_firstname'].' '. $order['customer_lastname'], + 'customer_email' => $order['customer_email'], + 'increment_id' => $order['increment_id'], + 'storeName' => Yii::$service->email->storeName(), + 'contactsEmailAddress' => Yii::$service->email->contactsEmailAddress(), + 'contactsPhone' => Yii::$service->email->contactsPhone(), + 'homeUrl' => Yii::$service->url->homeUrl(), + 'logoImg' => Yii::$service->image->getImgUrl('mail/logo.png','appfront'), + 'countryName' => $countryName, + 'stateName' => $stateName, + 'order' => $order, + ]; + } + + +} \ No newline at end of file