Class: Magento::ProductLink

Inherits:
Base
  • Object
show all
Defined in:
lib/magento/product_link.rb

Overview

www.magentocommerce.com/wiki/doc/webservices-api/api/catalog_product_link 100 Given invalid link type. 101 Product not exists. 102 Invalid data given. Details in error message. 104 Product link not removed.

Instance Attribute Summary

Attributes inherited from Base

#attributes

Class Method Summary collapse

Methods included from Base::ClassMethods

#api_path, #commit

Methods included from Base::InstanceMethods

#id, #id=, #initialize, #method_missing, #object_attributes=

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Magento::Base::InstanceMethods

Class Method Details

.assign(*args) ⇒ Object

catalog_product_link.assign Assign product link

Return: boolean

Arguments:

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



36
37
38
# File 'lib/magento/product_link.rb', line 36

def assign(*args)
  commit('assign', *args)
end

.attributes(*args) ⇒ Object

catalog_product_link.attributes Retrieve product link type attributes

Return: array

Arguments:

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



85
86
87
# File 'lib/magento/product_link.rb', line 85

def attributes(*args)
  commit('attributes', *args)
end

.list(*args) ⇒ Object

catalog_product_link.list Retrieve linked products

Return: array

Arguments:

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



18
19
20
21
22
23
# File 'lib/magento/product_link.rb', line 18

def list(*args)
  results = commit("list", *args)
  results.collect do |result|
    new(result)
  end
end

.remove(*args) ⇒ Object

catalog_product_link.remove Remove product link

Return: boolean

Arguments:

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



65
66
67
# File 'lib/magento/product_link.rb', line 65

def remove(*args)
  commit('remove', *args)
end

.typesObject

catalog_product_link.types Retrieve product link types

Return: array



73
74
75
# File 'lib/magento/product_link.rb', line 73

def types
  commit('types', nil)
end

.update(*args) ⇒ Object

catalog_product_link.update Update product link

Return: boolean

Arguments:

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



51
52
53
# File 'lib/magento/product_link.rb', line 51

def update(*args)
  commit('update', *args)
end