2

We’re currently calling the variable "{{var shippingMethod}}” but it’s retrieving the description “fedex_STANDARD_OVERNIGHT”.

Is there a way to grab the code in place of the description.

For the one above it would just be FG (Example: FG).

I figure I could manually change this in the database but that's probably not the preferred method.

Should i assign/map it the value i'm looking for?? Do i need to edit or create a custom phtml file to include a block with custom variables?

2

Not sure I follow 100%, but I'll take a shot at it.

{{var shippingMethod}} is not a standard variable on sales email templates, so it must be something you already inject as custom.

Default templates in Magento will use {{var order.shipping_description}}, and you're saying that's not what you want?

Note that in a proper sales transactional email context you will have the order object at your disposal, so anything off the order model is available. Try these to explore your options:

Shipping Method + Carrier Code

{{var order.getShippingMethod()}}

Shipping Method Code

{{var order.getShippingMethod(1).getMethod()}}

Shipping Carrier Code

{{var order.getShippingMethod(1).getCarrierCode()}}

Shipping Carrier Name

{{var order.getShippingCarrier().getConfigData('title')}}

Where the 2nd option is probably the one you're looking for.

  • I got it from this extensive list found here: gist.github.com/tiagones/e2f3f822515e2fe0d23d – Singleton Sep 6 '17 at 20:20
  • I see, OK. I scanned the core code myself and believe that it is only used here: Mage_Checkout_Helper_Data::sendPaymentFailedEmail; I could be wrong, but anyway, let me know if any of the above 3 will work in your case. I am basing my answer on a context like this one: Mage_Sales_Model_Order::sendNewOrderEmail. – Rick Buczynski Sep 6 '17 at 20:34
  • The top two displayed the same thing, in my case it was: fedex_STANDARD_OVERNIGHT fedex_STANDARD_OVERNIGHT. Testing the third code right now. – Singleton Sep 6 '17 at 20:53
  • Unfortunately, none of those seemed to work. What was the 1 for in the second code. – Singleton Sep 6 '17 at 21:16
  • The "1" acts as a flag to return the method as an object so we can chain another call; see Mage_Sales_Model_Order::getShippingMethod($asObject = false). Also, I was mistaken on the first example: it does render the carrier code + method code together. I've updated my answer, try the new second option. – Rick Buczynski Sep 6 '17 at 21:35
0

How do I get only shipping option title under "Shipping Method"section in sales emails. As per the below screenshot I need to display only the text "Parcel Force 48 Standard 2-3 day"???enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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