Tracking-Email is sent without translations

by Matthias Leimbach   Last Updated April 09, 2018 16:09 PM - source

I wrote a short script, to send Tracking-Information if the customer-support forgot to puth the button.

Unfortunately the email is not translated corretly.

The footer and payment-information are partly in English and not translated to german as they are when i push the button in adminhtml to send the exact same email.

Im not shure where the information for the store language gets lost. I need the email in the language of the store, not the generic english version

see my code below:

require_once(dirname(__FILE__) . '/../app/Mage.php'); // path to magento

$store_code = 'de';
$store = Mage::app()->getStore($store_code);
$shipmentCollection = Mage::getResourceModel('sales/order_shipment_collection');
    $shipmentCollection->addAttributeToFilter('email_sent', array('null' => true));
    $shipmentCollection->addAttributeToFilter('shipping_label', array('notnull' => true));
    $shipmentCollection->addFieldToFilter('created_at', array("gt" => '2018-04-09 00:00:00'));

    $s_count = count($shipmentCollection);
    echo "total shipment count:" . $s_count . "\n\n";

    foreach ($shipmentCollection as $shipment) {
        echo "Shipment_ID:\n" . $shipment->getIncrementId() . "\n";
        $shipment_tracks = $shipment->getAllTracks();
        $track_count = count($shipment_tracks);

        // send shipment email only when carrier tracking info is added
        if ($track_count > 0) {
            echo "Tracking_IDs: ($track_count)\n";

            $trackingNumbers = array();

            foreach ($shipment_tracks as $track) {
                $trackingNumbers[] = $track->getNumber();

            foreach ($trackingNumbers as $trackingNumber) {
                echo $trackingNumber . "\n";
            echo "Created: ".$shipment->getCreatedAt()."\n";

            // send tracking mail
        echo "\n\n";

Related Questions

Making Tracking number into a link

Updated January 18, 2018 15:09 PM

How do i overwrite email/order/shipment/track.phtml

Updated September 19, 2018 10:09 AM

Tracking information to be sent in email issue

Updated July 02, 2018 10:09 AM