製品を作成するとき、API 経由で以下を使用できます。
$newProductData = array(
'name' => (string)$stockItem->STOCK_DESC,
'websites' => array(1,2), // array(1,2,3,...)
'short_description' => (string)$stockItem->STOCK_DESC,
'description' => (string)$stockItem->LONG_DESC,
'status' => 1,
'weight' => $stockItem->WEIGHT,
'tax_class_id' => 1,
'categories' => array(3108),
'price' => $stockItem->SELL_PRICE
);
$my_set_id = 9; // Use whatever set_id you want here
$type = 'simple';
$mc = new Mage_Catalog_Model_Product_Api();
$mc->create($type, $my_set_id, $stockItem->STOCK_CODE, $newProductData);
$mc->create
呼び出しを調べると、次のようになっていることがわかります。
foreach ($product->getTypeInstance(true)->getEditableAttributes($product) as $attribute) {
}
これは、オブジェクトに対して編集できる属性のリストがあることを示しています。
これらを見つけるにはどうすればよいですか?この情報が見つかる特定の場所はありますか?
編集:私はちょうどやった:
Mage::log($product->getTypeInstance(true)->getEditableAttributes($product));
そして結果を見ました。編集可能なすべての属性が下にある[attribute_code] =>
ようですが、このリストを取得するためにどこを見ればよいかを知るためのより良い方法が必要です.