header

Magento 1.x Software Support Notice

For Magento Commerce 1, Magento is providing software support through June 2020. Depending on your Magento Commerce 1 version, software support may include both quality fixes and security patches. Please review our Magento Software Lifecycle Policy to see how your version of Magento Commerce 1 is supported.

For Magento Open Source 1.5 to 1.9, Magento is providing software security patches through June 2020 to ensure those sites remain secure and compliant. Visit our information page for more details about our software maintenance policy and other considerations for your business.

Set For Quote Product

Edit this page on GitHub

Module: GiftMessage API

Resource: giftmessage

Method:

Allows you to set a gift message for a product in the shopping cart (quote).

Arguments:

Type Name Description
string sessionId Session ID
string quoteId Shopping cart ID (quote ID)
array productsAndMessages
Array of giftMessageAssociativeProductsEntity
string store Store view ID or code (optional)

Return:

Type Name Description
array result Array of giftMessageResponse

The giftMessageAssociativeProductsEntity content is as follows:

Type Name Description
array product Array of shoppingCartProductEntity
array message
Array of giftMessageEntity

The giftMessageResponse content is as follows:

Type Name Description
string entityId
Entity ID
boolean result
Result
string error
Error

The shoppingCartProductEntity content is as follows:

Type Name Description
string product_id
ID of the product
string sku
SKU of the product
double qty
Number of products
associativeArray
options
An array of options
associativeArray
bundle_option
An array of bundle item options
associativeArray
bundle_option_qty
An array of bundle items quantity
ArrayOfString links
An array of links

The giftMessageEntity content is as follows:

Type Name Description
string from
Gift message sender
string to
Gift message recipient
string message
Gift message

Faults:
No Faults.

Examples

Request Example SOAP V1
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
$sessionId = $proxy->login('apiUser', 'apiKey');
 
$result = $proxy->call($sessionId, 'giftmessage.setForQuoteProduct', array(10, array(
'product' => array(
 'product_id' => '5',
 'sku' => 'sku',
 'qty' => '1',
 'options' => null,
 'bundle_option' => null,
 'bundle_option_qty' => null,
 'links' => null), 
'message' => array(
 'from' => 'Sara', 'to' => 'John', 'message' => 'Gift message text')
)));
 
 
var_dump($result);
Request Example SOAP V2
$proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); 

$sessionId = $proxy->login('apiUser', 'apiKey'); 
 
$result = $proxy->giftMessageSetForQuoteProduct($sessionId, '10', array(array(
'product' => array(
 'product_id' => '5',
 'sku' => 'sku',
 'qty' => '1',
 'options' => null,
 'bundle_option' => null,
 'bundle_option_qty' => null,
 'links' => null), 
'message' => array(
 'from' => 'Sara', 'to' => 'John', 'message' => 'Gift message text')
)));
 
var_dump($result);
Request Example SOAP V2 (WS-I Compliance Mode)
$proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); 

$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey')); 
 
$result = $proxy->giftMessageSetForQuoteProduct((object)array('sessionId' => $sessionId->result, 'quoteId' => '10', 'productsAndMessages' => array(array(
'product' => array(
 'product_id' => '5',
 'sku' => 'sku',
 'qty' => '1',
 'options' => null,
 'bundle_option' => null,
 'bundle_option_qty' => null,
 'links' => null), 
'message' => array(
 'from' => 'Sara', 'to' => 'John', 'message' => 'Gift message text')
))));
 
var_dump($result->result);