e-mail copy if user has ordered

  • Posts: 107
  • Thank you received: 0
11 years 4 months ago #86712

Hallo,

I would get the copy of the e-mail, that the user receives, if he orders.

How to?

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

  • Posts: 13201
  • Thank you received: 2322
11 years 4 months ago #86769

Hi,

You have to edit the mail "order_status_notification" and add a code to add a recipient to this mail.

The code should be something like: "$data->mail->dst_email = 'youMail'"

You need the business edition to edit the emails.

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

  • Posts: 107
  • Thank you received: 0
11 years 4 months ago #86772

How do I come to the mail "order_status_notification"?

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

  • Posts: 12953
  • Thank you received: 1778
11 years 4 months ago #86779

Xavier wrote: You need the business edition to edit the emails.


With the Business Edition, you'll be able to do that through "Hikashop->System->Configuration->Mail" by editing the order_status_notification email.

Last edit: 11 years 4 months ago by Mohamed Thelji.

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

  • Posts: 107
  • Thank you received: 0
11 years 4 months ago #86875

I have Business Edition
But I can only modify Order creation notifications email address
I cannot see code
Or am I wrong?

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

  • Posts: 12953
  • Thank you received: 1778
11 years 4 months ago #86894

If you are doing it through "Hikashop->System->Configuration->Mail", you're supposed to see the code through the "HTML version" text field.

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

  • Posts: 107
  • Thank you received: 0
11 years 3 months ago #87095

And where schould I add the code?
At the beginning von php or at the end?
There is my code:

<?php
/**
 * @package  HikaShop for Joomla!
 * @version  2.0.0
 * @author  hikashop.com
 * @copyright  (C) 2010-2012 HIKARI SOFTWARE. All rights reserved.
 * @license  GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?>
<?php$data->mail->dst_email = 'edv@cobinet.test';?>
<?php echo JText::sprintf('HI_CUSTOMER',@$data->name);?>
<br/>
<?php echo JText::sprintf('THANK_YOU_FOR_REGISTERING',HIKASHOP_LIVE);?><br/>
<?php if($data->active){
  echo JText::sprintf('ACCOUNT_MUST_BE_ACTIVATED'); ?>
  <br/><br/>
  <a href="<?php echo $data->activation_url;?>"><?php echo $data->activation_url;?></a>
<?php } ?>
<br/><br/>
<?php echo JText::sprintf('YOU_CAN_LOG_IN_WITH');?><br/>
<?php echo JText::sprintf('HIKA_USERNAME').' : '.$data->username;?><br/>
<?php echo JText::sprintf('HIKA_PASSWORD').' : '.$data->password;?><br/>
<br/>
<?php if(!empty($data->user_partner_activated)){
  echo JText::sprintf('THANK_YOU_FOR_BECOMING_OUR_PARTNER',$data->user_id,$data->partner_url);
}?>
<br/>
<?php echo JText::sprintf('BEST_REGARDS_CUSTOMER',$mail->from_name);?>
What is wrong?

Last edit: 11 years 3 months ago by Jerome. Reason: please use [code] tags for your code.

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

  • Posts: 26034
  • Thank you received: 4006
  • MODERATOR
11 years 3 months ago #87234

Hi,

First, you are editing (pasting the code of) the wrong email.
It's the user creation email that you're currently talking about but it need to edit a status notification email, like Xavier and Mohamed told you..

After that, you have to ADD some php code in the email. The position is not very important but you can put it at the end, it could be simpler to not broke some existing HTML or PHP code in the email.

<?php
$config =& hikashop_config();
$data->dst_email .= ',' . $config->get('payment_notification_email');
?>

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: 107
  • Thank you received: 0
11 years 3 months ago #87390

It does'nt work
What is wrong?

/* mail content truncated */
  </table>
</div>
<?php $data->customer = $customer;?>
<?php $data->mail->dst_email = 'edv@cobinet.test';?>
<?php
$config =& hikashop_config();
$data->dst_email .= ',' . $config->get('payment_notification_email');
?>

Last edit: 11 years 3 months ago by Jerome.

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

  • Posts: 107
  • Thank you received: 0
11 years 3 months ago #87391

I need one copy of mail, if user has registered, too
What code do I need in that case?

Thanks

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

  • Posts: 26034
  • Thank you received: 4006
  • MODERATOR
11 years 3 months ago #87406

Hi,

Well, I made a mistake when I rewrite the code line, I forget the "->mail".

  </table>
</div>
<?php
$data->customer = $customer;
$config =& hikashop_config();
$data->mail->dst_email .= ',' . $config->get('payment_notification_email');
?>
But, you have to remove the line just before because it overwrite the destination email address so your customer wouldn't receive the message at all.

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: 107
  • Thank you received: 0
11 years 3 months ago #87416

I don't understand

I want, that the customer recieves the mail, and that my mail address "This email address is being protected from spambots. You need JavaScript enabled to view it." recieves the copy of this mail.
Can I do it with Your code?

And I need the same thing, if the customer has registered. The customer recieves the register mail and "This email address is being protected from spambots. You need JavaScript enabled to view it." recieves the copy of this mail too.

How to?

Thanks

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

  • Posts: 26034
  • Thank you received: 4006
  • MODERATOR
11 years 3 months ago #87495

Hi,

So you can use the code:

  </table>
</div>
<?php
$data->customer = $customer;
$data->mail->dst_email .= ',' . 'edv@cobinet.test';
?>
My previous code use the email specified in the HikaShop configuration for notification. It is a more flexible way because you would be able to change the email in every emails in the same time.

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: 107
  • Thank you received: 0
11 years 3 months ago #87584

It does'nt work

</table>
</div>
<?php $data->customer = $customer;?>
<?php $data->mail->dst_email .= ',' . 'This email address is being protected from spambots. You need JavaScript enabled to view it.';?>

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

  • Posts: 107
  • Thank you received: 0
11 years 3 months ago #87626

Have anybody any idea?

Regards

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

  • Posts: 26034
  • Thank you received: 4006
  • MODERATOR
11 years 3 months ago #87667

Hi,

Well, the other solution it to push your email in the customer emails:

<?php
$data->customer->user_email .= ',edv@cobinet.test';
?>

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: 107
  • Thank you received: 0
11 years 3 months ago #87744

It does'nt work too.
Another Idea?

Regards

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

  • Posts: 81716
  • Thank you received: 13106
  • MODERATOR
11 years 3 months ago #87812

That code must work. Please make sure that you put it at the end of the HTML version of the order status notification email.

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

  • Posts: 107
  • Thank you received: 0
11 years 3 months ago #87818

I have put it so, as you said.
It does'nt work by me.

There is the code:

<?php
/**
 * @package  HikaShop for Joomla!
 * @version  2.0.0
 * @author  hikashop.com
 * @copyright  (C) 2010-2012 HIKARI SOFTWARE. All rights reserved.
 * @license  GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
 */
defined('_JEXEC') or die('Restricted access');
?><div style="background-color: #ffffff; font-size: 100%; font-family: Tahoma,Geneva,Kalimati,sans-serif; color: #8a8a8a; width: 100%;">
  <table style="margin: auto; width: 560px;" border="0" cellspacing="0" cellpadding="0">
    <tbody>
      <tr>
        <td height="10">
        </td>
      </tr>
      <tr>
        <td height="30" style="margin: auto; font-size: 10px; background-color: #ffffff; color: #000000; text-align: center" colspan="3">
          <?php echo JText::sprintf('DATE_ON_WEBSITE',hikashop_getDate(time(),'%Y-%m-%d %H:%M'),HIKASHOP_LIVE);?>
        </td>
      </tr>
      <tr>
        <td height="10" style="background-color: #ffffff;">
        </td>
      </tr>
      <tr>
        <td style="background-color: #ffffff;">
          <?php
          $order_url = $data->order_url;

          $mail_status = $data->mail_status;
          $customer = $data->customer;
          $order_status = $data->order_status;
          $class = hikashop_get('class.order');
          $data = $class->get($data->order_id);
          $url = $data->order_number;
          $data->order_url = $order_url;
          $data->order_status = $order_status;
          $data->mail_status = $mail_status;
          $config =& hikashop_config();
          if($config->get('simplified_registration',0)!=2){
            $url = '<a href="'.$order_url.'">'. $url.'</a>';
          }

          $data->cart = $class->loadFullOrder($data->order_id,true,false);
          $data->cart->coupon = new stdClass();
          $price = new stdClass();
          $tax = $data->cart->order_subtotal - $data->cart->order_subtotal_no_vat + $data->order_discount_tax + $data->order_shipping_tax;
          $price->price_value = $data->order_full_price-$tax;
          $price->price_value_with_tax = $data->order_full_price;
          $data->cart->full_total = new stdClass;
          $data->cart->full_total->prices = array($price);
          $data->cart->coupon->discount_value =& $data->order_discount_price;
          $app=JFactory::getApplication();
          if($app->isAdmin()){
            $view = 'order';
          }else{
            $view = 'address';
          }
          $colspan = 4;

          echo JText::sprintf('HI_CUSTOMER',@$customer->name);?>
          <br/>
          <br/>
          <?php
          echo JText::sprintf('ORDER_STATUS_CHANGED_TO',$url,$data->mail_status);
          ?>
          </td>
      </tr>
      <tr>
        <td height="10">
        </td>
      </tr>
      <tr>
        <td>
          <h1 style="background-color:#DDDDDD;font-size:14px;width:100%;padding:5px;"><?php echo JText::_('SUMMARY_OF_YOUR_ORDER');?></h1>
          <br/>
          <table width="100%" style="font-family: Verdana, Arial, Helvetica, sans-serif;font-size:12px;">
            <tr>
              <td style="font-weight:bold;">
                <?php echo JText::_('CART_PRODUCT_NAME'); ?>
              </td>
              <?php if ($config->get('show_code')) { $colspan++; ?>
                <td style="font-weight:bold;"><?php echo JText::_('CART_PRODUCT_CODE'); ?></td>
              <?php } ?>
              <td style="font-weight:bold;">
                <?php echo JText::_('CART_PRODUCT_UNIT_PRICE'); ?>
              </td>
              <td style="font-weight:bold;">
                <?php echo JText::_('CART_PRODUCT_QUANTITY'); ?>
              </td>
              <td style="font-weight:bold;text-align:right;">
                <?php echo JText::_('HIKASHOP_TOTAL'); ?>
              </td>
            </tr>
            <?php
              if(hikashop_level(2)){
                $fieldsClass = hikashop_get('class.field');
                $null = null;
                $itemFields = $fieldsClass->getFields('frontcomp',$null,'item');
              }
              $group = $config->get('group_options',0);
              foreach($data->cart->products as $item){
                if($group && $item->order_product_option_parent_id) continue;
                ?>
                <tr>
                  <td>
                    <p>
                      <?php echo $item->order_product_name;
                      if($group){
                        $display_item_price=false;
                        foreach($data->cart->products as $j => $optionElement){
                          if($optionElement->order_product_option_parent_id != $item->order_product_id) continue;
                          if($optionElement->order_product_price>0){
                            $display_item_price = true;
                          }

                        }
                        if($display_item_price){
                          if($config->get('price_with_tax')){
                            echo ' '.$currencyHelper->format($item->order_product_price+$item->order_product_tax,$data->order_currency_id);
                          }else{
                            echo ' '.$currencyHelper->format($item->order_product_price,$data->order_currency_id);
                          }
                        }
                      } ?>
                    </p><?php
                    if(!empty($itemFields)){
                      foreach($itemFields as $field){
                        $namekey = $field->field_namekey;
                        if(empty($item->$namekey)) continue;
                        echo '<p>'.$fieldsClass->getFieldName($field).': '.$fieldsClass->show($field,$item->$namekey).'</p>';
                      }
                    }
                    if($group){
                      foreach($data->cart->products as $j => $optionElement){
                        if($optionElement->order_product_option_parent_id != $item->order_product_id) continue;

                        $item->order_product_price +=$optionElement->order_product_price;
                        $item->order_product_tax +=$optionElement->order_product_tax;
                        $item->order_product_total_price+=$optionElement->order_product_total_price;
                        $item->order_product_total_price_no_vat+=$optionElement->order_product_total_price_no_vat;

                         ?>
                          <p class="hikashop_order_option_name">
                            <?php
                              echo $optionElement->order_product_name;
                              if($optionElement->order_product_price>0){
                                if($config->get('price_with_tax')){
                                  echo ' ( + '.$currencyHelper->format($optionElement->order_product_price+$optionElement->order_product_tax,$data->order_currency_id).' )';
                                }else{
                                  echo ' ( + '.$currencyHelper->format($optionElement->order_product_price,$data->order_currency_id).' )';
                                }
                              }
                            ?>
                          </p>
                      <?php
                      }
                    }
                    $statusDownload = explode(',',$config->get('order_status_for_download','confirmed,shipped'));
                    if(!empty($item->files) && in_array($data->order_status,$statusDownload)){
                      global $Itemid;
                      $url_itemid = '';
                      if(!empty($Itemid)){
                        $url_itemid='&Itemid='.$Itemid;
                      }
                      echo '<p>';
                      foreach($item->files as $file){
                        $fileName = empty($file->file_name) ? $file->file_path : $file->file_name;

                        echo '<a href="'.hikashop_frontendLink('index.php?option=com_hikashop&ctrl=order&task=download&file_id='.$file->file_id.'&order_id='.$data->order_id.$url_itemid).'">'.$fileName.'</a><br/>';
                      }
                      echo '</p>';
                    }
                    ?>
                  </td>
                  <?php if ($config->get('show_code')) { ?>
                    <td><p class="hikashop_product_code_mail"><?php echo $item->order_product_code; ?></p></td>
                  <?php } ?>
                  <td>
                    <?php
                    if($config->get('price_with_tax')){
                      echo $currencyHelper->format($item->order_product_price+$item->order_product_tax,$data->order_currency_id);
                    }else{
                      echo $currencyHelper->format($item->order_product_price,$data->order_currency_id);
                    } ?>
                  </td>
                  <td>
                    <?php echo $item->order_product_quantity; ?>
                  </td>
                  <td style="text-align:right">
                    <?php
                    if($config->get('price_with_tax')){
                      echo $currencyHelper->format($item->order_product_total_price,$data->order_currency_id);
                    }else{
                      echo $currencyHelper->format($item->order_product_total_price_no_vat,$data->order_currency_id);
                    } ?>
                  </td>
                </tr>
                <?php
              }
              if(bccomp($data->order_discount_price,0,5)){
                echo '<tr><td colspan="'.$colspan.'" style="text-align:right">'.JText::_('HIKASHOP_COUPON').' : ';
                if($config->get('price_with_tax')){
                  echo $currencyHelper->format($data->order_discount_price*-1,$data->order_currency_id);
                }else{
                  echo $currencyHelper->format(($data->order_discount_price-@$data->order_discount_tax)*-1,$data->order_currency_id);
                }
                echo '</td></tr>';
              }
              if(bccomp($data->order_shipping_price,0,5)){
                echo '<tr><td colspan="'.$colspan.'" style="text-align:right">'.JText::_('HIKASHOP_SHIPPING_METHOD').' : ';
                if($config->get('price_with_tax')){
                  echo $currencyHelper->format($data->order_shipping_price,$data->order_currency_id);
                }else{
                  echo $currencyHelper->format($data->order_shipping_price-@$data->order_shipping_tax,$data->order_currency_id);
                }
                echo '</td></tr>';
              }
              if(bccomp($data->order_payment_price,0,5)){
                echo '<tr><td colspan="'.$colspan.'" style="text-align:right">'.JText::_('HIKASHOP_PAYMENT_METHOD').' : '.$currencyHelper->format($data->order_payment_price,$data->order_currency_id).'</td></tr>';
              }
              if(!empty($data->cart->additional)) {
                $exclude_additionnal = explode(',', $config->get('order_additional_hide', ''));
                foreach($data->cart->additional as $additional) {
                  if(in_array($additional->name, $exclude_additionnal)) continue;
                  echo '<tr><td colspan="'.$colspan.'" style="text-align:right">'. JText::_($additional->order_product_name).' : ';
                  if(!empty($additional->order_product_price) || empty($additionaltionnal->order_product_options)) {
                    if($config->get('price_with_tax')){
                      echo $currencyHelper->format($additional->order_product_price+@$additional->order_product_tax, $data->order_currency_id);
                    }else{
                      echo $currencyHelper->format($additional->order_product_price, $data->order_currency_id);
                    }
                  } else {
                    echo $additional->order_product_options;
                  }
                  echo '</td></tr>';
                }
              }
              if($data->cart->full_total->prices[0]->price_value!=$data->cart->full_total->prices[0]->price_value_with_tax){
                if($config->get('detailed_tax_display') && !empty($data->cart->order_tax_info)){
                  foreach($data->cart->order_tax_info as $tax){
                    echo '<tr><td colspan="'.$colspan.'" style="text-align:right">'.$tax->tax_namekey. ' : '.$currencyHelper->format($tax->tax_amount,$data->order_currency_id).'</td></tr>';
                  }
                }else{
                  echo '<tr><td colspan="'.$colspan.'" style="text-align:right">'.JText::sprintf('TOTAL_WITHOUT_VAT',$currencyHelper->format($data->cart->full_total->prices[0]->price_value,$data->order_currency_id)).'</td></tr>';
                }
                $text=JText::sprintf('TOTAL_WITH_VAT',$currencyHelper->format($data->cart->full_total->prices[0]->price_value_with_tax,$data->order_currency_id));
              }else{
                $text=JText::_('HIKASHOP_FINAL_TOTAL'). ' : '.$currencyHelper->format($data->cart->full_total->prices[0]->price_value_with_tax,$data->order_currency_id);
              }
              echo '<tr><td colspan="'.$colspan.'" style="text-align:right;font-weight:bold;">'.$text.'</td></tr>';
              ?>
          </table>
        </td>
      </tr>
      <tr>
        <td height="10">
        </td>
      </tr>
      <tr>
        <td>
          <table width="100%" style="border: 1px solid #DDDDDD;font-family: Verdana, Arial, Helvetica, sans-serif;font-size:12px;">
          <?php
          $params = null;
          $js = '';
          $fieldsClass = hikashop_get('class.field');
          $template = trim(hikashop_getLayout($view,'address_template',$params,$js));
          if(!empty($data->cart->billing_address)){
            $billing = $template;
            foreach($data->cart->fields as $field){
              $fieldname = $field->field_namekey;
              $billing=str_replace('{'.$fieldname.'}',$fieldsClass->show($field,$data->cart->billing_address->$fieldname),$billing);
            }
            echo '<tr><td style="font-weight:bold;background-color:#DDDDDD">'.JText::_('HIKASHOP_BILLING_ADDRESS').'</td></tr><tr><td>';
            echo str_replace(array("\r\n","\r","\n"),'<br/>',preg_replace('#{(?:(?!}).)*}#i','',$billing)).'<br/></td></tr>';
          }
          if(!empty($data->cart->override_shipping_address)) {
            echo '<tr><td style="font-weight:bold;background-color:#DDDDDD">'.JText::_('HIKASHOP_SHIPPING_ADDRESS').'</td></tr><tr><td>';
            echo $data->cart->override_shipping_address.'<br/></td></tr>';
          } elseif(!empty($data->order_shipping_id) && !empty($data->cart->shipping_address)){
            $shipping = $template;
            foreach($data->cart->fields as $field){
              $fieldname = $field->field_namekey;
              $shipping=str_replace('{'.$fieldname.'}',$fieldsClass->show($field,$data->cart->shipping_address->$fieldname),$shipping);
            }
            echo '<tr><td style="font-weight:bold;background-color:#DDDDDD">'.JText::_('HIKASHOP_SHIPPING_ADDRESS').'</td></tr><tr><td>';
            echo str_replace(array("\r\n","\r","\n"),'<br/>',preg_replace('#{(?:(?!}).)*}#i','',$shipping)).'<br/></td></tr>';
          }?>
          </table>
        </td>
      </tr>
      <tr>
        <td>
          <?php
          $fields = $fieldsClass->getFields('frontcomp',$data,'order','');
          foreach($fields as $fieldName => $oneExtraField) {
            if(empty($data->$fieldName)) continue;
            echo "<br/>".$fieldsClass->trans($oneExtraField->field_realname).' : '.$fieldsClass->show($oneExtraField,$data->$fieldName);
          } ?>
        </td>
      </tr>
<?php
  JPluginHelper::importPlugin('hikashop');
  $dispatcher = JDispatcher::getInstance();
  $dispatcher->trigger('onAfterOrderProductsListingDisplay', array(&$data->cart, 'email_notification_html'));
?>
      <tr>
        <td height="10">
        </td>
      </tr>
      <tr>
        <td>
          <?php echo JText::sprintf('THANK_YOU_FOR_YOUR_ORDER',HIKASHOP_LIVE);?>
          <br/>
          <br/>
          <?php echo JText::sprintf('BEST_REGARDS_CUSTOMER',$mail->from_name);?>
        </td>
      </tr>
      <tr>
        <td height="10" style="background-color: #ffffff;">
        </td>
      </tr>
      <tr>
        <td height="10">
        </td>
      </tr>
    </tbody>
  </table>
</div>
<?php $data->customer = $customer;?>
<?php $data->customer->user_email .= ',edv@cobinet.test'; ?>

Regards

Last edit: 11 years 3 months ago by Jerome.

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

  • Posts: 16
  • Thank you received: 0
11 years 3 months ago #87981

#cobinet_edv

See my post here:

www.hikashop.com/en/forum/4-how-to/77904...hop-admin.html#87893

We need some answer.. :)
Lee

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

Time to create page: 0.133 seconds
Powered by Kunena Forum