add_bundle


This call allows you to select the products in the cart that will be sent in a single package.

This call require two fields:

  1. items. A list of products (id_basket) to be shipped in one package
  2. shipping_item. The product with the shipping address to use. This value must be selected only inside the item list.


 

With this call, the system creates:

    • on an external table, a copy of the address to send the products
    • on a basket products selected, a link to this address


In this way all the bundle address changes will run only to the bundle linked address , leaving intact the original address, which will be restored simply removing a product from the bundle.



Call parameters:


Parameter

Required

Note

uid

yes

Id client

pid

yes

Id Portal

lid

yes

id Language

key

yes

Autentication Code

api_version  

yes

API Version.

request

yes

Name of function requested

items

yes

List of id_basket to be included in the bundle.

shipping_item

yes

id_basket product that will be used as the main shipping address.

This value must be selected only inside the items list.



Reply parameters:


Parameter

Always present

Note

success

yes

true o false, indicate if operation has been completed or not

rc

yes

return code.

message

yes

Error Message

bundle_name

no

This field is available only if the call return successful.

Indicate the name given to the bundle. This name will be used as an index for all future bundle calls


This call can have the following error messages:


  • -2  Access Denied
  • -4  Fatal Error: There was an internal Error. Please retry or contact webmaster@wwt.it
  • -6  Field [items|shipping_item] is mandatory
  • -12 id_basket [id_basket] not found
  • -14 Unable to proceed. User does not have permission to perform this action
  • -34 A bundle must be composed of at least 2 items.
  • -35 shipping_item must be in the items list
  • -36 The following items cannot be used into this bundle: [items]



Json request structure:


{

    "uid": 12345,

    "pid": 2,

    "lid": 1,

    "key": "VtKpudWnzRBioQeBKQXPBdSpamppUTw8",

    "api_version": "1.0.0",

    "request": "add_bundle",

    "items": "1;2",

    "shipping_item" : "1"

}



Example php call:



$data = array(

    "uid"           => 12345,

    "pid"           => 2,

    "lid"           => 1,

    "key"           => "VtKpudWnzRBioQeBKQXPBdSpamppUTw8",

    "api_version"   => "1.0.0",

    "request"       => "add_bundle",

    "items"         => "1;2",

    "shipping_item" => 1

);



$data = array('data' => json_encode($data));

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "https://dev.dropshippingb2b.com/api/");

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,FALSE);

curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,2);

curl_setopt($ch, CURLOPT_POST, 1);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

$ce = curl_exec($ch);


echo $ce;


curl_close($ch);





Example of a positive response:


{

   "success":true,

   "rc":0,

   "message":"",

   "bundle_name":"A"

}



Example of negative response:


{

  "success": false,

  "rc": -36,

  "messageā€: "The following items cannot be used into this bundle: 1"

}































































Created with the Personal Edition of HelpNDoc: Write eBooks for the Kindle