I have created a custom module for send SMS at the time of order place, I have created a observer for this which works and send SMS to customer. I have provide message field in system configration and want to send this message to customer but I don't know how to create and use custom variable {order_id} in sms configration setting.

System configration setting figure as below : enter image description here

As shown in above figure I want to use custom variable in message input field and want to send order_id from observer when message send.

1 Answer 1


Use strtr It will translate parts of a string.

 $orderid = "51";
    $vars = array(
  '{$orderid}'       => $orderid,
  '{{order_id}}'        => $orderid,


echo  strtr($data, $vars);
  • Thanks for reply, Are you sure this is the correct way to replace {order_id} by $order_id, Is there not any another method for define and use variables? Jan 12, 2016 at 12:11
  • defined method for emails you are not using the email template so that is solution for you.. Jan 12, 2016 at 12:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.