[TYPO3-commerce] RFC Feature: #28959: New hook in tx_commerce_pibase::makeBasketView()
Ingo Schmitt
is at marketing-factory.de
Thu Aug 18 14:14:11 CEST 2011
Hi,
fine by reading. However I don't have any working shop (including basket and checkout) to test it. Anyone?
Ingo
> Hi!
>
> Michael Knabe schrieb am 08/18/2011 01:03 PM Uhr:
>> Am 17.08.2011 15:39, schrieb Michael Knabe:
>>> Hi Marcus,
>>>
>>>> Notes:
>>>> Due to the amount of arguments, they have been bundled in a parameter
>>>> array (inspired by t3lib_PageRenderer hooks).
>>> I don't like the idea of putting the parameters into an array. On one
>>> hand it hides a problem (I consider requiring so many parameters a
>>> design problem) instead of solving it. It's not on you to fix the design
>>> flaw here but at least you shouldn't try to hide it.
>>> On the other hand it precludes the usage of type hinting which is
>>> especially important if you have many parameters (the more parameters
>>> you have the harder it is to remember the correct order).
>>
>> I discussed this point with Marcus face to face and we came to no real
>> conclusion on which solutions is nicer. To bring about a decision we had
>> a foosball-match and he won. So I leave the choice on him (if no one
>> else has any objections).
>>
>> However my other points are still valid.
>
> Although I've won - *YES* - I reconsidered my patch based on Florian's
> notes:
>
> v1
> * basketObj will not passed by reference
> * each values is passes a single method parameter (no use of array)
> * added hook desciption
>
>
> Marcus.
> Index: doc/hooks.html
> ===================================================================
> --- doc/hooks.html (Revision 51189)
> +++ doc/hooks.html (Arbeitskopie)
> @@ -108,6 +108,7 @@
> <div class="functionindex">function renderProductsForList</div>
> <div class="functionindex">function renderProduct</div>
> <div class="functionindex">function getArticleMarker</div>
> + <div class="functionindex">function makeBasketView</div>
> <a href="#tx_commerce_product">
> <div class="classindex">class tx_commerce_product</div>
> </a>
> @@ -390,6 +391,11 @@
> Result: $taxRateTemplate <br />
> possibility to regenerates taxrates and $taxRateTemplate in order to recalculate
> taxes.</div>
> + <div class="functionname">function makeBasketView</div>
> + <div class="hookname">GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['commerce/lib/class.tx_commerce_pibase.php']['makeBasketView']</div>
> + <div class="description">Call: postBasketView($content, $articletypes, $lineTemplate, $template, $basketObj, $this)<br/>
> + Type: Multiple <br/>
> + Result: string - Basket View HTML code</div>
>
> <div class="filename">lib/class.tx_commerce_product.php</div>
> <a name="tx_commerce_product"/>
> Index: lib/class.tx_commerce_pibase.php
> ===================================================================
> --- lib/class.tx_commerce_pibase.php (Revision 51189)
> +++ lib/class.tx_commerce_pibase.php (Arbeitskopie)
> @@ -797,7 +797,12 @@
> $content='';
> $template = $this->cObj->getSubpart($this->templateCode, $subpartMarker);
>
> -
> + $hookObjectsArr = array();
> + if (is_array ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['commerce/lib/class.tx_commerce_pibase.php']['makeBasketView'])) {
> + foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['commerce/lib/class.tx_commerce_pibase.php']['makeBasketView'] as $classRef) {
> + $hookObjectsArr[] = &t3lib_div::getUserObj($classRef);
> + }
> + }
>
> if(!is_array($lineTemplate)) {
> $temp = $lineTemplate;
> @@ -855,6 +860,12 @@
> $content = $this->cObj->substituteSubpart($template,'###LISTING_ARTICLE###','');
> }
>
> + foreach($hookObjectsArr as $hookObj) {
> + if (method_exists($hookObj, 'postBasketView')) {
> + $content = $hookObj->postBasketView($content, $articletypes, $lineTemplate, $template, $basketObj, $this);
> + }
> + }
> +
> $content = $this->cObj->substituteSubpart(
> $content,
> '###LISTING_BASKET_WEB###',
> _______________________________________________
> TYPO3-team-commerce mailing list
> TYPO3-team-commerce at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-team-commerce
Mit freundlichen Gruessen
Ingo Schmitt
--
Marketing Factory Consulting GmbH * mailto:is at marketing-factory.de
Marienstrasse 14 * Tel.: +49 211-361176-63
D-40212 Duesseldorf, Germany * Fax: +49 211-361176-64
Amtsgericht Duesseldorf HRB 53971 * http://www.marketing-factory.de/
Geschaeftsfuehrer: Peter Faisst | Katja Faisst
Karoline Steinfatt | Christoph Allefeld | Markus M. Kimmel
More information about the TYPO3-team-commerce
mailing list