I HAD a working site as per the following workflow for Types 3.0.7 hidden link
But at some time in the last 3 months, an update to either CRED or TYPES seems to have broken the notification emails.
They now are printing the shortcodes, which previously worked.
Shipment Stage: [types field=’shipment-stage’][/types]
Point of Departure: [types id=”1270” field=’point-of-departure’][/types]
Point of Arrival: [types id=”1270” field=’point-of-arrival’][/types]
Estimated Delivery Date: [types field=’delivery-date-estimated-actual’ style=’text’ format=’Y-m-d’][/types]
Description of Goods: [types id=”1270” field=’description-of-goods’][/types]
Our shipment delivery stages.
A. Order Received / ご注文承りました
B. Being Prepared / 準備中
C. Ocean Transit / 海上輸送
D. Pending Customs / 保留中の習慣
E. Destination Warehouse / 行き先倉庫
F. Inland Transport / 内陸輸送
G. Delivered / 届いた
NOTE:
//ToolSet email notification code snippet below
//To send out email to a customer in correct language when shipment status is changed
/*
* Custom shortcode trid to provide translated post id if required
*/
add_shortcode( 'trid', function( $atts ){
$pid = $atts['pid']; // post id of post that triggers notification
// Get the preferred language
$lang = get_post_meta( $pid, 'wpcf-customer-language', true );
$trid = apply_filters( 'wpml_object_id', $pid, 'shipment', TRUE, $lang );
return $trid;
});
I used the patch files.
It's now working in the sense that I no longer receive Short Codes in the email notification.
HOWEVER...
The notification is absent those fields which are translated.
(Customer Name, Point of Departure, Point of Arrival, Description of Goods).
See our previous discussion and custom functions code for identifying the Post ID as part of the shortcode.
Shipment Code: MOXG789126TST
Customer Name:
Shipment Stage: B. Being Prepared / 準備中
Point of Departure:
Point of Arrival:
Estimated Delivery Date: 2018-11-11
Description of Goods:
SO... when I remove the Post ID reference "nested shortcode" it works.
Shipment Code: MOXG789126TST
Customer Name: Trans Global Cars
Shipment Stage: C. Ocean Transit / 海上輸送
Point of Departure: Kobe
Point of Arrival: Dubai
Estimated Delivery Date: 2018-11-11
Description of Goods:
5 Passenger Cars
BUT .... It obviously returns us to the problem of the notification not identifying the correct language version.
When the "preferred language" is set to Japanese, I incorrectly get the default English custom fields even though translations of those fields exist.
出荷コード: MOXG789126TST
顧客名: Trans Global Cars
出荷段階: F. Inland Transport / 内陸輸送
出発点: Kobe
到着地点: Dubai
お届け予定日: 2018-11-11
商品の説明:
5 Passenger Cars
The "nested shortcode" Post ID previously solved that problem.
I don't have the same test environments I had previously to work on this, so I'll need to set it up again.
(If I need to report to the devs that something is broken, I need to be able to do that on a clean test site rather than on your "dirty" production site, so that the problem is isolated.)
So I will first set up a fresh test site with the older plugin versions to see it working, then see what subsequent updates break this—bearing in mind there could be a problem with a WPML update or with Toolset updates.
I got my test site up and running with it working as it was in August, confirmed it doesn't currently work (including when the Types patch is applied that we discussed above), and then went back updating through the various plugin releases to identify the culprit.
It turns out that it was the last Forms update—to 2.1.2—and that we have recently published an errata about a related notifications issue.