Git Product home page Git Product logo

magento-improve-api's Introduction

Overview

This extension improves default features of Magento API.

It allows you to:

  • Associate simple products to configurable or grouped product;
  • 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;
  • Specify the website code rather than the id.

Installation

Magento CE 1.6.x, 1.7.x

Install with modgit:

$ cd /path/to/magento
$ modgit init
$ modgit clone bubble-api https://github.com/jreinke/magento-improve-api.git

or download package manually:

  • Download latest version here
  • Unzip in Magento root folder
  • Clear cache

How to associate simple products to configurable/grouped product

Please refer to this article.

magento-improve-api's People

Contributors

glyphobet avatar jreinke avatar juliensnz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

magento-improve-api's Issues

See associated products in configurable

Great extension first off!

I see that you are able to associate simple products to configurable products when you create them, but I was unable find in the blog post if it is possible to see already existing associated products when pulling the configurable via the API. Is this possible?

Broken API V2 with Magento 1.7.0.2

Awesome script!!
Unfortunately it doesn't work for me with Magento 1.7.0.2.

I'm using API_V2 and always get the error "SOAP-ERROR: Encoding: object has no 'key' property" when trying your example.
The 'price_changes' array kills it somehow.
If i use the WSI price_changes array with the API call, it ends with a "array to string conversion" notice and "SOAP-ERROR: Encoding: string 'Cannot use object of type stdClass\xe0...' is not a valid utf-8 string".

Need some help :/

Thanks,
Andi

How to correctly set 'price_changes' via API Soap V2

Hello Jreinke,
Thank you so much for a good free extension, I've tried improve-api with Magento ver. 1.9.0.1 CE
by call api soap v2, everything seem great... except!
when I define price_changes:

 'price_changes' => array(
            array(
                'color' => array(
                    'Red' => '2',
                    'White' => '-10%',
                ),
                'size' => array(
                    '7'  => '+1',
                    '7-'   => '-3',
                ),
            ),
        ),

error occurred :
SOAP-ERROR: Encoding: object has no 'key' property

Problem when I try to create configurable product.

true, 'connection_timeout' => 86400, 'wsdl_cache' => WSDL_CACHE_NONE, ); $proxy = new SoapClient('https://www.veromotos.com.br/index.php/api/v2_soap/?wsdl=1',$options); try { echo "
";
    $sessionId = $proxy->login('example', 'example123@');
echo "
"; }catch(Exception $e) { die(var_dump($e)); } /** * Simple product #1 (sku : SKU-001) */ $productData = array( 'name' => 'Produto Simples #1', 'description' => 'Descrição do Produto Simples #1', 'short_description' => 'Descrição Curta do Produto Simples #1', 'website_ids' => array('base'), // Id or code of website 'status' => 1, // 1 = Enabled, 2 = Disabled 'visibility' => 1, // 1 = Not visible, 2 = Catalog, 3 = Search, 4 = Catalog/Search 'tax_class_id' => 2, // Default VAT 'weight' => 0, 'stock_data' => array( 'use_config_manage_stock' => 0, 'manage_stock' => 0, // We do not manage stock, for example ), 'price' => 9.90, // Same price than configurable product, no price change 'additional_attributes' => array( 'single_data' => array( array( 'key' => 'cores', 'value' => 'AMARELO', // Id or label of color, attribute that will be used to configure product ), ), ), ); $proxy->catalogProductCreate($sessionId, 'simple', 'Default', 'SKU-001', $productData); /** * Simple product #2 (sku : SKU-002) */ $productData = array( 'name' => 'Produto Simples #2', 'description' => 'Descrição do Produto Simples #2', 'short_description' => 'Descrição Curta do Produto Simples #2', 'website_ids' => array('base'), // Id or code of website 'status' => 1, // 1 = Enabled, 2 = Disabled 'visibility' => 1, // 1 = Not visible, 2 = Catalog, 3 = Search, 4 = Catalog/Search 'tax_class_id' => 2, // Default VAT 'weight' => 0, 'stock_data' => array( 'use_config_manage_stock' => 0, 'manage_stock' => 0, // We do not manage stock, for example ), 'price' => 8.90, // Red product is $1 less than configurable product 'additional_attributes' => array( 'single_data' => array( array( 'key' => 'cores', 'value' => 'AZUL', // Id or label of color, attribute that will be used to configure product ), ), ), ); // Creation of product #2 $proxy->catalogProductCreate($sessionId, 'simple', 'Default', 'SKU-002', $productData); /** * Configurable product */ $productData = array( 'name' => 'Produto Configurável', 'description' => 'Descrição do produto configurável', 'short_description' => 'Descrição curta do produto configurável', 'website_ids' => array('base'), // Id or code of website 'status' => 1, // 1 = Enabled, 2 = Disabled 'visibility' => 4, // 1 = Not visible, 2 = Catalog, 3 = Search, 4 = Catalog/Search 'tax_class_id' => 2, // Default VAT 'weight' => 0, 'stock_data' => array( 'use_config_manage_stock' => 0, 'manage_stock' => 0, // We do not manage stock, for example ), 'price' => 9.90, 'associated_skus' => array('SKU-001', 'SKU-002'), // Simple products to associate ); try { $proxy->catalogProductCreate($sessionId,'configurable','Default','Configurable Product',$productData); }catch(Exception $e) { echo "
";
    die(var_dump($e));
    echo "
"; } I'm receiving the following error: ["previous":"Exception":private]=> NULL ["faultstring"]=> string(92) "Call to undefined method Mage_Catalog_Model_Product_Attribute_Backend_Price::getAllOptions()" ["faultcode"]=> string(15) "SOAP-ENV:Server" }

specify category names rather than ids not working

Hi,

I'm using this extension with magento 1.9 and everything works fine. If I add array of categories with their ids, the product is created correctly, but if I add an array of names, the product is created without any category associated to it. The code I'm using is:

$simple_data = array(
'categories' => array('Default Category', 'first subcategory'),
...
);

"price_changes" not compatible with "typens:associativeArray"

In the Magento 1.9 wsdl.xml the type "typens:associativeArray" is definend like this:
<complexType name="associativeEntity"> <all> <element name="key" type="xsd:string"/> <element name="value" type="xsd:string"/> </all> </complexType> <complexType name="associativeArray"> <complexContent> <restriction base="soapenc:Array"> <attribute ref="soapenc:arrayType" wsdl:arrayType="typens:associativeEntity[]"/> </restriction> </complexContent> </complexType>

So a "associativeArray" has to contain the keys "key" & "value" and this is incompatible with the data-structure the code requires:
'price_changes' => array( array( 'color' => array( 'Red' => '2', 'Blue' => '-10%', ), 'size' => array( 'Large' => '+1', 'Medium' => '-3', ), ), ),

I'am not an expert in WSDL but I think this calls for a new type definition?

An alternative Fix I did quick and dirty is to change the type of "price_changes" to "xsd:string" and do json_encode / serialize before calling the function with the soapclient and then in the api there needs to be the equivalent json_decode / unserialize.

Does anyone still maintain this extension ? Do you accept pull request ? Or is there another way to do this (create and associate configurable products), that i'am not aware of ?

Problem when I try to create configurable product

<?php 
$options = array(
    'trace' => true,
    'connection_timeout' => 86400,
    'wsdl_cache' => WSDL_CACHE_NONE,
);

$proxy = new SoapClient('https://www.veromotos.com.br/index.php/api/v2_soap/?wsdl=1',$options);


try { 
echo "<pre>";
    $sessionId = $proxy->login('example', 'example123@');
echo "</pre>";
}catch(Exception $e) {
    die(var_dump($e));
}
 

/**
 * Simple product #1 (sku : SKU-001)
 */
$productData = array(
    'name' => 'Produto Simples #1',
    'description' => 'Descrição do Produto Simples #1',
    'short_description' => 'Descrição Curta do Produto Simples #1',
    'website_ids' => array('base'), // Id or code of website
    'status' => 1, // 1 = Enabled, 2 = Disabled
    'visibility' => 1, // 1 = Not visible, 2 = Catalog, 3 = Search, 4 = Catalog/Search
    'tax_class_id' => 2, // Default VAT
    'weight' => 0, 
    'stock_data' => array(
        'use_config_manage_stock' => 0,
        'manage_stock' => 0, // We do not manage stock, for example
    ),
    'price' => 9.90, // Same price than configurable product, no price change
    'additional_attributes' => array(
        'single_data' => array(
            array(
                'key'   => 'cores',
                'value' => 'AMARELO', // Id or label of color, attribute that will be used to configure product
            ),
        ),
    ),
);

$proxy->catalogProductCreate($sessionId, 'simple', 'Default', 'SKU-001', $productData);

/**
 * Simple product #2 (sku : SKU-002)
 */
$productData = array(
    'name' => 'Produto Simples #2',
    'description' => 'Descrição do Produto Simples #2',
    'short_description' => 'Descrição Curta do Produto Simples #2',
    'website_ids' => array('base'), // Id or code of website
    'status' => 1, // 1 = Enabled, 2 = Disabled
    'visibility' => 1, // 1 = Not visible, 2 = Catalog, 3 = Search, 4 = Catalog/Search
    'tax_class_id' => 2, // Default VAT
    'weight' => 0,
    'stock_data' => array(
        'use_config_manage_stock' => 0,
        'manage_stock' => 0, // We do not manage stock, for example
    ),
    'price' => 8.90, // Red product is $1 less than configurable product
    'additional_attributes' => array(
        'single_data' => array(
            array(
                'key'   => 'cores',
                'value' => 'AZUL', // Id or label of color, attribute that will be used to configure product
            ),
        ),
    ),
);

// Creation of product #2
$proxy->catalogProductCreate($sessionId, 'simple', 'Default', 'SKU-002', $productData);

/**
 * Configurable product
 */
$productData = array(
    'name' => 'Produto Configurável',
    'description' => 'Descrição do produto configurável',
    'short_description' => 'Descrição curta do produto configurável',
    'website_ids' => array('base'), // Id or code of website
    'status' => 1, // 1 = Enabled, 2 = Disabled
    'visibility' => 4, // 1 = Not visible, 2 = Catalog, 3 = Search, 4 = Catalog/Search
    'tax_class_id' => 2, // Default VAT
    'weight' => 0,
    'stock_data' => array( 
        'use_config_manage_stock' => 0,
        'manage_stock' => 0, // We do not manage stock, for example
    ),
    'price' => 9.90,
    'associated_skus' => array('SKU-001', 'SKU-002'), // Simple products to associate
);
try {
$proxy->catalogProductCreate($sessionId,'configurable','Default','Configurable Product',$productData);
 
}catch(Exception $e) {
    echo "<pre>";
    die(var_dump($e));
    echo "</pre>"; 
}

I'm receiving the following error:

["previous":"Exception":private]=>
  NULL
  ["faultstring"]=>
  string(92) "Call to undefined method Mage_Catalog_Model_Product_Attribute_Backend_Price::getAllOptions()"
  ["faultcode"]=>
  string(15) "SOAP-ENV:Server"
}

Mixed content warning on admin panel.

Mixed Content: The page at 'https://example.com/index.php/admin/system_config/edit/section/payment/key/123456/' was loaded over HTTPS, but requested an insecure image 'http://i.imgur.com/nkD1M9R.png'. This content should also be served over HTTPS.

https://github.com/jreinke/magento-improve-api/blob/master/app/code/community/Bubble/Api/etc/system.xml#L5

The image is tightly coupled to imgur which seems odd, but it's hardcoded to request a http image which is causes a mixed content warning when the admin panel is on https.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.