[TYPO3-commerce] Implementing features

Christoph Nikic cnikic at elmos.de
Tue Jul 3 15:35:36 CEST 2007


Hi,

damn, its working ... thanks for hint! :)

Best regards,

Christoph

Here's my solution for those with a similar requirement:

1. Create a extension and extend the table (in my case 
tx_commerce_products) with the needed fields.

2. Create a Class and implement the methods you need. In my case:

-- schnipp --
function postInit(&$model) { 
$model->add_fields_to_fieldlist(array('YOUR_FIELD_1', 'YOUR_FIELD_2'));
}

function additionalMarker($markerArray, $singleViewPlugin) {
	$markerArray['###YOUR_FIELD_1###'] = 
$singleViewPlugin->product->getField('YOUR_FIELD_1');
	$markerArray['###YOUR_FIELD_2###'] = 
$singleViewPlugin->product->getField('YOUR_FIELD_2');
	return $markerArray;
}
-- schnapp --

3. Add this few lines to your localconf.php
require_once(t3lib_extMgm::extPath($_EXTKEY).'PATH_TO/YOUR_HOOK_CLASS.php');
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['commerce/lib/class.tx_commerce_pibase.php']['singleview'][] 

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

	= 'YOUR_CLASS_NAME';

4. To allow to edit the fields in the product editor add YOUR_FIELD_1 
and YOUR_FIELD_2 to the "fields for products..."-field in the commerce 
extionsion information.

Ingo Schmitt schrieb:
 > Hi Christoph,
 >> Hi,
 >>
 >> what i need is two further fields in the product table - a Productnumber
 >> and a Filelist. Maybe they are already implemented, if not I would like
 >> to do it myself, so here's my question:
 >>
 >> Is it possible to submit Patches with those features, because it is more
 >> important to participate on future updates.
 >>
 >
 > During the Design of commerce we have taken care of aditional fields you
 > may use in your own applications. There are hooks for adding those to
 > the output and usage of them in the backend.
 > So, inseatd of adding those fileds to the tables, you could easiely
 > create a own extension to add those fields for your needs.
 > So, have a look at the hook list, and the lib classes to see how it's 
done.
 >
 > Regards
 >
 > Ingo
 >
 >> Best regards,
 >>
 >> Christoph
 >>
 >
 >
 > Mit freundlichen Gruessen



More information about the TYPO3-project-commerce mailing list