-
Notifications
You must be signed in to change notification settings - Fork 76
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
Broken API V2 with Magento 1.7.0.2 #4
Comments
Hello Andi, Difficult for me to help you since examples given in blog were working fine but it was tested in PHP. What are ou using to make calls to Magento API? |
Hello Johann, thanks for your answer. I'm calling the API via PHP 5.4. Meanwhile i made some changes in your extension to the v2 api and it works now. It's also possible to update the associated products/prices with my version. I have found the errors in your WSDL definition. |
Hello @hadl, maybe could you post your changes to our? I have this problem too. Thanks |
Hello @hadl , Where do you post the patch? I really need it, please... |
Sorry for the "delay" 👎 I pushed my changes to hadl@9f78922 Difference to the original description:
Note: It was working for us but we switched to the simple configurable product extension and don't need the price changes anymore. The normal price changes method wasn' working for our price changes. |
Hello @hadl , I used your updated code but it still give me error can you please help me I am testing it in Magento 1.9.1 and usin Soap V2 Error : Fatal error: SOAP-ERROR: Encoding: object has no 'key' property in F:\wamp\www\webservices\catalog product\createproduct.php on line 100 Thanks |
@Chandu9012 how does your SOAP call looks like? |
Below is code for SOAP call login('soap_user', 'soap123'); $attributeSets = $client->catalogProductAttributeSetList($session); $attributeSet = current($attributeSets); $set = $attributeSet->set_id; $productData = array( 'name' => 'Name of product #1', 'description' => 'Description of product #1', 'short_description' => 'Short description of product #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' => 1, 'manage_stock' => 1, // We do not manage stock, for example 'qty' => 10 ), 'price' => 9.90, // Same price than configurable product, no price change 'additional_attributes' => array( 'single_data' => array( array( 'key' => 'color', 'value' => 'Blue', // Id or label of color, attribute that will be used to configure product ), ), ) ); // Creation of product #1 $client->catalogProductCreate($session, 'simple', $set, 'SKU-001', $productData); /** - Simple product #2 (sku : SKU-002) */ $productData = array( 'name' => 'Name of product #2', 'description' => 'Description of product #2', 'short_description' => 'Short description of product #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' => 1, 'manage_stock' => 1, // We do not manage stock, for example 'qty' => 20 ), 'price' => 8.90, // Red product is $1 less than configurable product 'additional_attributes' => array( 'single_data' => array( array( 'key' => 'color', 'value' => 'Red', // Id or label of color, attribute that will be used to configure product ), ), ) ); // Creation of product #2 $client->catalogProductCreate($session, 'simple', $set, 'SKU-002', $productData); /** - Configurable product */ $productData = array( 'name' => 'Configurable product', 'description' => 'Description of configurable product', 'short_description' => 'Short description of configurable product', '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' => 1, 'manage_stock' => 1, // We do not manage stock, for example 'qty' => 25, ), 'price' => 9.90, 'associated_skus' => array('SKU-001', 'SKU-002'), // Simple products to associate 'price_changes' => array( array( 'color' => array( 'Red' => '2', 'Blue' => '-10%' ) ) ) ); // Creation of configurable product //$result = $client->call($session, 'product.create', array('configurable', $attributeSet->set_id, 'SKU-TEST', $productData)); $result = $client->catalogProductCreate($session, 'configurable',$set, 'SKU-003',$productData); var_dump ($result); Thanks Chandu Mer |
You have to use the attribute id for the price changes. See #4 (comment) Here is a working example of our client:
|
I have updated SOAP Call as per See #4 (comment) and products created 2 simple and 1 configurable products but simple products are not assign to configurable products in Associated products Can you please help me what is issue? Thanks |
Maybe because you haven't set 'configurable_attributes'? |
I have added 'configurable_attributes' $productData = array( $result = $client->catalogProductCreate($session,'configurable',$attributeSet->set_id, 'SKU-003',$productData); Try to debug the issue but cant happen please help me ! Thanks |
Hello hadl 'configurable_attributes' => array(158), // attribute id for sta_size In your above code 'configurable_attributes' id is 158 so let me know the 'key' => 42, // 5 cm and 'key' => 43, // 7 cm and 'key' => 45, // 9 cm you have used key those id are what is or for this is 'configurable_attributes' values id? Thanks |
Hello @hadl, |
@Chandu9012 This #4 (comment) is/was the working example. Like i wrote in a previous comment, we switched to the simple configurable product extension (https://github.com/obigroup/magento-configurable-simple) and don't need the price changes anymore. |
Hello @hadl, Thanks, |
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
The text was updated successfully, but these errors were encountered: