Catalog

magento.catalog

Product Catalog API for magento

copyright:
  1. 2010 by Sharoon Thomas.
copyright:
  1. 2010 by Openlabs Technologies & Consulting (P) LTD
license:

AGPLv3, see LICENSE for more details

class catalog.Category(url, username, password, version='1.3.2.4', full_url=False, protocol='xmlrpc')

Product Category API to connect to magento

currentStore(store_view=None)

Set/Get current store view

Parameters:
  • store_view – Store view ID or Code
Returns:

int

tree(parent_id=None, store_view=None)

Retrieve hierarchical tree of categories.

Parameters:
  • parent_id – Integer ID of parent category (optional)
  • store_view – Store View (optional)
Returns:

dictionary of values

level(website=None, store_view=None, parent_category=None)

Retrieve one level of categories by website/store view/parent category

Parameters:
  • website – Website code or ID
  • store_view – storeview code or ID
  • parent_category – Parent Category ID
Returns:

Dictionary

info(category_id, store_view=None, attributes=None)

Retrieve Category details

Parameters:
  • category_id – ID of category to retrieve
  • store_view – Store view ID or code
  • attributes – Return the fields specified
Returns:

Dictionary of data

create(parent_id, data, store_view=None)

Create new category and return its ID

Parameters:
  • parent_id – ID of parent
  • data – Data for category
  • store_view – Store view ID or Code
Returns:

Integer ID

update(category_id, data, store_view=None)

Update Category

Parameters:
  • category_id – ID of category
  • data – Category Data
  • store_view – Store view ID or code
Returns:

Boolean

move(category_id, parent_id, after_id=None)

Move category in tree

Parameters:
  • category_id – ID of category to move
  • parent_id – New parent of the category
  • after_id – Category ID after what position it will be moved
Returns:

Boolean

delete(category_id)

Delete category

Parameters:
  • category_id – ID of category
Returns:

Boolean

assignedproducts(category_id, store)

Retrieve list of assigned products

Parameters:
  • category_id – Category ID
  • store – Store ID or Code
Returns:

Dictionary

assignproduct(category_id, product, position=None)

Assign product to a category

Parameters:
  • category_id – ID of a category
  • product – ID or Code of the product
  • position – Position of product in category
Returns:

boolean

updateproduct(category_id, product_id, position=None)

Update assigned product

Parameters:
  • category_id – ID of a category
  • product – ID or Code of the product
  • position – Position of product in category
Returns:

boolean

removeproduct(category_id, product)

Remove product from category

Parameters:
  • category_id – ID of a category
  • product – ID or Code of the product
Returns:

boolean

class catalog.CategoryAttribute(url, username, password, version='1.3.2.4', full_url=False, protocol='xmlrpc')

Product Category Attribute API to connect to magento Allows to get attributes and options for category.

currentStore(store_view=None)

Set/Get current store view

Parameters:
  • store_view – Store view ID or Code
Returns:

int

options(attribute_id, store_view=None)

Retrieve attribute options

Parameters:
  • attribute_id – ID of the attribute whose options are reqd
  • store_view – ID or Code of the store view
Returns:

list of dictionary

list()

Retrieve Category attrbutes

class catalog.Product(url, username, password, version='1.3.2.4', full_url=False, protocol='xmlrpc')

Product API for magento

currentStore(store_view=None)

Set/Get current store view

Parameters:
  • store_view – Store view ID or Code
Returns:

int

list(filters=None, store_view=None)

Retrieve product list by filters

Parameters:
  • filters

    Dictionary of filters.

    Format :
    {<attribute>:{<operator>:<value>}}
    Example :
    {‘firstname’:{‘ilike’:’sharoon’}}
Store_view :

Code or ID of store view

Returns:

<title_reference>list</title_reference> of dict

info(product, store_view=None, attributes=None)

Retrieve product data

Parameters:
  • product – ID or SKU of product
  • store_view – ID or Code of store view
  • attributes – List of fields required
Returns:

<title_reference>dict</title_reference> of values

create(product_type, attribute_set_id, sku, data)

Create Product and return ID

Parameters:
  • product_type – String type of product
  • attribute_set_id – ID of attribute set
  • sku – SKU of the product
  • data – Dictionary of data
Returns:

INT id of product created

update(product, data, store_view=None)

Update product Information

Parameters:
  • product – ID or SKU of product
  • data – Dictionary of attributes to update
  • store_view – ID or Code of store view
Returns:

Boolean

setSpecialPrice(product, special_price=None, from_date=None, to_date=None, store_view=None)

Update product’s special price

Parameters:
  • product – ID or SKU of product
  • special_price – Special Price
  • from_date – From date
  • to_date – To Date
  • store_view – ID or Code of Store View
Returns:

Boolean

getSpecialPrice(product, store_view=None)

Get product special price data

Parameters:
  • product – ID or SKU of product
  • store_view – ID or Code of Store view
Returns:

Dictionary

delete(product)

Delete a product

Parameters:
  • product – ID or SKU of product
Returns:

Boolean

class catalog.ProductAttribute(url, username, password, version='1.3.2.4', full_url=False, protocol='xmlrpc')

Product Attribute API

class catalog.ProductAttributeSet(url, username, password, version='1.3.2.4', full_url=False, protocol='xmlrpc')

Product Attribute Set API

class catalog.ProductTypes(url, username, password, version='1.3.2.4', full_url=False, protocol='xmlrpc')

Product Types API

class catalog.ProductImages(url, username, password, version='1.3.2.4', full_url=False, protocol='xmlrpc')

Product Images API

class catalog.ProductTierPrice(url, username, password, version='1.3.2.4', full_url=False, protocol='xmlrpc')

Product Tier Price API

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

class catalog.Inventory(url, username, password, version='1.3.2.4', full_url=False, protocol='xmlrpc')

Allows to update stock attributes (status, quantity)

Previous topic

API

Next topic

Customer