我想在Magento管理窗格中添加新的屬性:添加屬性銷售 - >命令 - >新建訂單
> sales > order > create new order
我想這將當前用戶登錄時獲取銷售人員的名字在管理面板中。
然後訂單類型是下拉式,並由其引用也是下拉式。
請告訴我如何繼續使用它?
哪些文件可以正確編輯等等所有的細節?
我想在Magento管理窗格中添加新的屬性:添加屬性銷售 - >命令 - >新建訂單
> sales > order > create new order
我想這將當前用戶登錄時獲取銷售人員的名字在管理面板中。
然後訂單類型是下拉式,並由其引用也是下拉式。
請告訴我如何繼續使用它?
哪些文件可以正確編輯等等所有的細節?
首先,你需要在訂單的實體創建新的屬性:
$installer = new Mage_Sales_Model_Resource_Setup('core_setup');
$installer ->addAttribute('order', 'my_attribute', array(
'label' => 'My New Attribute',
'type' => 'varchar',
'input' => 'text',
'visible' => true,
'required' => false,
'position' => 1,
));
現在,您將需要修改的管理視圖,以顯示新的屬性:
應用程序/設計/ adminhtml /默認/缺省的/模板/銷售/訂單/查看/ info.phtml
<?php if($_order->getMyAttribute()): ?>
<tr>
<td class="label"><label><?php echo Mage::helper('sales')->__('My Attribute') ?></label></td>
<td class="value"><strong><?php echo $_order->getMyAttribute() ?></strong></td>
</tr>
<?php endif ?>
新的屬性必須有一個默認的(非空)價值才能工作。如果該屬性在數據庫中具有「NULL」值,則該屬性不可寫。因此,使用此屬性選項陣列可能適合您
$attribute = array(
'type' => 'int',
'label' => 'attribute_code',
'default' => 0,
'visible' => false,
'required' => false,
'user_defined' => true,
'comparable' => false);
$installer->addAttribute('order', 'attribute_code', $attribute);
如何創建下拉類型的訂單屬性。我需要一個文本屬性和兩個下拉屬性,你能幫助我嗎? – 2013-05-12 06:46:55
http://www.magentocommerce.com/wiki/5_-_modules_and_development/0_-_module_development_in_magento/installing_custom_attributes_with_your_module – Andrew 2013-05-13 07:38:26