2013-04-10 83 views
1

我在管理產品上創建了一個選項卡。通過以下方式。如何將屬性添加到管理產品的自定義選項卡

<adminhtml_catalog_product_edit> 
    <reference name="product_tabs"> 
     <action method="addTab" ifconfig="customoptionspricing/general/enable" ifvalue="1"> 
      <name>customoptionspricing_tab</name> 
      <block>customoptionspricing/adminhtml_catalog_product_tab</block> 
     </action> 
    </reference> 
</adminhtml_catalog_product_edit> 

標籤顯示完美,我有一些自定義數據顯示在它的phtml文件。

現在我必須在此選項卡的內容中顯示產品自定義屬性。我不知道如何通過使用這個phtml文件或者其他方式來添加這個。

我嘗試添加屬性,像這樣:

$setup = new Mage_Eav_Model_Entity_Setup('core_setup'); 
    $setup->addAttribute('catalog_product', 'is_cop_product', array(
       'group' => 'Custom Options Pricing', 
       'label' => 'Is Custom Options Pricing (COP) Product',    
       'type' => 'int', 
       'input' => 'boolean',      
       'visible' => true, 
       'required' => true, 
       'position' => 1, 
       'global' => 'Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL', 
     'note' => "is product a cop product" 
    )); 

,但這種方式創建另一個選項卡(新組),有此屬性。

所以我需要這個屬性被添加到我已經創建的選項卡上。謝謝

+1

您是否找到關於此問題的更多信息?我只使用'addAttribute'來添加一個自定義屬性。但我使用了'general'組。現在我正在弄清楚如何爲自定義屬性更改組,以便它顯示在另一個選項卡中。 – Guus 2013-08-26 10:08:15

回答

0

嘗試設置used_in_forms

Mage::getSingleton('eav/config') 
    ->getAttribute('catalog_product','is_cop_product') 
    ->setData('used_in_forms', array('customoptionspricing_tab')) 
    ->save(); 

這對我們在1.8和1.9工作。在我們的情況下,這是一個客戶屬性,但我不明白爲什麼它不適用於產品。

相關問題