Skip to content

added ProductCustomOptions class #25

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 52 additions & 1 deletion magento/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,6 @@ def attributeRemove(self, attribute_id, attribute_set_id):
return self.call('catalog_product_attribute_set.attributeRemove', [attribute_id, attribute_set_id])



class ProductTypes(API):
"""
Product Types API
Expand Down Expand Up @@ -720,6 +719,58 @@ def attributes(self, link_type):
return self.call('catalog_product_link.attributes', [link_type])


class ProductCustomOption(API):
__slots__ = ()

def info(self, option_id):
"""
Retrieve info for product custom option
:param option_id: option id
:return dictionary
"""
return self.call('product_custom_option.info', [option_id])

def add(self, product, data):
"""
Add a custom option to a product
:param product: id or sku or product
:param data: product custom option as dictionary
:return boolean
"""
return self.call('product_custom_option.add', [product, data])

def list(self, product):
"""
List product custom options
:param product: id or sku of product
:return list of dictionary
"""
return self.call('product_custom_option.list', [product])

def remove(self, option_id):
"""
Remove a product custom option
:param option_id: id of product custom option
:return boolean
"""
return self.call('product_custom_option.remove', [option_id])

def types(self):
"""
List available custom option types
:return list of dictionary
"""
return self.call('product_custom_option.types', [])

def update(self, option_id):
"""
Update an existing product
:param option_id: option id
return boolean
"""
return self.call('product_custom_option.update', [option_id, data])


class ProductConfigurable(API):
"""
Product Configurable API for magento.
Expand Down