Friday 18 July 2014

Magento fedex SoapFault exception

Well, when it comes to any third party Shipping API's it a big headache for the developers. Especially when the worlds largest Shipping company FedEx changed their URL for the webservice request without any prior notification and the URL's are hardcoded.

So, How does it affect Magento ?

I was using the FedEx shipping method and everything works good in the Frontend of the website. But when i create a Shipping Label from the Admin i got an error message "An error occured while creating shipping label". And when i checked the LOG file, there was only EXCEPTION log created.

Ok, so after checking the exception log i found that there was a "SoapFault exception" error.
Later i found that it was the FedEx the culprit.

FIXES

Go to the path: app/code/core/Mage/Usa/Model/Shipping/Carrier
open Fedex.php file

On the line number 135 you will find such code with the fedex webservice url hardcoded

$client->__setLocation($this->getConfigFlag('sandbox_mode')
            ? 'https://wsbeta.fedex.com:443/web-services/rate'
            : 'https://ws.fedex.com:443/web-services/rate'
        );

Replace this with this new code.

$client->__setLocation($this->getConfigFlag('sandbox_mode')
            ? 'https://wsbeta.fedex.com:443/web-services'
            : 'https://ws.fedex.com:443/web-services'
        );


and that's it. The error must be Fixed. If it still exists please check your server configuration for the SOAP and WSDL configuration. It must be using older version. Try upgrading it.

NOTE: If you are creating Shipping Labels you Need to change the URL on the WSDL file also. The URL will be found at the very bottom of the code. 

Tuesday 1 July 2014

Magento Add to cart not working for new products block

I came across this Add to cart issue after upgrading from version 1.7.2 to 1.8.1.
Then after a long time search, luckly i found the cause.

In Magento version 1.8.1 there was an update to the add to cart feature with the inclusion of "Form keys". Magento has implemented this feature to prevent XSS attacks.

To know more about Form keys click here.

SOLUTION : Change the button type from "button" to "submit"

NOTE : Enabling All cache type may not solve the issue. Disable only "Blocks HTML output", you can enable other cache types.