m openmage

OpenMage LTS Developer Documentation

Product Link Update

Edit this page on GitHub

Module: Mage_Catalog

Resource: catalog_product_link

Aliases:

Method:

Allows you to update the product link.

Aliases:

Arguments:

Type Name Description
string sessionId Session ID
string
type
Type of the link (cross_sell, grouped, related, or up_sell)
string
product\productId
Product ID or SKU
string
linkedProduct\linkedProductId
Product ID or SKU for the link
array data
Array of catalogProductLinkEntity
string identifierType Defines whether the product ID or SKU is passed in the 'product' parameter

Returns:

Type Name Description
boolean\int result True (1) if the link is updated

The catalogProductLinkEntity content is as follows:

Type Name Description
string product_id
Product ID
string
type
Type of the link
string
set
Product attribute set
string
sku
Product SKU
string
position
Position
string
qty
Quantity

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);