From eed11ed7d40b29417bd69dff1a8726787555d81f Mon Sep 17 00:00:00 2001 From: slipinir Date: Fri, 1 Feb 2019 09:57:01 -0200 Subject: [PATCH 1/6] + Added the attribute "associated_skus" to the "catalogProductReturnEntity" class + Added the filling of the "associated_skus" attribute on the "catalogProductInfo" method --- .../Bubble/Api/Model/Catalog/Product/Api.php | 16 ++++++++++++++++ .../Bubble/Api/Model/Catalog/Product/Api/V2.php | 15 +++++++++++++++ app/code/community/Bubble/Api/etc/wsdl.xml | 5 +++++ app/code/community/Bubble/Api/etc/wsi.xml | 5 +++++ 4 files changed, 41 insertions(+) diff --git a/app/code/community/Bubble/Api/Model/Catalog/Product/Api.php b/app/code/community/Bubble/Api/Model/Catalog/Product/Api.php index 1066dac..5637633 100644 --- a/app/code/community/Bubble/Api/Model/Catalog/Product/Api.php +++ b/app/code/community/Bubble/Api/Model/Catalog/Product/Api.php @@ -52,4 +52,20 @@ protected function _prepareDataForSave($product, $productData) Mage::helper('bubble_api/catalog_product')->associateProducts($product, $simpleSkus, $priceChanges, $configurableAttributes); } } + + // Not tested + public function info($productId, $store = null, $attributes = null, $identifierType = null) + { + $result = parent::info($productId, $store, $attributes, $identifierType); + if ($result['type'] == 'configurable') { + $associated_skus = array(); + $product = Mage::getModel('catalog/product')->load($productId); + $used_products = Mage::getModel('catalog/product_type_configurable')->getUsedProducts(null,$product); + foreach ($used_products as $used_product) { + $associated_skus[] = $used_product->getSku(); + } + $result += ['associated_skus' => $associated_skus]; + } + return $result; + } } \ No newline at end of file diff --git a/app/code/community/Bubble/Api/Model/Catalog/Product/Api/V2.php b/app/code/community/Bubble/Api/Model/Catalog/Product/Api/V2.php index 0e52829..a8e748d 100644 --- a/app/code/community/Bubble/Api/Model/Catalog/Product/Api/V2.php +++ b/app/code/community/Bubble/Api/Model/Catalog/Product/Api/V2.php @@ -84,4 +84,19 @@ protected function _prepareDataForSave($product, $productData) Mage::helper('bubble_api/catalog_product')->associateProducts($product, $simpleSkus, $priceChanges, $configurableAttributes); } } + + public function info($productId, $store = null, $attributes = null, $identifierType = null) + { + $result = parent::info($productId, $store, $attributes, $identifierType); + if ($result['type'] == 'configurable') { + $associated_skus = array(); + $product = Mage::getModel('catalog/product')->load($productId); + $used_products = Mage::getModel('catalog/product_type_configurable')->getUsedProducts(null,$product); + foreach ($used_products as $used_product) { + $associated_skus[] = $used_product->getSku(); + } + $result += ['associated_skus' => $associated_skus]; + } + return $result; + } } diff --git a/app/code/community/Bubble/Api/etc/wsdl.xml b/app/code/community/Bubble/Api/etc/wsdl.xml index 3029e01..395ae9e 100644 --- a/app/code/community/Bubble/Api/etc/wsdl.xml +++ b/app/code/community/Bubble/Api/etc/wsdl.xml @@ -12,6 +12,11 @@ + + + + + diff --git a/app/code/community/Bubble/Api/etc/wsi.xml b/app/code/community/Bubble/Api/etc/wsi.xml index d1e2cf5..6dcf7de 100644 --- a/app/code/community/Bubble/Api/etc/wsi.xml +++ b/app/code/community/Bubble/Api/etc/wsi.xml @@ -25,6 +25,11 @@ + + + + + From 39c34029390abf263a7a87ab5ba960159383ed43 Mon Sep 17 00:00:00 2001 From: Slipinir Date: Fri, 1 Feb 2019 11:10:16 -0200 Subject: [PATCH 2/6] Update README.md How to retrieve simple products from configurable products --- README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 27b594e..5c79cb6 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ This extension improves default features of Magento API. It allows you to: * Associate simple products to configurable or grouped product; +* Retrieve simple products from configurable products; * Specify category names rather than the ids; * Specify the name of the attribute set rather than the id; * Specify options labels rather than the ids; @@ -28,4 +29,9 @@ or download package manually: ## How to associate simple products to configurable/grouped product -Please refer to [this article](http://www.bubblecode.net/en/2012/04/20/magento-api-associate-simple-products-to-configurable-or-grouped-product/). \ No newline at end of file +Please refer to [this article](http://www.bubblecode.net/en/2012/04/20/magento-api-associate-simple-products-to-configurable-or-grouped-product/). + +## How to retrieve simple products from configurable products + +Consume the "catalogProductInfo" method from the SOAP API on neither V1 and V2 versions. +The list will be on the "associated_skus" attribute From b3fe8faf13aa79649e1fef70ad242ce901ca806b Mon Sep 17 00:00:00 2001 From: Luiz Date: Wed, 17 Apr 2019 09:49:14 -0300 Subject: [PATCH 3/6] +SOAP "catalogProductInfo" method returns the configurable attributes used on the product at the tag "configurable_attributes" --- app/code/community/Bubble/Api/Model/Catalog/Product/Api.php | 6 ++++++ .../community/Bubble/Api/Model/Catalog/Product/Api/V2.php | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/app/code/community/Bubble/Api/Model/Catalog/Product/Api.php b/app/code/community/Bubble/Api/Model/Catalog/Product/Api.php index 5637633..0df99d7 100644 --- a/app/code/community/Bubble/Api/Model/Catalog/Product/Api.php +++ b/app/code/community/Bubble/Api/Model/Catalog/Product/Api.php @@ -65,6 +65,12 @@ public function info($productId, $store = null, $attributes = null, $identifierT $associated_skus[] = $used_product->getSku(); } $result += ['associated_skus' => $associated_skus]; + $configurable_attributes = array(); + $_configurable_attributes = Mage::getModel('catalog/product_type_configurable')->getUsedProductAttributeIds($product); + foreach ($_configurable_attributes as $configurable_attribute) { + $configurable_attributes[] = Mage::getModel('eav/entity_attribute')->load($configurable_attribute)->getAttributeCode(); + } + $result += ['configurable_attributes' => $configurable_attributes]; } return $result; } diff --git a/app/code/community/Bubble/Api/Model/Catalog/Product/Api/V2.php b/app/code/community/Bubble/Api/Model/Catalog/Product/Api/V2.php index a8e748d..c0c86b4 100644 --- a/app/code/community/Bubble/Api/Model/Catalog/Product/Api/V2.php +++ b/app/code/community/Bubble/Api/Model/Catalog/Product/Api/V2.php @@ -96,6 +96,12 @@ public function info($productId, $store = null, $attributes = null, $identifierT $associated_skus[] = $used_product->getSku(); } $result += ['associated_skus' => $associated_skus]; + $configurable_attributes = array(); + $_configurable_attributes = Mage::getModel('catalog/product_type_configurable')->getUsedProductAttributeIds($product); + foreach ($_configurable_attributes as $configurable_attribute) { + $configurable_attributes[] = Mage::getModel('eav/entity_attribute')->load($configurable_attribute)->getAttributeCode(); + } + $result += ['configurable_attributes' => $configurable_attributes]; } return $result; } From 4cd33da88dbbb064ad92212125e24251bde68ccb Mon Sep 17 00:00:00 2001 From: Slipinir Date: Wed, 17 Apr 2019 09:51:14 -0300 Subject: [PATCH 4/6] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5c79cb6..8485242 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ or download package manually: Please refer to [this article](http://www.bubblecode.net/en/2012/04/20/magento-api-associate-simple-products-to-configurable-or-grouped-product/). -## How to retrieve simple products from configurable products +## How to retrieve simple products and used configurable attributes from configurable products Consume the "catalogProductInfo" method from the SOAP API on neither V1 and V2 versions. -The list will be on the "associated_skus" attribute +The simple products list will be on the "associated_skus" attribute and the configurable attributes list will be on the "configurable_attributes" attribute. From 7759098fb6667bc9ceda055dc279650960306d80 Mon Sep 17 00:00:00 2001 From: Slipinir Date: Wed, 17 Apr 2019 09:51:53 -0300 Subject: [PATCH 5/6] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 8485242..8003544 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ It allows you to: * Associate simple products to configurable or grouped product; * Retrieve simple products from configurable products; +* Retrieve configurable attributes used in configurable products; * Specify category names rather than the ids; * Specify the name of the attribute set rather than the id; * Specify options labels rather than the ids; From 86fed614ab04da307310ca661584aa920f2ec439 Mon Sep 17 00:00:00 2001 From: Slipinir Date: Wed, 17 Apr 2019 09:53:28 -0300 Subject: [PATCH 6/6] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8003544..aedc0f3 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ It allows you to: ## Installation -### Magento CE 1.6.x, 1.7.x +### Magento CE 1.6.x, 1.7.x (retrieval of simple products and configurable attributes worked on 1.5.x) Install with [modgit](https://github.com/jreinke/modgit): @@ -35,4 +35,5 @@ Please refer to [this article](http://www.bubblecode.net/en/2012/04/20/magento-a ## How to retrieve simple products and used configurable attributes from configurable products Consume the "catalogProductInfo" method from the SOAP API on neither V1 and V2 versions. + The simple products list will be on the "associated_skus" attribute and the configurable attributes list will be on the "configurable_attributes" attribute.