Magento产品管理api

作者:stoat 发布时间:2014-07-03 分类:技术

引用该api可配合火车使用数据库操作方式在线发布产品,非常方便。

比如,创建一个库存为500的产品,magento的api调用方法为:

$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
$sessionId = $proxy->login('apiUser', 'apiKey');

$attributeSets = $proxy->call($sessionId, 'product_attribute_set.list');
$set = current($attributeSets);


$newProductData = array(
    'name'              => 'name of product',
     // websites - Array of website ids to which you want to assign a new product
    'websites'          => array(1), // array(1,2,3,...)
    'short_description' => 'short description',
    'description'       => 'description',
    'status'            => 1,
    'weight'            => 0,
    'tax_class_id'      => 1,
    'categories'    => array(3),    //3 is the category id
    'price'             => 12.05
);
$proxy->call($sessionId, 'product.create', array('simple', $set['set_id'], 'sku_of_product', $newProductData));
$proxy->call($sessionId, 'product_stock.update', array('sku_of_product', array('qty'=>500, 'is_in_stock'=>1)));

Magento产品管理官方api页面

http://www.magentocommerce.com/api/soap/catalog/catalogProduct/catalogProduct.html

Magento产品库存官方api页面

http://www.magentocommerce.com/api/soap/catalogInventory/cataloginventory_stock_item.update.htmll

原文地址:Magento产品管理api by 雪鼬博客

标签:Magento api

评论已关闭