Product links API (related, cross sells, up sells)

Last modified by Michael on Fri, July 4, 2008 12:34
Source|Old Revisions  

This is an old revision of the document!


Allows to import/export linked products

Module: Mage_Catalog

Resource: catalog_product_link

Aliases:

  • product_link

Methods

catalog_product_link.list

Retrieve linked products

Return: array

Arguments:

  • string type - link type (cross_sell, up_sell, related)
  • mixed product - product ID or Sku

Aliases:

  • product_link.list

catalog_product_link.assign

Assign product link

Return: boolean

Arguments:

  • string type - link type (up_sell, cross_sell, related)
  • mixed product - product ID or Sku
  • mixed linkedProduct - product ID or Sku for link
  • array data - link data (position, qty, etc ...) (optional)

Aliases:

  • product_link.assign

catalog_product_link.update

Update product link

Return: boolean

Arguments:

  • string type - link type (up_sell, cross_sell, related)
  • mixed product - product ID or Sku
  • mixed linkedProduct - product ID or Sku for link
  • array data - link data (position, qty, etc ...) (optional)

Aliases:

  • product_link.update

catalog_product_link.remove

Remove product link

Return: boolean

Arguments:

  • string type - link type (up_sell, cross_sell, related)
  • mixed product - product ID or Sku
  • mixed linkedProduct - product ID or Sku for link

Aliases:

  • product_link.remove

catalog_product_link.types

Retrieve product link types

Return: array

Aliases:

  • product_link.types

catalog_product_link.attributes

Retrieve product link type attributes

Return: array

Arguments:

  • string type - link type (cross_sell, up_sell, related)

Aliases:

  • product_link.attributes

Faults

Fault Code Fault Message
100 Given invalid link type.
101 Product not exists.
102 Invalid data given. Details in error message.
104 Product link not removed.

Examples

Example 1. Working with product links

  1. $proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
  2. $sessionId = $proxy->login('apiUser', 'apiKey');
  3.  
  4. // Get list of related products
  5. var_dump($proxy->call($sessionId, 'product_link.list', array('related', 'Sku')));
  6.  
  7. // Assign related product
  8. $proxy->call($sessionId, 'product_link.assign', array('related', 'Sku', 'Sku2', array('position'=>0, 'qty'=>56)));
  9.  
  10. var_dump($proxy->call($sessionId, 'product_link.list', array('related', 'Sku')));
  11.  
  12. // Update related product
  13. $proxy->call($sessionId, 'product_link.update', array('related', 'Sku', 'Sku2', array('position'=>2)));
  14.  
  15. var_dump($proxy->call($sessionId, 'product_link.list', array('related', 'Sku')));
  16.  
  17. // Remove related product
  18. $proxy->call($sessionId, 'product_link.remove', array('related', 'Sku', 'Sku2'));
  19.  
  20. var_dump($proxy->call($sessionId, 'product_link.list', array('related', 'Sku')));



 

Magento 2 GitHub Repository

Magento Job Board - Some sort of tag line goes here

Latest Posts| View all Jobs