开发者

Magento Product Insert Function

I need to add a custom option to all products as they get saved. For that I need to find the function that inserts 开发者_如何学编程the products into the database, which I'm not able to find.

Please, any help would be appreciated.

thanx


    $client = new SoapClient('http://www.magentolocal.it/api/?wsdl');
$session = $client->login('productloader', '1234567890');

$sku = "123456";
$attrs['name'] = "Template #1";
$attrs['description'] = "This is the first template.";
$attrs['short_description'] = "This is the short description of the template";
$attrs['websites'] = array('1');
$attrs['price'] = "11.53";
$attrs['categories'] = array('35');
$attrs['images'] = array()

$result = $client->call($session, 'catalog_product.create', array('simple', '63', $sku, $attrs));
echo $result;
$client->endSession($session);


Magento's EAV system is pretty strung out among several files, so you won't find a single function that accomplishes what you want. If you did go looking for it, and changed it, you would also be changing the same save method that mostly every other object in Magento uses, which is probably not what you want.

To do what you want, try setting up an observer/listener on the events that catalog products use when saving, namely catalog_product_save_before or catalog_product_save_after. That way, you don't have to hack the framework.

Hope that helps!

Thanks, Joe


How about http://www.magentocommerce.com/wiki/doc/webservices-api/api/catalog_product#catalog_product.create?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜