Jump to content

Add ordered products list into the TM4B sms "New order"


N0frills
 Share

Recommended Posts

I was trying to add more data from those that are communicated within the notification message "new order" form TM4B. From what I've seen, the module possesses txt models where to insert the names of variables, just like the email notifications. Can you help me with some advices about which file modify and how? Maybe adding the right variable in tm4b.php? I would like to be able to add the list of ordered products. Thank you.

Share this post


Link to post
Share on other sites

You'd need to write code like the following in the hookNewOrder function of tm4b.php before the $templateVars:

$productsDetail = $order->getProductsDetail();
$products = "";
foreach ($productsDetail as $product)
  $products .= ($products == "" ? "" : ", ") . $product['product_quantity'] . 'x ' . $product['product_name'];



Then add the following to the $templateVars:

'{products}' => $products,



Then add the following to your sms_new_order.txt files:

Products: {products}



I haven't tested this code, but it should display text like the following in your SMS:

Products: 1x Product One, 1x Product Two

Share this post


Link to post
Share on other sites

Sorry, but I just solved, I have placed the variable in the wrong position. Now I just have to modify the module to add customer address and the type of shipment. Thanks again.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More