Create and associate email with order status

  • Posts: 272
  • Thank you received: 3
  • Hikashop Business
13 years 6 months ago #15446

Hi Nicolas,

Business 1.4.9 - joomla 1.5

1) is there any way to create a new email?
2) is there any way to manually associate which email gets sent according the order status??

Thanks

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

  • Posts: 82867
  • Thank you received: 13374
  • MODERATOR
13 years 6 months ago #15454

Hi,

It's possible yes. There are two ways:

1. The easy way: Go in System->Emails and edit your order status notification email. There you can add an if statement in order to display different things in the email based on the status, like that:
if($data->order_status=="confirmed"){
echo 'Your order is confirmed';
}elseif($data->order_status=="cancelled"){
echo 'Your order is cancelled';
}

2. The hard way: You need to copy the files of the email in the folder media/com_hikashop/mail and also the corresponding configuration entries in the table hikashop_config. Then, build a hikashop plugin implementing the onAfterOrderUpdate method and set the $email variable to false in there so that the normal email is not sent by hikashop and then add your own code to load your email and send it, like it's done in the save function of the order class in the file administrator/components/com_hikashop/classes/order.php

I would recommend to go with option 1...

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

  • Posts: 272
  • Thank you received: 3
  • Hikashop Business
13 years 6 months ago #15486

Hi Nicolas,

thanks for your reply. I had already built a hikashop plugin to meet my requirements. (I cloned the collect on delivery). I want to add extra status 'quote' before 'created'. The idea is that users can send in a quote request, the prices are review and the order status changed to created in the backend.

Couple of points. 1) There isn't any onAfterOrderUpdate. In fact none of the payment plugins have this function. (Only the history plugin). 1) I can't find the $email variable. Did you mean $order?

Thanks, James

Last edit: 13 years 6 months ago by jameswadsworth.

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

  • Posts: 82867
  • Thank you received: 13374
  • MODERATOR
13 years 6 months ago #15488

I meant $send_email.

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

  • Posts: 272
  • Thank you received: 3
  • Hikashop Business
13 years 6 months ago #15517

Hi Nicolas, thanks for your reply. However I must be overlooking something. At the moment I am trying to implement solution 1. I have created a new payment plugin : requestaquote.php. In this plugin in the onPaymentConfiguration function I have set $element->payment_params->order_status = 'quote'. Also in plugin management in the backend I have set the Order status to 'quote'. However it is not working as I wish. I think may be we have not understood each other. I want to change the order_creation_notification email, so that when an order is created and the user has chosen the requestaquote payment option, we send a quote has been requested message rather than order has been created message. Is this possibile?

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

  • Posts: 82867
  • Thank you received: 13374
  • MODERATOR
13 years 6 months ago #15519

You don't need to fiddle with the status.
If you have a payment plugin which is called requestaquote, you can just have such check in the order creation email:
if($data->order_payment_method=="requestaquote"){
echo 'mail content for a quote';
}else{
echo 'other mail content';
}

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

  • Posts: 272
  • Thank you received: 3
  • Hikashop Business
13 years 6 months ago #15520

Okay found a way of doing it. In the plugin we added function onAfterOrderCreate and we set the order status to quote. Now we follow solution 1, but this time changing the order creation email.

If the administrator changes the order status from 'quote' to 'created' will an email be sent automatically to the client?

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

  • Posts: 82867
  • Thank you received: 13374
  • MODERATOR
13 years 6 months ago #15532

No. An email is only sent if you set the option "notify user" to yes in the popup when changing the status. If you set it to yes, then, it's the order status notification email which is sent, not the order creation notification.

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

  • Posts: 272
  • Thank you received: 3
  • Hikashop Business
13 years 6 months ago #16552

Hello Nicolas,

I just have a couple of questions that may be you can help with me.

1) we don't have an image for the requestaquote payment plugin we have created. Current we have set

$element->payment_images = '';

However in IE there is always the horrible missing image icon. How can solve this little problem?

2) when the client requests a quote in the order history we first have order status 'created' then 'quotation'. Which is fine. We have changed the order_creation_notification email so that when the status is 'quotation' the text is different to created. Now when an administrator goes to the order with status 'quotation' and modifies the prices, adds the transport costs and other variations, how can we resend order_creation_notification email with all the modifications?

Thanks

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

  • Posts: 66
  • Thank you received: 3
13 years 6 months ago #16554

Concerning 1) would a transparant image help?

In the zip file there are a png and gif versions

File Attachment:

File Name: transparant.zip
File Size:4 KB

Attachments:

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

  • Posts: 82867
  • Thank you received: 13374
  • MODERATOR
13 years 6 months ago #16566

1. Indeed, that's a problem. No image tag should be displayed. We'll change that for the next release. In the mean time, you can change the code:
?>
<img src="<?php echo HIKASHOP_IMAGES .'payment/'. @$this->images_payment[$image];?>"/>
<?php

to:
if(!empty($image)){
?>
<img src="<?php echo HIKASHOP_IMAGES .'payment/'. @$this->images_payment[$image];?>"/>
<?php
}

in the file payment of the view checkout via the menu Display->Views.


2. You can't resend the order_created_notification. However, whenever you modify the status of an order, you can resend the order_status_notification.

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

  • Posts: 272
  • Thank you received: 3
  • Hikashop Business
13 years 6 months ago #16600

Okay I can confirm that issue 1 has been resolved.

I have another question. I have noticed that for all the payment plugins, the $element->payment_name and $element->payment_description are not language translatable. Is there a valid reason for this or can we add CText::_-('MYTEXT')? Any non-English sites then get presented on checkout with the payment name and description in English which is not ideal.

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

  • Posts: 82867
  • Thank you received: 13374
  • MODERATOR
13 years 6 months ago #16601

They are translatable. If you have JoomFish installed, you can go in JoomFish and translate them. In our commercial editions, you can directly translate them when you edit them.

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

Time to create page: 0.088 seconds
Powered by Kunena Forum