Ejemplo n.º 1
0
 protected function replace($model, $content)
 {
     if ($model instanceof Order) {
         $array['%ORDER_ID%'] = $model->id;
         $array['%ORDER_KEY%'] = $model->secret_key;
         $array['%TOTAL_PRICE%'] = ShopProduct::formatPrice(Yii::app()->currency->convert($model->full_price));
         $array['%USER_NAME%'] = $model->user_name;
         $array['%USER_PHONE%'] = $model->user_phone;
         $array['%USER_EMAIL%'] = $model->user_email;
         $array['%USER_ADDRESS%'] = $model->user_address;
         $array['%ORDER_URL%'] = $model->getAbsoluteUrl();
     }
     $array['%CURRENT_CURRENCY%'] = Yii::app()->currency->active->symbol;
     return CMS::textReplace($content, $array);
 }
Ejemplo n.º 2
0
 public function sendMessage()
 {
     $config = Yii::app()->settings->get('contacts');
     $mails = explode(',', $config['form_emails']);
     $tempArray = array('{sender_name}' => $this->name, '{sender_email}' => $this->email, '{sender_message}' => CHtml::encode($this->msg), '{sender_phone}' => $this->phone);
     $mailer = Yii::app()->mail;
     $mailer->From = 'noreply@' . Yii::app()->request->serverName;
     $mailer->FromName = Yii::t('ContactsModule.default', 'FB_FORM_NAME');
     $mailer->Subject = Yii::t('ContactsModule.default', 'FB_FROM_MESSAGE', array('{name}' => isset($this->name) ? Html::encode($this->name) : $this->email, '{site_name}' => Yii::app()->settings->get('core', 'site_name')));
     $mailer->Body = Html::text(CMS::textReplace($config['tempMessage'], $tempArray));
     foreach ($mails as $mail) {
         $mailer->AddAddress($mail);
     }
     $mailer->isHtml(true);
     $mailer->AddReplyTo($this->email);
     $mailer->Send();
 }
Ejemplo n.º 3
0
 public function replace_subject($array)
 {
     return CMS::textReplace($this->subject, CMap::mergeArray($this->replace_default(), $array));
 }
Ejemplo n.º 4
0
 public function replaceMeta($text)
 {
     $array = array("%PRODUCT_NAME%" => $this->name, "%PRODUCT_PRICE%" => $this->price, "%PRODUCT_ARTICLE%" => $this->sku, "%PRODUCT_PCS%" => $this->pcs, "%PRODUCT_BRAND%" => $this->manufacturer->name, "%PRODUCT_MAIN_CATEGORY%" => $this->mainCategory->name, "%CURRENT_CURRENCY%" => Yii::app()->currency->active->symbol);
     return CMS::textReplace($text, $array);
 }
Ejemplo n.º 5
0
 protected function replace($order, $list, $content)
 {
     $replace = array('%ORDER_ID%', '%ORDER_KEY%', '%ORDER_DELIVERY_NAME%', '%ORDER_PAYMENT_NAME%', '%TOTAL_PRICE%', '%USER_NAME%', '%USER_PHONE%', '%USER_EMAIL%', '%USER_ADDRESS%', '%USER_COMMENT%', '%CURRENT_CURRENCY%', '%FOR_PAYMENY%', '%LIST%', '%LINK_TO_ORDER%');
     $to = array($order->id, $order->secret_key, $order->deliveryMethod->name, $order->paymentMethod->name, $order->total_price, $order->user_name, $order->user_phone, $order->user_email, $order->user_address, isset($order->user_comment) ? $order->user_comment : '', Yii::app()->currency->active->symbol, ShopProduct::formatPrice($order->total_price + $order->delivery_price), $list, Html::link($this->createAbsoluteUrl('view', array('secret_key' => $order->secret_key)), $this->createAbsoluteUrl('view', array('secret_key' => $order->secret_key))));
     return CMS::textReplace($content, $replace, $to);
 }
Ejemplo n.º 6
0
 public function replaceMeta($text)
 {
     $replace = array("%CATEGORY_NAME%", "%SUB_CATEGORY_NAME%", "%CURRENT_CURRENCY%");
     $to = array($this->name, $this->parent()->find()->name == 'root' ? '' : $this->parent()->find()->name, Yii::app()->currency->active->symbol);
     return CMS::textReplace($text, $replace, $to);
 }
Ejemplo n.º 7
0
 public function getMessage()
 {
     $params = array();
     $params['%USER_LOGIN%'] = Yii::app()->user->login;
     return CMS::textReplace($this->message, $params);
 }