Order Email to an address with some extra field

  • Posts: 12
  • Thank you received: 0
9 years 6 months ago #200919

-- HikaShop version -- : 2.3.2
-- Joomla version -- : 3.4

Hello,
My client wants the order confirmation email goes to a different address along with admin email with some extra field. Actually it is "FTD Mercury Point of Sale" . I can add email addresses in order notification email but how can I add those extra filed only for that email address ?

Thank you for your help.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
9 years 6 months ago #200945

Hi,

That won't be possible. When you add the email address in the BCC or CC field of the emails, the system will tell your email server to send one copy of the generated email to all the email addresses. But it will be the same copy for all of them.
So having stuff displayed for only some of the recipients is not possible with the same email.
This means that you'll have to send two different emails and thus it would require a custom plugin to be developed to send that second email with the extra data. That won't be easy to do and will require the help of a professional PHP developer.

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

  • Posts: 12
  • Thank you received: 0
9 years 5 months ago #203981

Hello Nicolas,

Thank you for your suggestion.

I have planed to edit the order admin email notification file. I need its text version only. So, I am editing order_admin_notification.text.php

I need the email in the following format and I am trying to do it like this:

echo"Email :".$data->customer->user_email[0]."\n";
echo "Bill Name :".$data->customer."\n";
echo "Bill Address1 :".$data->cart->billing_address."\n";
echo "Bill Address2 :".$data->customer->user_email[0]."\n";
echo "Bill City :".$data->cart->billing_address->adress_city."\n";
echo "Bill State :".$data->cart->billing_address->adress_state."\n";
echo "Bill Country :".$data->cart->billing_address->adress_country."\n";
echo "Bill Zip Code :".$data->cart->billing_address->adress_post_code."\n";
echo "Bill Phone Area Code :".$data->cart->billing_address->adress_city."\n";
echo "Bill Phone Prefix :".$data->cart->billing_address->adress_telephone."\n";
echo "Bill Phone Number :".$data->cart->billing_address->adress_telephone."\n";

I know very little about PHP and didnt find any professional one for this. however, I see the error "Catchable fatal error: Object of class stdClass could not be converted to string" from 2nd line in ' $data->customer', ' $data->cart->billing_address' etc.

What mistake I am making here and what is the solution please.

Thank you very much.
Mohsin

Attachments:
Last edit: 9 years 5 months ago by mohsin.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
9 years 5 months ago #203996

Hi,

The error is what the error message says.
The variables $data->customer and $data->cart->billing_address are objects and you try to echo them.
You can't do that.
What you want to do is actually to echo an attribute of these variable.
So instead of $data->customer, you'll want to have $data->customer->name
And instead of $data->cart->billing_address, you'll want: $data->cart->billing_address->address_street

The following user(s) said Thank You: mohsin

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

  • Posts: 12
  • Thank you received: 0
9 years 5 months ago #204047

Hi Nicolas,

Thank you so much for the help. Its worked. This Hikashop's support is amazing.

I still need help on few fields:
1. echo "Bill Name: " .$data->customer->name."\n"; This is not working. No value in email.
2. echo "Tax Amount: " .$data->cart->order_product_tax."\n"; This is not working,
3. echo "Product: " .$data->cart->order_product_name. "\n"; This is not working. I need product with varient as its listed html version.

Another issue, echo "Total Order Amount: " .$data->cart->order_full_price."\n"; its printing price like 49.0000 , how can I make it like 49.00

Kind Regards

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
9 years 5 months ago #204048

Hi,

1. if you want the email, you should use

$data->customer->email

2. Like that:
$data->cart->products[0]->order_product_tax

3. Like that:
$data->cart->products[0]->order_product_name

4. Like that:
round($data->cart->order_full_price,2)

The following user(s) said Thank You: mohsin

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

  • Posts: 12
  • Thank you received: 0
9 years 5 months ago #204136

Hi Nicolas,

Good day. Those works but two fileds still have issue:

1. Customer Name: $data->customer->name , not working. I want to print Customer name

2. Product Name: $data->cart->products[0]->order_product_name , It prints only main product name. But I want to print the product with additional products. which I see in the customer copy email.
Name Unit price Qty Total
Bromeliad $34.99 1 $34.99
Alstromeria Topiary $34.99 1 $34.99
Mylar Balloon : 2 $9.89 1 $9.89

Thank you.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
9 years 5 months ago #204178

Hi,

1. I don't see why it wouldn't work unless the customer is a guest. In that case that variable doesn't exist as it comes from the Joomla user account's name which isn't there for guests.
In that case, you need instead to look in the billing address for the firstname and lastname of the customer.

2. Then you need to do like this:
foreach( $data->cart->products as $product){ echo $product->order_product_name; }

Please note that this forum is about user support. Not customization of HikaShop. I believe we already helped a lot with the customization of your email. For further customization please contact our partners:
www.hikashop.com/home/our-partners.html

The following user(s) said Thank You: mohsin

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

  • Posts: 12
  • Thank you received: 0
9 years 5 months ago #204265

Hi Nicolas,

Thank you Very much for such help.

I was able to solve those all.

Yes I know this forum is not about customization. But I really appriciate your help which was a great reliefe for me to get a website up and running with Hikashop.

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

Time to create page: 0.074 seconds
Powered by Kunena Forum