Jump to content

Trying to develop a shipping module


Nils-H

Recommended Posts

Hi!

 

I'm trying to develop a custom shipping module, and I have some questions. I have hooked the module into "extraCarrier", and I am able to display the shipping options and prices, which are dynamic based on postcode.

 

- The carrier I'm creating the module for has several shipping products. Do I need to create a carrier for each shipping product?

- Do the carrier physically need to exist (in the database), or can I just get the shipping cost from the external service and update the order/cart with the shipping cost value?

- ... which leads to, how do I update the order/cart with the new shipping cost?

Link to comment
Share on other sites

You must craete the carrier in order to prestashop manage somethings like free shipping... Once created the carrier you can manage all services that apply to the customer address inside the module trough functions. Your module must have a function called getOrderShippingCost or getOrderShippingCostExternal, in order to update cart, this way is very recommended to store shipping values got from external services in a database table. See, In Cart.php class,the function getOrderShippingCost(), near line 1159 (//get external shipping cost from module).

Link to comment
Share on other sites

Yes, I figured that out eventually by reading through the source code of the other shipping modules that comes with prestashop. So now I have it _almost_ working. The only issue now is that if I have no other carriers than those created with my module, an error is displayed: "There are no carriers available that deliver to this address."

 

However, the carriers I have created are enabled for all zones...

Link to comment
Share on other sites

  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...