webdesigner_dk
asked on
Magento Api, cannot assign websites_id
Hi,
I am trying to create a product through the Magento Api with soap2" og "ws-1 compliance".
I am using this code:
Everything works fine, except that there is no website assigned to the product.
I have tried both with website code and id. The product is created, but no website assigned.
The website get's assigned when I try using "Soap", but I have to make this work with "Soap 2" with ws-1 compliance mode.
Any thoughts?
I am trying to create a product through the Magento Api with soap2" og "ws-1 compliance".
I am using this code:
<?php
ini_set('display_errors', 1);
try {
$proxy = new SoapClient('http://webhost/api/v2_soap?wsdl', array('compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP));
$sessionId = $proxy->login((object)array('username' => 'user', 'apiKey' => 'key'));
$result = $proxy->catalogProductCreate((object)array('sessionId' => $sessionId->result, 'type' => 'simple', 'set' => '4', 'sku' => 'sku-'.time(),
'productData' => ((object)array(
'name' => 'Product name',
'website_ids' => 'base',
'description' => 'Product description',
'short_description' => 'Product short description',
'weight' => '10',
'status' => '1',
'visibility' => '4',
'price' => '100',
'tax_class_id' => 2
))));
var_dump($result->result);
} catch (SoapFault $e) {
print_r($proxy);
}
?>
Everything works fine, except that there is no website assigned to the product.
I have tried both with website code and id. The product is created, but no website assigned.
The website get's assigned when I try using "Soap", but I have to make this work with "Soap 2" with ws-1 compliance mode.
Any thoughts?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I might be helpful if you found where you fond it others will not run into the same issue,
ASKER
Found the solution through trial and error, by using the code given by: http://www.magentocommerce.com/api/soap/introduction.html
ASKER
This solution solved my problem.
Have you checked out Extending Magento web services API v2.
Looking at that it says:
Open in new window
and it looks like you haveOpen in new window
(I think you might be missing the \ .