[TYPO3-commerce] Download of PDF in singleview

rainer schleevoigt rainer at webmasterei-hamburg.de
Wed Sep 30 11:54:44 CEST 2009


Hi Morten,

I have changed my localconf.php and I see that this file is not called, 
because this snippet is in it:
~~~~~~~~~~~~~~~~~~
error_log('LOCAL_TEST__CONF'); // this string doesnt appear in error-log

$lupohook='EXT:ras_lupobello/hookclass.php:ext_lupohook';
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['commerce/lib/class.tx_commerce_pibase.php']['singleview'][] 
= $lupohook;
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['commerce/lib/class.tx_commerce_product.php']['postinit'][] 
= $lupohook;
~~~~~~~~~~~~~~~~~~

Here is the content of hookclass.php:
~~~~~~~~~~~~~~~~~~
class ext_lupohook {
	function postInit(&$model) {
			error_log('INIT');
		   $model->add_fields_to_fieldlist(array('tx_raslupobello_pdf'));
	}	
	
	function additionalMarker($markerArray,$singleViewPlugin) {
		error_log('MARKER');
		$markerArray['###PDF###'] = 
$singleViewPlugin->product->getField('tx_raslupobello_pdf');
		return $markerArray;
	}
}
~~~~~~~~~~~~~~~~~~

Di you have an idea why the localconf.php ist not calling?


Rainer






  Olesen schrieb:
> Hi Rainer,
> 
> 
> You are on the right track - the hooks should be initialized in 
> localconf.php of your extension - rather than include it your self you 
> can left commerce do it. This way the class will only be loaded when 
> it's needed
> 
> 
> example localconf.php - assuming your extension dir is named raslupobello :
> 
> <?php
> if (!defined ('TYPO3_MODE'))     die ('Access denied.');
> $lupohook='EXT:raslupobello/hookclass.php:user_lupohook';
> $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['commerce/lib/class.tx_commerce_pibase.php']['singleview'][]=$lupohook; 
> 
> $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['commerce/lib/class.tx_commerce_product.php']['postinit'][]=$lupohook; 
> 
> 
> ?>
> 
> After this change ( and indeed any change to localconf.php ) you will 
> need to clear the cache to allow typo3 to rebuild it's combined config 
> file.
> 
> 
> if this still doesn't work for you then the problem lies else where.
> 
> /Morten
> 
> rainer schleevoigt wrote:
>> Hi,
>>
>> in my template file I have inserted ###PDF###.
>>
>> I created a extension width the new field 'tx_raslupobello_pdf' in 
>> tx_commerce_products. The client can upload pdf.
>>
>> Now comes my problem in FE:
>>
>> In this extension I created a file with the content:
>>
>> =================
>> class user_lupohook {
>>   function postInit(&$model) {
>>                    
>> $model->add_fields_to_fieldlist(array('tx_raslupobello_pdf'));
>>     }
>>       function additionalMarker($markerArray,$singleViewPlugin) {
>>         $markerArray['###PDF###'] = 
>> $singleViewPlugin->product->getField('tx_raslupobello_pdf');
>>         return $markerArray;
>>     }
>> }
>> =================
>>
>> Inserting of
>>
>> require_once(t3lib_extMgm::extPath($_EXTKEY).'hookclass.php');
>> $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['commerce/lib/class.tx_commerce_pibase.php']['singleview'][] 
>> = 'user_lupohook';
>> $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['commerce/lib/class.tx_commerce_product.php']['postinit'][] 
>>  = 'user_lupohook';
>>
>> in localconf.php doesnt work.
>>
>> It works after clearing of cache one time, if I place the code in 
>> ext_tables.php. After reloading of FE-page the marker doesnt replace.
>>
>> Any ideas?
>>
>>
>> Rainer


More information about the TYPO3-project-commerce mailing list