2010-07-30 84 views
0

我需要为所有产品添加自定义选项,因为它们会被保存。为此,我需要找到将产品插入数据库的功能,这是我无法找到的。Magento产品插入功能

请任何帮助,将不胜感激。

thanx

+1

哪些产品?哪个选项?哪个数据库? – Manjoor 2010-07-30 06:32:27

+0

我只需要找到简单产品的插入功能。 – jarus 2010-07-30 07:30:22

+0

你已经说过了。请明确说明。 – whiskeysierra 2010-07-30 07:49:12

回答

0

Magento的EAV系统在几个文件中相当串联,所以你不会找到一个能够完成你想要的功能。如果你确实去找它并改变它,你也会改变Magento中大多数其他对象所使用的保存方法,这可能不是你想要的。

要做您想做的事情,请尝试设置目录产品在保存时使用的事件的观察者/侦听器,即catalog_product_save_beforecatalog_product_save_after。这样,你不必破解框架。

希望有帮助!

谢谢, 乔

1
$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);