From 813ca9c76e726dd74004da85aaa588de02947569 Mon Sep 17 00:00:00 2001 From: Josh Famestad Date: Wed, 26 Nov 2014 00:03:38 -0800 Subject: [PATCH 1/3] added ProductCustomOptions class --- magento/catalog.py | 50 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/magento/catalog.py b/magento/catalog.py index 793b7dc..b26cb67 100644 --- a/magento/catalog.py +++ b/magento/catalog.py @@ -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]) + + 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): """ From aaa90cfa50e9b67a29abc5972b6d526cf2c73c69 Mon Sep 17 00:00:00 2001 From: Josh Famestad Date: Tue, 2 Dec 2014 20:29:51 -0800 Subject: [PATCH 2/3] fixed indentation --- magento/catalog.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/magento/catalog.py b/magento/catalog.py index b26cb67..fb44cf5 100644 --- a/magento/catalog.py +++ b/magento/catalog.py @@ -728,7 +728,7 @@ def info(self, option_id): :param option_id: option id :return dictionary """ - return self.call('product_custom_option.info', [option_id]) + return self.call('product_custom_option.info', [option_id]) def add(self, product, data): """ From 42c8bec03028298ba0a50e5e6a0a6041ff8e8008 Mon Sep 17 00:00:00 2001 From: Josh Famestad Date: Mon, 24 Jul 2017 15:25:53 -0700 Subject: [PATCH 3/3] fixed newline count before class to fit pep8 --- magento/catalog.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/magento/catalog.py b/magento/catalog.py index fb44cf5..dd82b66 100644 --- a/magento/catalog.py +++ b/magento/catalog.py @@ -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 @@ -719,6 +718,7 @@ def attributes(self, link_type): """ return self.call('catalog_product_link.attributes', [link_type]) + class ProductCustomOption(API): __slots__ = () @@ -770,6 +770,7 @@ def update(self, option_id): """ return self.call('product_custom_option.update', [option_id, data]) + class ProductConfigurable(API): """ Product Configurable API for magento.