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 1 commit
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
50 changes: 50 additions & 0 deletions magento/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -719,6 +719,56 @@ 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])

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentation is incorrect


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):
"""
Expand Down