开发者

Magento API - Several methods do not work

I've got the following problem. I built a PHP file, which reads categories from a file, to impor tthem into Magento. I am able to read the file, no problem. The connection via NuSOAP to the Magento API works aswell. I can get the SessionID and I am able to get data, like Information for a category, also its possible to delete categories.

But, whenever I try to create or update anything, it throws an error. The rights for the user are ok aswell. For example, when I create a category, I add the usual data to the call:

$proxy->call(
$sessionId,
'category.create',
       $rootCategory, array(
            'name' => "TEST", 
            'is_active' => '1',
            'page_layout' => 'two_columns_right',
            'description' => "TEST",
            'meta_title' => "TEST",
            'meta_description' => '',          
            'meta_keywords' => "TEST",
            'include_in_menu' => '0',
            'display_mode' => 'PRODUCTS',
            'available_sort_by' => 'price',
            'default_sort_by' => 'price',
            'is_anchor' => '0'
       )
);

All the time, it says:

( [faultcode] => 102 [faultstring] => Category not exists. )

Which is not true. The $rootCategory开发者_如何学Python is definatly a category, which is existing. I tried all other categories, I tried to add a 'path' to the info, I tried to use less information (only the neccesary stuff), I tried to read existing categories to get their IDs, NOTHING works. It always throws this faultcode. Same happens, when I try to update a category, or create /update a product. Deleting is no problem at all. Do you see the problem?


i just compared your NON working exemple and i found this while comparing it with another exemple i has ( i do not pretent to be expert ) ..

but seems like your $new_category, array(blahblha) ... should be INSIDE an array according to the exemple i already have

like this array($new_category,array(blahblah) ...

this is the mains difference i just saw ..

here is the EXEMPLE i just pulled out of the web ... Adapt to your needs..

$proxy->call(
    $sessionId,
    'category.create',
        array(
              3,
              array(
                'name'=>'New openerp',
                'is_active'=>1,
                'include_in_menu'=>2,
                'available_sort_by'=>'position',
                'default_sort_by'=>'position')) );


Have you tried specifying the category_id key in your $rootCategory within the call:

$selectedCategory['category_id'], array('name'=>'New Category Through Soap') )

Reference: http://www.magentocommerce.com/wiki/doc/webservices-api/api/catalog_category

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜