Add customers email to invoice sent to administrat

  • Posts: 102
  • Thank you received: 2
11 years 4 months ago #108265

Hi. I want to add the email of the customer to the confirmation email sent to admin. I don't see it in there.

Thanks.

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

  • Posts: 82759
  • Thank you received: 13346
  • MODERATOR
11 years 4 months ago #108300
The following user(s) said Thank You: miracleecho

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

  • Posts: 102
  • Thank you received: 2
11 years 4 months ago #108339

Thanks I read the post and thought i had it but then i must have put the code in the wrong place because the order creation page hosed on me after purchase. I am not a programmer so you may need to be a bit more specific. Based on what I read i attempted to put this code: for the email, it's: echo $data->customer->user_email; in the txt version of the "ORDER_CREATION_NOTIFICATION_SUBJECT": First, is this the right place and second where do I put it? I removed what I put in but now we are not getting order confirmations.

<?php
/**
* @package HikaShop for Joomla!
* @version 2.1.3
* @author hikashop.com
* @copyright (C) 2010-2013 HIKARI SOFTWARE. All rights reserved.
* @license GNU/GPLv3 www.gnu.org/licenses/gpl-3.0.html
*/
defined('_JEXEC') or die('Restricted access');
?><?php echo JText::sprintf('HI_CUSTOMER',@$data->customer->name);?>


<?php
$url = $data->order_number;
$config =& hikashop_config();
if($config->get('simplified_registration',0)!=2){
$url .= ' ( '.$data->order_url.' )';
}
echo JText::sprintf('ORDER_CREATION_SUCCESS_ON_WEBSITE_AT_DATE',$url,HIKASHOP_LIVE, hikashop_getDate(time(),'%d %B %Y'), hikashop_getDate(time(),'%H:%M'));?>


<?php echo JText::_('SUMMARY_OF_YOUR_ORDER');?>

<?php echo JText::_('CART_PRODUCT_NAME')."\t".JText::_('CART_PRODUCT_UNIT_PRICE')."\t".JText::_('CART_PRODUCT_QUANTITY')."\t".JText::_('HIKASHOP_TOTAL');?>

<?php
foreach($data->cart->products as $item){
$price = $item->order_product_price*$item->order_product_quantity;
echo strip_tags($item->order_product_name) . "\t" . $currencyHelper->format($item->order_product_price,$data->order_currency_id)."\t".$item->order_product_quantity."\t".$currencyHelper->format($price,$data->order_currency_id)."\n";
}

if(bccomp($data->order_discount_price,0,5)){
echo JText::_('HIKASHOP_COUPON').' : '.$currencyHelper->format($data->order_discount_price*-1,$data->order_currency_id)."\n";
}
if(bccomp($data->order_shipping_price,0,5)){
echo JText::_('HIKASHOP_SHIPPING_METHOD').' : '.$currencyHelper->format($data->order_shipping_price,$data->order_currency_id)."\n";
}
if(!empty($data->additional)) {
$exclude_additionnal = explode(',', $config->get('order_additional_hide', ''));
foreach($data->additional as $additional) {
if(in_array($additional->name, $exclude_additionnal)) continue;
echo JText::_($additional->order_product_name).' : ';
if(!empty($additional->order_product_price) || empty($additional->order_product_options)) {
echo $currencyHelper->format($additional->order_product_price, $this->order->order_currency_id);
} else {
echo $additional->order_product_options;
}
echo "\n";
}
}
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->order_tax_info)){
foreach($data->order_tax_info as $tax){
echo $tax->tax_namekey. ' : '.$currencyHelper->format($tax->tax_amount,$data->order_currency_id)."\n";
}
}else{
echo JText::sprintf('TOTAL_WITHOUT_VAT',$currencyHelper->format($data->cart->full_total->prices[0]->price_value,$data->order_currency_id))."\n";
}
echo JText::sprintf('TOTAL_WITH_VAT',$currencyHelper->format($data->cart->full_total->prices[0]->price_value_with_tax,$data->order_currency_id))."\n\n";
}else{
echo JText::_('HIKASHOP_FINAL_TOTAL'). ' : '.$currencyHelper->format($data->cart->full_total->prices[0]->price_value_with_tax,$data->order_currency_id)."\n";
}


$params = null;
$js = '';
$fieldsClass = hikashop_get('class.field');
$app =& JFactory::getApplication();
if($app->isAdmin()){
$view = 'order';
}else{
$view = 'address';
}
$template = trim(hikashop_getLayout($view,'address_template',$params,$js));
if(!empty($data->cart->billing_address)){
$billing = $template;
foreach($data->order_addresses_fields as $field){
$fieldname = $field->field_namekey;
$address =& $data->order_addresses[$data->cart->billing_address->address_id];
$billing=str_replace('{'.$fieldname.'}',$fieldsClass->show($field,$address->$fieldname),$billing);
}
echo JText::_('HIKASHOP_BILLING_ADDRESS')."\n";
echo preg_replace('#{(?:(?!}).)*}#i','',$billing)."\n\n";
}
if(!empty($data->order_shipping_method)) {
$currentShipping = hikashop_import('hikashopshipping',$data->order_shipping_method);
if(method_exists($currentShipping, 'getShippingAddress')) {
$override = $currentShipping->getShippingAddress($data->order_shipping_id);
if($override !== false) {
$data->override_shipping_address = $override;
}
}
}
if(!empty($data->cart->has_shipping) && (!empty($data->cart->shipping_address) || !empty($data->override_shipping_address))) {
if( !empty($data->override_shipping_address) ) {
echo str_replace('<br/>',"\r\n",$data->override_shipping_address);
} else {
$shipping = $template;
foreach($data->order_addresses_fields as $field){
$fieldname = $field->field_namekey;
$address =& $data->order_addresses[$data->cart->shipping_address->address_id];
$shipping=str_replace('{'.$fieldname.'}',$fieldsClass->show($field,$address->$fieldname),$shipping);
}
echo JText::_('HIKASHOP_SHIPPING_ADDRESS')."\n";
echo preg_replace('#{(?:(?!}).)*}#i','',$shipping)."\n\n";
}
}

$fields = $fieldsClass->getFields('frontcomp',$data,'order','');
foreach($fields as $fieldName => $oneExtraField) {
$fieldData = trim(@$data->$fieldName);
if(empty($fieldData)) continue;
echo $fieldsClass->trans($oneExtraField->field_realname).' : '.$fieldsClass->show($oneExtraField,$data->$fieldName)."\r\n";
}

if(!$app->isAdmin()){
if($data->cart->full_total->prices[0]->price_value_with_tax>0) echo JText::_('ORDER_VALID_AFTER_PAYMENT')."\n\n";
echo JText::sprintf('THANK_YOU_FOR_YOUR_ORDER',HIKASHOP_LIVE)."\n\n";
}
echo str_replace('<br/>',"\n",JText::sprintf('BEST_REGARDS_CUSTOMER',$mail->from_name));?>

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

  • Posts: 82759
  • Thank you received: 13346
  • MODERATOR
11 years 4 months ago #108352

You're not editing the correct email... That is the order creation notification, not the order admin notification.
And it should be the HTML edition that you should edit.

Lastly, you can put the code where you need it. Remember that you need <?php and ?> tags around your PHP code.

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

  • Posts: 102
  • Thank you received: 2
11 years 4 months ago #108358

Thanks and it messed things up as I am getting this now when orders are placed:
Parse error: syntax error, unexpected T_NS_SEPARATOR, expecting T_STRING in /home/content/93/11223693/html/media/com_hikashop/mail/order_creation_notification.text.modified.php on line 9

I had a backup and i attempted to copy and paste html and text code but it still errors out. In the HTML code it's placing \ everywhere and I cannot get it to save properly. Can i edit the file directly from the server?

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

  • Posts: 82759
  • Thank you received: 13346
  • MODERATOR
11 years 4 months ago #108359

That's because you're on Joomla 3.x and that your magic quotes server setting is not correct. Please change it and files edition will work properly.
In the mean time, yes, you can edit the files directly.

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

  • Posts: 102
  • Thank you received: 2
11 years 4 months ago #108569

I've turned off magic quotes! Now I add this <?echo $data->customer->user_email;?> to the ORDER_ADMIN_NOTIFICATION_SUBJECT anywhere I want and this will supply the customers email to the admin confirmation email?

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

  • Posts: 82759
  • Thank you received: 13346
  • MODERATOR
11 years 4 months ago #108571

No it should be:
<?php echo $data->customer->user_email; ?>

The following user(s) said Thank You: miracleecho

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

  • Posts: 102
  • Thank you received: 2
11 years 4 months ago #108589

I am getting closer but it is still not working properly. I have tried to put this code: <?php echo $data->customer->user_email; ?> as per your instructions in the admin order notification and depending on where I put it I get this:

Below is displayed on the order
customer->user_email; ?>
or
Array

This is how I am placing it in exactly(at the end of the html version):

<tr>
<td height="10">
<?php echo $data->customer->user_email; ?>

</td>

Last edit: 11 years 4 months ago by miracleecho.

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

  • Posts: 82759
  • Thank you received: 13346
  • MODERATOR
11 years 4 months ago #108734

Ok.

Try with that code instead then:

<?php $userClass = hikashop_get('class.user');
$userClass->get(false);
$user = $userClass->get($data->order_user_id);
echo $user->user_email; ?>

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

  • Posts: 102
  • Thank you received: 2
11 years 4 months ago #108756

Thanks - That worked!

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

Time to create page: 0.069 seconds
Powered by Kunena Forum