Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Module: Mage_Catalog

Aliases:

  • product_link
Method:
  • catalog_product_link.update (SOAP V1)
  • catalogProductLinkUpdate (SOAP V2)

Allows you to update the product link.

Aliases:

  • product_link.update

Arguments:

TypeNameDescription
stringsessionIdSession ID
stringtypeType of the link (cross_sell, grouped, related, or up_sell)
stringproduct\productIdProduct ID or SKU
stringlinkedProduct\linkedProductIdProduct ID or SKU for the link
arraydataArray of catalogProductLinkEntity
stringidentifierTypeDefines whether the product ID or SKU is passed in the ‘product’ parameter

Returns:

TypeNameDescription
boolean\intresultTrue (1) if the link is updated

The catalogProductLinkEntity content is as follows:

TypeNameDescription
stringproduct_idProduct ID
stringtypeType of the link
stringsetProduct attribute set
stringskuProduct SKU
stringpositionPosition
stringqtyQuantity

Examples

Request Example SOAP V1
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
$sessionId = $proxy->login('apiUser', 'apiKey');

$productId = '1';
$linkedProductId = '2';
$data = array(
	'position' => '50'
);

$result = $proxy->call(
	$session,
	'catalog_product_link.update',
	array(
		'cross_sell',
		$productId,
		$linkedProductId,
		$data
	)
);
Request Example SOAP V2
<?php

$client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');

$session = $client->login('apiUser', 'apiKey');

$data = array(
   "position" => 15
  );

$identifierType = "product_id";
$type = "related";
$product = "1";
$linkedProduct = "3";

$orders = $client->catalogProductLinkUpdate($session, $type, $product, $linkedProduct, $data, $identifierType);

echo 'Number of results: ' . count($orders) . '<br/>';
var_dump ($orders);
?>
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->catalogProductLinkUpdate((object)array('sessionId' => $sessionId->result, 'type' => 'cross_sell', 'productId' => '1', 'linkedProductId' => '2', 'data' => ((object)array(
'position' => '1'
))));

var_dump($result->result);