[TYPO3-commerce] 'hardcoded' rendering of TS driven objects should be changed!

Ingo Schmitt mailinglisten at i-schmitt.de
Wed Aug 29 19:03:00 CEST 2007


Hi Franz,

thanks for this suggestion. This sounds great for me, but I like to have 
the oppinion from Volker to this. He's currently on holiday.
I'll ask him to the end of next week about this.


The only think I'm concerned about right now, is a way how to archive 
that the "old" way of writing the fields in TS could be also valid for 
quite a while, that user don't ahve to change their custom TS when 
installing the update directly...

Ingo



> Hi (me again ;-) ),
> 
> I was just wondering why the images didn't show up and digged the source 
> a bit and found some stuff that could be improved. Especially the method 
> 'renderValue' of class.tx_commerce_pibase.php.
> 
> Currently the 'design' of the TS-objects must be in a strict way, 
> because some parts of the TS-code get overwritten with hardcoded php. 
> This is not the best way - in fact it's ugly and not very flexible. So I 
> suggest the following:
> 
> 
> 1. provide a local_cObject
> ---------------------------
> function init($conf) {
>     #...
>     $this->local_cObject = t3lib_div::makeInstance('tslib_cObj');
>     #...
> }
> ---------------------------
> 
> 2. call cObjGetSingle instead of the objects directly
> Therefore the calls to the method renderValue have to be
> changed slightly to also provide the data of the current record 
> (article, category, product)
> ---------------------------
> function renderValue(&$value,&$data,&$TSfield,&$TSconf) {
>     $this->local_cObject->data = $data;
>     $this->local_cObject->setCurrentVal($value);
>     return 
> $this->local_cObj->cObjGetSingle($TSconf[$TSfield],$TSconf[$TSfield.'.']);
> }
> ---------------------------
> 
> 3. change the TS for the rendering
> ---------------------------
> lib.tx_commerce {
>     products.fields.images = IMAGE
>     products.fields.images {
>         // a constant could also be used for the uploadFolder
>         // as it is also defined/used somewhere else in TS
>         file.import = uploads/tx_commerce/
>         file.import.current = 1
>         altText.field = title
>     }
> }
> ---------------------------
> 
> That way you open up commerce the full power and flexibility of TS and 
> would allow for GIFBUILDER, combining extensions (like connecting some 
> commenting-extension or whatever directly with TS) and much more.
> 
> Changing this method is also no big deal, because it is only called on 
> one place in the whole code of commerce, named 'generateMarkerArray'.
> 
> 
> If your're interested I could try to create a diff for all what is 
> needed to be changed (TS and php-class).
> -- 
> Kind regards,
> Franz Koch


Mit freundlichen Gruessen
-- 
Ingo Schmitt                        mailto:is at marketing-factory.de
Marketing Factory Consulting GmbH   http://typo3.marketing-factory.de/
Content Management mit Typo3: Beratung - Schulung - Realisierung


More information about the TYPO3-project-commerce mailing list