[TYPO3-commerce] Add extra fields in TCA BE form

dpino dpino at igalia.com
Tue Aug 9 13:23:20 CEST 2011


 Hello,

 I would like to customize the TCA forms of some of the entities of 
 Commerce.

 The first thing I need to do is to add extra attributes to some 
 entities. For instance, I created an entity 'Author' and now I need to 
 add a selectbox with authors to the Product->General tab.

 I followed the instructions of:

 http://typo3.org/documentation/document-library/extension-manuals/commerce/0.12.7/view/5/2/#id2314609

 but couldn't make it work yet. I debugged it and the hook is being 
 loaded, however I have my doubts with the configuration of the field. 
 First I created a new file for the hook called 
 hooks/class.tx_glcommerce_product.php.

 class tx_glcommerce_product {

    function postInit(&$model) {
       $model->add_fields_to_fieldlist(array('tx_glcommerce_authors'));
    }

 }

 Then in ext_tables.php I have something like this:

 require_once(t3lib_extMgm::extPath($_EXTKEY).'hooks/class.tx_glcommerce_product.php');

 $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['commerce/lib/class.tx_commerce_product.php']['postinit'][] 
 = 'tx_glcommerce_product';

 The point is, the string 'tx_glcommerce_authors' is just a string, 
 shouldn't be an array that specifies a TCA configuration? Something 
 like:

 $tx_glcommerce_authors = array(
    'exclude' => 0,
    'label' =>  'Authors'
    'config' => array (
       "type" => "select",
       ...
    )
 );

 Anyway, I tried this configuration too and didn't work. I also added 
 the 'tx_glcommerce_authors' string to the product field list in the 
 configuration of the Commerce, as the docs specify.

 Lastly, besides this, I'd like to know if it's possible to remove 
 existing TCA fields in the BE form because there are many of them I 
 don't need and that will make the interface clearer for my users.

 Regards,

 Diego


More information about the TYPO3-project-commerce mailing list