1

I can generate FedEx shipping label by FedEx Web-service in magento. That I have done by doing magento deafult FedEx shipping method configuration.There is no problem to do that But I can't generate ETD(Electronic Trade Document).I have attached two images which are some parts of my shipping label.In first One that I have generated through magento API. Below quote describes what is ETD that I have derived from FedEx site.

With Electronic Trade Documents shipping solution, you can submit your customs documents electronically, so you don’t have to print multiple copies and attach them to your packages. When you ship using FedEx ETD, you’ll gain operational efficiencies, save time and money and enjoy peace of mind.

enter image description here

In second one that I have generated through FedEx side for showing how actually the label should be.If this red circled label will appear then I can get a new pdf called Invoice pdf. I want that also.In magento admin I can get only to generate shipping label but not to generate invoice pdf which is meant for ETD.Can Any one please help me on that ?

enter image description here

4

I found the solution after contacting to the FedEx support team for generating ETD.I just override the Mage_Usa_Model_Shipping_Carrier_Fedex model to my custom module LR_Additional_Model_Usa_Shipping_Carrier_Fedex by

 <usa>
     <rewrite>
           <shipping_carrier_fedex>LR_Additional_Model_Usa_Shipping_Carrier_Fedex</shipping_carrier_fedex>
     </rewrite>
 </usa>

then edited the function _formShipmentRequest and added some xml elements which are meant for ETD element after the line - 1406. by following codes:

   $europianUnionCountryCodes = Mage::getStoreConfig('general/country/eu_countries');
   $euCountryCode = array();
   if($europianUnionCountryCodes){
       $euCountryCode = explode(',',$europianUnionCountryCodes);
   }

    if (($request->getShipperAddressCountryCode() != $request->getRecipientAddressCountryCode()) &&
    (!in_array($request->getRecipientAddressCountryCode(),$euCountryCode) && !in_array($request->getShipperAddressCountryCode(),$euCountryCode))) {
    /*Etd element section starts here */
        $requestClient['RequestedShipment']['SpecialServicesRequested'] = array(
    'SpecialServiceTypes' => 'ELECTRONIC_TRADE_DOCUMENTS',
    'EtdDetail' => array(
        'RequestedDocumentCopies' => 'COMMERCIAL_INVOICE'
    )
    );
    $requestClient['RequestedShipment']['ShippingDocumentSpecification'] = array(
    'ShippingDocumentTypes' => 'COMMERCIAL_INVOICE',
    'CommercialInvoiceDetail' => array(
        'Format' => array(
        'ImageType' => 'PDF',
        'StockType' => 'PAPER_LETTER',
        )
    )
    );
    $requestClient['RequestedShipment']['EdtRequestType'] = 'ALL';
    /*Etd element section ends here */
        $requestClient['RequestedShipment']['CustomsClearanceDetail'] =
            array(
                'CustomsValue' =>
                array(
                    'Currency' => $order->getOrderCurrencyCode(),
                    'Amount' => $customsValue,
                ),
                'DutiesPayment' => array(
                    'PaymentType' => $paymentType,
                    'Payor' => array(
                        'AccountNumber' => $this->getConfigData('account'),
                        'CountryCode'   => Mage::getStoreConfig(
                            Mage_Shipping_Model_Shipping::XML_PATH_STORE_COUNTRY_ID,
                            $request->getStoreId()
                        )
                    )
                ),
                'Commodities' => array(
                    'Weight' => array(
                        'Units' => $weightUnits,
                        'Value' =>  $request->getPackageWeight()
                    ),
                    'NumberOfPieces' => 1,
                    'CountryOfManufacture' => implode(',', array_unique($countriesOfManufacture)),
                    'Description' => implode(', ', $itemsDesc),
                    'Quantity' => ceil($itemsQty),
                    'QuantityUnits' => 'pcs',
                    'UnitPrice' => array(
                        'Currency' => $request->getBaseCurrencyCode(),
                        'Amount' =>  $unitPrice
                    ),
                    'CustomsValue' => array(
                        'Currency' => $request->getBaseCurrencyCode(),
                        'Amount' =>  $customsValue
                    ),
                )
            );
    }

The solution I have made in Magento ver. 1.7.0.2 only I am not sure for other versions of magento. Also magento doesn't have functionality to accept ETD label. It only accept Shipping label and save that shipping label into sales_flat_shipment in column shipping_label . So for invoice label I have managed in another way like fetch that label from the response comes from FedEx Api and save with my custom table as it is vast answer so I am not explaining everything. I am just explaining only possibilities that I have done.

Magento generally fetch the label by:

 $shippingLabelContent = $response->CompletedShipmentDetail->CompletedPackageDetails->Label->Parts->Image;

In same way I have fetched the invoice label by:

 $lr_invoice_label_content = $response->CompletedShipmentDetail->ShipmentDocuments->Parts->Image;
  • Thank you for your great answer. it helps me a lot. using you solution i am able to submit the ETD detail. but can you please tell me how can i fetch and store the commercial invoice. – Ajay saini Jan 19 at 8:28
  • @ajay you can do one thing just go to fedex.com/en-us/developer.html and search any documents available to that API. You will be getting and every details over there whatever service they are providing. – jyotiranjan.in Jan 19 at 13:14

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.