Jump to content

Récupérer informations du panier


Recommended Posts

Bonjour,

Je suis en train de créer un module de paiement. Je me retrouve un peu coincé.

J'ai besoin d'envoyer à une api ces informations : 

orderId
quantity
currency 
itemDescription
itemRef

Grace à ce petit bout de code je récupère pas mal d'informations 

 $this->context->smarty->assign(array(

       

            'cart' => $cart,

            'cart_details' => $cart_details,

     

        ));

 

  array (size=23) 'delivery' => object(Address)[840] public 'id_customer' => string '140' (length=3) public 'id_manufacturer' => string '0' (length=1) public 'id_supplier' => string '0' (length=1) public 'id_warehouse' => string '0' (length=1) public 'id_country' => string '3' (length=1) public 'id_state' => string '0' (length=1) public 'country' => string 'Belgique' (length=8) public 'alias' => string 'Maison' (length=6) public 'company' => null public 'lastname' => string '' (length=2) public 'firstname' => string '' (length=7) public 'address1' => string ' (length=19) public 'address2' => null public 'postcode' => string '' (length=4) public 'city' => string '' (length=10) public 'other' => null public 'phone' => string '' (length=9) public 'phone_mobile' => string '' (length=10) public 'vat_number' => null public 'dni' => null public 'date_add' => string '2018-08-25 10:45:51' (length=19) public 'date_upd' => string '2018-08-25 10:45:51' (length=19) public 'deleted' => string '0' (length=1) protected '_includeVars' => array (size=1) 'addressType' => string 'table' (length=5) protected '_includeContainer' => boolean false protected 'webserviceParameters' => array (size=2) 'objectsNodeName' => string 'addresses' (length=9) 'fields' => array (size=6) ... public 'id' => int 32 protected 'id_lang' => null protected 'id_shop' => null public 'id_shop_list' => null protected 'get_shop_from_context' => boolean true protected 'table' => string 'address' (length=7) protected 'identifier' => string 'id_address' (length=10) protected 'fieldsRequired' => array (size=6) 0 => string 'id_country' (length=10) 1 => string 'alias' (length=5) 2 => string 'lastname' (length=8) 3 => string 'firstname' (length=9) 4 => string 'address1' (length=8) 5 => string 'city' (length=4) protected 'fieldsSize' => array (size=12) 'alias' => int 32 'company' => int 255 'lastname' => int 32 'firstname' => int 32 'address1' => int 128 'address2' => int 128 'postcode' => int 12 'city' => int 64 'other' => int 300 'phone' => int 32 'phone_mobile' => int 32 'dni' => int 16 protected 'fieldsValidate' => array (size=22) 'id_customer' => string 'isNullOrUnsignedId' (length=18) 'id_manufacturer' => string 'isNullOrUnsignedId' (length=18) 'id_supplier' => string 'isNullOrUnsignedId' (length=18) 'id_warehouse' => string 'isNullOrUnsignedId' (length=18) 'id_country' => string 'isUnsignedId' (length=12) 'id_state' => string 'isNullOrUnsignedId' (length=18) 'alias' => string 'isGenericName' (length=13) 'company' => string 'isGenericName' (length=13) 'lastname' => string 'isName' (length=6) 'firstname' => string 'isName' (length=6) 'vat_number' => string 'isGenericName' (length=13) 'address1' => string 'isAddress' (length=9) 'address2' => string 'isAddress' (length=9) 'postcode' => string 'isPostCode' (length=10) 'city' => string 'isCityName' (length=10) 'other' => string 'isMessage' (length=9) 'phone' => string 'isPhoneNumber' (length=13) 'phone_mobile' => string 'isPhoneNumber' (length=13) 'dni' => string 'isDniLite' (length=9) 'deleted' => string 'isBool' (length=6) 'date_add' => string 'isDate' (length=6) 'date_upd' => string 'isDate' (length=6) protected 'fieldsRequiredLang' => array (size=0) empty protected 'fieldsSizeLang' => array (size=0) empty protected 'fieldsValidateLang' => array (size=0) empty protected 'tables' => array (size=0) empty protected 'image_dir' => null protected 'image_format' => string 'jpg' (length=3) protected 'def' => array (size=4) 'table' => string 'address' (length=7) 'primary' => string 'id_address' (length=10) 'fields' => array (size=22) ... 'classname' => string 'Address' (length=7) protected 'update_fields' => null public 'force_id' => boolean false 'delivery_state' => boolean false 'invoice' => object(Address)[855] public 'id_customer' => string '140' (length=3) public 'id_manufacturer' => string '0' (length=1) public 'id_supplier' => string '0' (length=1) public 'id_warehouse' => string '0' (length=1) public 'id_country' => string '3' (length=1) public 'id_state' => string '0' (length=1) public 'country' => string 'Belgique' (length=8) public 'alias' => string 'Maison' (length=6) public 'company' => null public 'lastname' => string '' (length=2) public 'firstname' => string '' (length=7) public 'address1' => string '' (length=19) public 'address2' => null public 'postcode' => string '' (length=4) public 'city' => string '' (length=10) public 'other' => null public 'phone' => string '' (length=9) public 'phone_mobile' => string '' (length=10) public 'vat_number' => null public 'dni' => null public 'date_add' => string '2018-08-25 10:45:51' (length=19) public 'date_upd' => string '2018-08-25 10:45:51' (length=19) public 'deleted' => string '0' (length=1) protected '_includeVars' => array (size=1) 'addressType' => string 'table' (length=5) protected '_includeContainer' => boolean false protected 'webserviceParameters' => array (size=2) 'objectsNodeName' => string 'addresses' (length=9) 'fields' => array (size=6) ... public 'id' => int 32 protected 'id_lang' => null protected 'id_shop' => null public 'id_shop_list' => null protected 'get_shop_from_context' => boolean true protected 'table' => string 'address' (length=7) protected 'identifier' => string 'id_address' (length=10) protected 'fieldsRequired' => array (size=6) 0 => string 'id_country' (length=10) 1 => string 'alias' (length=5) 2 => string 'lastname' (length=8) 3 => string 'firstname' (length=9) 4 => string 'address1' (length=8) 5 => string 'city' (length=4) protected 'fieldsSize' => array (size=12) 'alias' => int 32 'company' => int 255 'lastname' => int 32 'firstname' => int 32 'address1' => int 128 'address2' => int 128 'postcode' => int 12 'city' => int 64 'other' => int 300 'phone' => int 32 'phone_mobile' => int 32 'dni' => int 16 protected 'fieldsValidate' => array (size=22) 'id_customer' => string 'isNullOrUnsignedId' (length=18) 'id_manufacturer' => string 'isNullOrUnsignedId' (length=18) 'id_supplier' => string 'isNullOrUnsignedId' (length=18) 'id_warehouse' => string 'isNullOrUnsignedId' (length=18) 'id_country' => string 'isUnsignedId' (length=12) 'id_state' => string 'isNullOrUnsignedId' (length=18) 'alias' => string 'isGenericName' (length=13) 'company' => string 'isGenericName' (length=13) 'lastname' => string 'isName' (length=6) 'firstname' => string 'isName' (length=6) 'vat_number' => string 'isGenericName' (length=13) 'address1' => string 'isAddress' (length=9) 'address2' => string 'isAddress' (length=9) 'postcode' => string 'isPostCode' (length=10) 'city' => string 'isCityName' (length=10) 'other' => string 'isMessage' (length=9) 'phone' => string 'isPhoneNumber' (length=13) 'phone_mobile' => string 'isPhoneNumber' (length=13) 'dni' => string 'isDniLite' (length=9) 'deleted' => string 'isBool' (length=6) 'date_add' => string 'isDate' (length=6) 'date_upd' => string 'isDate' (length=6) protected 'fieldsRequiredLang' => array (size=0) empty protected 'fieldsSizeLang' => array (size=0) empty protected 'fieldsValidateLang' => array (size=0) empty protected 'tables' => array (size=0) empty protected 'image_dir' => null protected 'image_format' => string 'jpg' (length=3) protected 'def' => array (size=4) 'table' => string 'address' (length=7) 'primary' => string 'id_address' (length=10) 'fields' => array (size=22) ... 'classname' => string 'Address' (length=7) protected 'update_fields' => null public 'force_id' => boolean false 'invoice_state' => boolean false 'formattedAddresses' => array (size=2) 'delivery' => array (size=3) 'ordered' => array (size=9) ... 'formated' => array (size=11) ... 'object' => array (size=20) ... 'invoice' => array (size=3) 'ordered' => array (size=9) ... 'formated' => array (size=11) ... 'object' => array (size=20) ... 'products' => array (size=2) 0 => array (size=65) 'id_product_attribute' => string '1319' (length=4) 'id_product' => string '2025' (length=4) 'cart_quantity' => string '1' (length=1) 'id_shop' => string '1' (length=1) 'name' => string 'Samsung Galaxy S21' (length=18) 'is_virtual' => string '0' (length=1) 'description_short' => string '' (length=0) 'available_now' => null 'available_later' => null 'id_category_default' => string '2' (length=1) 'id_supplier' => string '3' (length=1) 'id_manufacturer' => string '0' (length=1) 'on_sale' => string '0' (length=1) 'ecotax' => string '0.000000' (length=8) 'additional_shipping_cost' => string '0.00' (length=4) 'available_for_order' => string '1' (length=1) 'price' => float 699.96 'active' => string '1' (length=1) 'unity' => null 'unit_price_ratio' => string '0.000000' (length=8) 'quantity_available' => string '1' (length=1) 'width' => string '0.000000' (length=8) 'height' => string '0.000000' (length=8) 'depth' => string '0.000000' (length=8) 'out_of_stock' => string '2' (length=1) 'weight' => float 0 'date_add' => string '2021-10-01 15:20:48' (length=19) 'date_upd' => string '2021-12-15 13:36:04' (length=19) 'quantity' => int 1 'link_rewrite' => string 'samsung-galaxy-s21' (length=18) 'category' => string 'accueil' (length=7) 'unique_id' => string '0000002025000000131932' (length=22) 'id_address_delivery' => string '32' (length=2) 'advanced_stock_management' => string '0' (length=1) 'supplier_reference' => null 'customization_quantity' => null 'id_customization' => null 'price_attribute' => string '0.000000' (length=8) 'ecotax_attr' => string '0.000000' (length=8) 'reference' => string '4627' (length=4) 'weight_attribute' => string '0.000000' (length=8) 'ean13' => null 'upc' => null 'minimal_quantity' => string '1' (length=1) 'wholesale_price' => string '0.000000' (length=8) 'id_image' => string '2025-2860' (length=9) 'legend' => string 'Samsung Galaxy S21' (length=18) 'reduction_type' => int 0 'stock_quantity' => int 1 'price_without_reduction' => float 846.9516 'price_with_reduction' => float 846.9516 'price_with_reduction_without_tax' => float 699.96 'total' => float 699.96 'total_wt' => float 846.95 'price_wt' => float 846.9516 'reduction_applies' => boolean false 'quantity_discount_applies' => boolean false 'allow_oosp' => int 0 'features' => array (size=6) ... 'attributes' => string 'Couleur : Noir, Capacité : 128GB' (length=33) 'attributes_small' => string 'Noir, 128GB' (length=11) 'rate' => float 21 'tax_name' => string 'TVA BE 21%' (length=10) 'price_without_quantity_discount' => float 846.9516 'reduction_formatted' => string '0,00 €' (length=8) 1 => array (size=65) 'id_product_attribute' => string '1538' (length=4) 'id_product' => string '2039' (length=4) 'cart_quantity' => string '1' (length=1) 'id_shop' => string '1' (length=1) 'name' => string 'Xiaomi Mi 11' (length=12) 'is_virtual' => string '0' (length=1) 'description_short' => string '' (length=0) 'available_now' => null 'available_later' => null 'id_category_default' => string '2' (length=1) 'id_supplier' => string '3' (length=1) 'id_manufacturer' => string '0' (length=1) 'on_sale' => string '0' (length=1) 'ecotax' => string '0.000000' (length=8) 'additional_shipping_cost' => string '0.00' (length=4) 'available_for_order' => string '1' (length=1) 'price' => float 699.96 'active' => string '1' (length=1) 'unity' => null 'unit_price_ratio' => string '0.000000' (length=8) 'quantity_available' => string '1' (length=1) 'width' => string '0.000000' (length=8) 'height' => string '0.000000' (length=8) 'depth' => string '0.000000' (length=8) 'out_of_stock' => string '2' (length=1) 'weight' => float 0 'date_add' => string '2021-10-02 13:57:47' (length=19) 'date_upd' => string '2021-12-15 13:36:06' (length=19) 'quantity' => int 1 'link_rewrite' => string 'xiaomi-mi-11' (length=12) 'category' => string 'accueil' (length=7) 'unique_id' => string '0000002039000000153832' (length=22) 'id_address_delivery' => string '32' (length=2) 'advanced_stock_management' => string '0' (length=1) 'supplier_reference' => null 'customization_quantity' => null 'id_customization' => null 'price_attribute' => string '0.000000' (length=8) 'ecotax_attr' => string '0.000000' (length=8) 'reference' => string '4559' (length=4) 'weight_attribute' => string '0.000000' (length=8) 'ean13' => null 'upc' => null 'minimal_quantity' => string '1' (length=1) 'wholesale_price' => string '0.000000' (length=8) 'id_image' => string '2039-2917' (length=9) 'legend' => string 'Xiaomi Mi 11' (length=12) 'reduction_type' => int 0 'stock_quantity' => int 1 'price_without_reduction' => float 846.9516 'price_with_reduction' => float 846.9516 'price_with_reduction_without_tax' => float 699.96 'total' => float 699.96 'total_wt' => float 846.95 'price_wt' => float 846.9516 'reduction_applies' => boolean false 'quantity_discount_applies' => boolean false 'allow_oosp' => int 0 'features' => array (size=6) ... 'attributes' => string 'Couleur : Gris' (length=14) 'attributes_small' => string 'Gris' (length=4) 'rate' => float 21 'tax_name' => string 'TVA BE 21%' (length=10) 'price_without_quantity_discount' => float 846.9516 'reduction_formatted' => string '0,00 €' (length=8) 'gift_products' => array (size=0) empty 'discounts' => array (size=0) empty 'is_virtual_cart' => int 0 'total_discounts' => float 0 'total_discounts_tax_exc' => float 0 'total_wrapping' => int 0 'total_wrapping_tax_exc' => int 0 'total_shipping' => int 0 'total_shipping_tax_exc' => int 0 'total_products_wt' => float 1693.9 'total_products' => float 1399.92 'total_price' => float 1693.9 'total_tax' => float 293.98 'total_price_without_tax' => float 1399.92 'is_multi_address_delivery' => boolean false 'free_ship' => boolean true 'carrier' => object(Carrier)[822] public 'id_reference' => null public 'name' => null public 'url' => null public 'delay' => null public 'active' => boolean true public 'deleted' => int 0 public 'shipping_handling' => boolean true public 'range_behavior' => null public 'is_module' => null public 'is_free' => boolean false public 'shipping_method' => int 1 public 'shipping_external' => int 0 public 'external_module_name' => null public 'need_range' => int 0 public 'position' => null public 'max_width' => null public 'max_height' => null public 'max_depth' => null public 'max_weight' => null public 'grade' => null protected 'webserviceParameters' => array (size=1) 'fields' => array (size=3) ... public 'id' => null protected 'id_lang' => int 1 protected 'id_shop' => int 1 public 'id_shop_list' => null protected 'get_shop_from_context' => boolean true protected 'table' => string 'carrier' (length=7) protected 'identifier' => string 'id_carrier' (length=10) protected 'fieldsRequired' => array (size=2) 0 => string 'name' (length=4) 1 => string 'active' (length=6) protected 'fieldsSize' => array (size=3) 'name' => int 64 'grade' => int 1 'external_module_name' => int 64 protected 'fieldsValidate' => array (size=14) 'name' => string 'isCarrierName' (length=13) 'active' => string 'isBool' (length=6) 'is_free' => string 'isBool' (length=6) 'url' => string 'isAbsoluteUrl' (length=13) 'shipping_handling' => string 'isBool' (length=6) 'range_behavior' => string 'isBool' (length=6) 'shipping_method' => string 'isUnsignedInt' (length=13) 'max_width' => string 'isUnsignedInt' (length=13) 'max_height' => string 'isUnsignedInt' (length=13) 'max_depth' => string 'isUnsignedInt' (length=13) 'max_weight' => string 'isFloat' (length=7) 'grade' => string 'isUnsignedInt' (length=13) 'is_module' => string 'isBool' (length=6) 'deleted' => string 'isBool' (length=6) protected 'fieldsRequiredLang' => array (size=1) 0 => string 'delay' (length=5) protected 'fieldsSizeLang' => array (size=1) 'delay' => int 512 protected 'fieldsValidateLang' => array (size=1) 'delay' => string 'isGenericName' (length=13) protected 'tables' => array (size=0) empty protected 'image_dir' => string 'C:\wamp64\www\old/img/s/' (length=24) protected 'image_format' => string 'jpg' (length=3) protected 'def' => array (size=7) 'table' => string 'carrier' (length=7) 'primary' => string 'id_carrier' (length=10) 'multilang' => boolean true 'multilang_shop' => boolean true 'fields' => array (size=20) ... 'classname' => string 'Carrier' (length=7) 'associations' => array (size=1) ... protected 'update_fields' => null public 'force_id' => boolean false

 

On me donne tous les produits un par un. Mais comment puis-je faire pour récupérer tout d'un coup ? 
J'aimerais récupérer tous les noms des produits, la quantité et la référence des articles en une seule fois.

Il me manque également l'orderId, je ne sais pas du tout où le récupérer

Merci d'avance pour vos réponses.

Falcaol


   

Link to comment
Share on other sites

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...