2010-07-30 179 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);