Magento 以编程方式将字段添加到system.xml

Magento 以编程方式将字段添加到system.xml,magento,Magento,我已经为Magento创建了一个插件。 我需要改进添加一些基于语言的函数。因此,我必须为每种语言添加一个文本字段 <lc_global translate="label" module="lc_e"> [...] <groups> <lc_preferences translate="label"> <label></lab

我已经为Magento创建了一个插件。 我需要改进添加一些基于语言的函数。因此,我必须为每种语言添加一个文本字段

        <lc_global translate="label" module="lc_e">
    [...]
            <groups>
                <lc_preferences translate="label">
                    <label></label>
    [...]
                    <fields>

to be cycled

                        *<it_code>
                            <label>Code</label>
                            <frontend_type>text</frontend_type>
                            <sort_order>1</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>0</show_in_website>
                            <show_in_store>0</show_in_store>
                            <validate>validate-number</validate>
                        </it_code>*
end
                    </fields>

[...]
[...]
循环
*
密码
文本
1.
1.
0
0
验证号码
*
终止

你好,克劳迪奥·穆拉斯

Magento:如何以编程方式添加自定义选项

如何以编程方式创建产品自定义选项

[php]
$option = array(
  'title' => 'Your custom option title',
  'type' => 'radio', // could be drop_down ,checkbox , multiple
  'is_require' => 1,
  'sort_order' => 0,
  'values' => getOptions()
);

function getOptions(){
  return array(
    array(
      'title' => 'Option Value 1',
      'price' =>100,
      'price_type' => 'fixed',
      'sku' => 'any sku for 1',
      'sort_order' => '1'
    ),
    array(
      'title' => 'Option Value 2',
      'price' =>100,
      'price_type' => 'fixed',
      'sku' => 'any sku for 2',
      'sort_order' => '1'
    ),
    array(
      'title' => 'Option Value 3',
      'price' =>100,
      'price_type' => 'fixed',
      'sku' => 'any sku for 3',
      'sort_order' => '1'
    )
  );
}

//Suppose we are creating a new product.
$product = Mage::getModel('catalog/product');
$product->setProductOptions(array($option));
$product->setCanSaveCustomOptions(true);

//Or if we are adding the options to a already created product.
$product = Mage::getModel('catalog/product')->load($id);
$product->setProductOptions(array($option));
$product->setCanSaveCustomOptions(true);

//Do not forget to save the product
$product->save();

[/php]
参考:
options.html

是否要以编程方式添加管理配置字段?是的,它们必须基于语言,因此动态且以编程方式。虽然此链接可以回答问题,但最好在此处包含答案的基本部分,并提供链接以供参考。如果外部链接页面在将来更改,则仅链接答案将没有任何用处。没有问题。很好的答案+1,因为有这样的解释