From b498053f50d1fd059687b80615899b74a80bded0 Mon Sep 17 00:00:00 2001 From: resteve Date: Mon, 28 Nov 2011 15:07:22 +0100 Subject: [PATCH 1/4] Merge pull request #2 from iiijjjii/master --- magento/customer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/magento/customer.py b/magento/customer.py index 0e36873..a7cd68a 100644 --- a/magento/customer.py +++ b/magento/customer.py @@ -36,7 +36,7 @@ def list(self, filters=None): Example: `{'firstname':{'ilike':'sharoon'}}` :return: List of dictionaries of matching records """ - return self.call('customer.list', filters and [filters] or []) + return self.call('customer.list', filters and [filters] or [{}]) def create(self, data): """ From 79c06777de23ec9181ec424ed848bb65bbb5e04f Mon Sep 17 00:00:00 2001 From: resteve Date: Mon, 28 Nov 2011 15:14:07 +0100 Subject: [PATCH 2/4] [IMP] Catalog: Product Configurable API. Need install/update magento_webservices module available in Github --- magento/__init__.py | 4 ++-- magento/catalog.py | 43 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/magento/__init__.py b/magento/__init__.py index 533ae23..5aab63c 100644 --- a/magento/__init__.py +++ b/magento/__init__.py @@ -14,7 +14,7 @@ 'Country', 'Region', 'Category', 'CategoryAttribute', 'Product', 'ProductAttribute', 'ProductAttributeSet', 'ProductTypes', 'ProductImages', - 'ProductTierPrice', 'ProductLinks', 'Inventory', + 'ProductTierPrice', 'ProductLinks', 'ProductConfigurable', 'Inventory', 'Order', 'Shipment', 'Invoice', ] @@ -24,5 +24,5 @@ from catalog import Category, CategoryAttribute from catalog import Product, ProductAttribute, ProductAttributeSet from catalog import ProductTypes, ProductImages, ProductTierPrice -from catalog import ProductLinks, Inventory +from catalog import ProductLinks, ProductConfigurable, Inventory from sales import Order, Shipment, Invoice diff --git a/magento/catalog.py b/magento/catalog.py index ff8749a..1ccb819 100644 --- a/magento/catalog.py +++ b/magento/catalog.py @@ -635,6 +635,49 @@ def attributes(self, link_type): """ return self.call('catalog_product_link.attributes', [link_type]) +class ProductConfigurable(API): + """ + Product Configurable API for magento + """ + __slots__ = ( ) + + def info(self, product): + """ + Configurable product Info + + :param product: ID or SKU of product + :return: List + """ + return self.call('ol_catalog_product_link.list', [product]) + + def getSuperAttributes(self, product): + """ + Configurable Attributes product + + :param product: ID or SKU of product + :return: List + """ + return self.call('ol_catalog_product_link.listSuperAttributes', [product]) + + def update(self, product, linked_products, attributes): + """ + Configurable Update product + + :param product: ID or SKU of product + :param linked_products: List ID or SKU of linked product to link + :param attributes: dicc + :return: True/False + """ + return bool(self.call('ol_catalog_product_link.assign', [product, linked_products, attributes])) + + def remove(self, product, linked_products): + """ + Remove a product link configurable + + :param product: ID or SKU of product + :param linked_products: List ID or SKU of linked product to unlink + """ + return bool(self.call('ol_catalog_product_link.remove', [product, linked_products])) class Inventory(API): """ From b24e3468832be8ba4218d39ed97a97e797ff7503 Mon Sep 17 00:00:00 2001 From: resteve Date: Mon, 28 Nov 2011 16:17:31 +0100 Subject: [PATCH 3/4] [ADD] README --- README | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 README diff --git a/README b/README new file mode 100644 index 0000000..18cdb3c --- /dev/null +++ b/README @@ -0,0 +1,38 @@ +Magento Python +************** + +Python library to connect Magento Webservices + +Check documentation source code + +Examples: + +from magento import * + +url = 'http://domain.com/' +apiuser = 'user' +apipass = 'password' + +"""Product""" +with Product(url, apiuser, apipass) as product_api: + ofilter = {'created_at':{'from':'2011-09-15 00:00:00'}} + products = product_api.list(ofilter) + +with ProductTypes(url, apiuser, apipass) as product_type_api: + product_type = product_type_api.list() + +with Product(url, apiuser, apipass) as product_api: + sku = 'prod1' + product = product_api.info(sku) + +"""Websites""" +with API(url, apiuser, apipass) as magento_api: + websites = magento_api.call('ol_websites.list', []) + store_group = magento_api.call('ol_groups.list', []) + store_views = magento_api.call('ol_storeviews.list', []) + +"""Order""" +with Order(url, apiuser, apipass) as order_api: + order_increment_id = '100000001 ' + status = 'canceled' + order_api.addcomment(order_increment_id, status) From 8d6bb33eb769d2eed1fbe8c27a070f033aef3853 Mon Sep 17 00:00:00 2001 From: resteve Date: Wed, 7 Dec 2011 15:35:32 +0100 Subject: [PATCH 4/4] [IMP] Catalog Product Attribute Info. Need update Magento Webservices Module --- magento/catalog.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/magento/catalog.py b/magento/catalog.py index 1ccb819..ca8a8ef 100644 --- a/magento/catalog.py +++ b/magento/catalog.py @@ -363,6 +363,15 @@ def list(self, attribute_set_id): """ return self.call('catalog_product_attribute.list', [attribute_set_id]) + def info(self, attribute): + """ + Retrieve product attribute info + + :param attribute: ID or Code of the attribute + :return: `list` of `dict` + """ + return self.call('ol_catalog_product_attribute.info', [attribute]) + def options(self, attribute, store_view=None): """ Retrieve product attribute options