Jump to content

Get delivery_option from cart obj


Recommended Posts

Hello
 
I hope it is not a doublon since I did not find the answer on the web to my question before posting.

I am creating a prestashop module where I go trough the cart of orders. From one given cart, I have to get the total amount of shipping tax.

I am hooked on hookActionPaymentConfirmation, and as delivery option the cart object gives me this json value :

object(Cart)[84]
   ...
   public 'delivery_option' => string '{"5":"2,"}' (length=10)
   ...

I do not find how to use this value in the Prestashop developer guide, and I tried several random things that lead me to find this function is Prestashop core :

public function getDeliveryOption($default_country = null, $dontAutoSelectOptions = false, $use_cache = true)

located in prestashop\classes\Cart.php, line 3074

By reading its content, I figured out that all arguments where optional, so I called the function without arguments. It returned me the JSON data that the cart gave me in a first time

array (size=1)
  5 => string '2,' (length=2)

The circle is complete, I am stuck, so I come to you. :D

Do someone know where I can find the a sort of Prestashop's codex or how to get Shipping amount from an order or a cart ?

Thank you for any help people !

Edited by Murelh Ntyandi
adding tags (see edit history)
Link to comment
Share on other sites

  • 3 weeks 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...