X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   General questions (X-Cart 5) (https://forum.x-cart.com/forumdisplay.php?f=66)
-   -   Update "Shipping Modifications" Tutorial? (https://forum.x-cart.com/showthread.php?t=74919)

jake.middleton 01-26-2017 08:35 PM

Update "Shipping Modifications" Tutorial?
 
Hey there,

I've developed a few modules in the past for the company that I work for, but this time I'm looking to create a new shipping method for a new carrier that's not offered by default. I was looking at the "Shipping Modifications" tutorial in the developer docs, but it appears to be out of date with X-Cart 5.3. Would it be possible to update this tutorial for X-Cart 5.3 as many of the other tutorials were? It would be a great help. Thanks!

rct 02-08-2018 12:08 PM

Re: Update "Shipping Modifications" Tutorial?
 
Quote:

Originally Posted by jake.middleton
Hey there,

I've developed a few modules in the past for the company that I work for, but this time I'm looking to create a new shipping method for a new carrier that's not offered by default. I was looking at the "Shipping Modifications" tutorial in the developer docs, but it appears to be out of date with X-Cart 5.3. Would it be possible to update this tutorial for X-Cart 5.3 as many of the other tutorials were? It would be a great help. Thanks!


Agree !! It would be great if someone can update it! Thanks

qualiteam 02-26-2018 12:34 AM

Re: Update "Shipping Modifications" Tutorial?
 
As far as I see the most recent version still uses the same \XLite\Model\Shipping\Processor\AProcessor base class for integrating with shipping services, and getRates() method is still the one that returns the list of available shipping methods, however now it has a default implementation that works this way:
- it calls prepareInputData() to translate the order data into the data to be sent to the carrier's server
- then it calls performRequest() to perform the request to the carrier's server and returns an array of \XLite\Model\Shipping\Rate
- finally, it calls the postProcessRates() to do some extra work over the rates

I guess you are to implement these methods in your custom shipping carrier module. However, you are not forced to follow this logic - for example, the existing free AustraliaPost module has its own getRates() method.

Anyway, I think the tutorial should work for 5.3 too. What problems did you face when following the tutorial? What didn't work?


All times are GMT -8. The time now is 11:49 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.