[TYPO3-commerce] New Hook in tx_commerce_pi2

Ingo Schmitt mailinglisten at i-schmitt.de
Wed Apr 4 16:18:33 CEST 2007


Hi Luc,
> For some purpose I added a hook to handled the delivery article in the 
> basket.
> 
> I needed this hook for this purpose :
> I Link each article to one delivery article.
> On the basket page I have to set the delivery article to the most expensive 
> delivery article that is liked to one "normal" article in the basket.
> 
> the only hook available in delivery handling were after the select box was 
> changed, but I hook the display to only display my chosen article.
> 
> Well, here it goes for the hook
> 
> in method : handleBasket() (approx line 172)
> 
> just before if($this->piVars['delArt']){ (approx line 270)
> 
> add this hook :
> 
>   $hookObjectsArr = array();
>    if (is_array 
> ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['commerce/pi2/class.tx_commerce_pi2.php']['prevdelArt'])) 
> {
>      foreach 
> ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['commerce/pi2/class.tx_commerce_pi2.php']['prevdelArt'] 
> as $classRef) {
>       $hookObjectsArr[] = &t3lib_div::getUserObj($classRef);
>      }
>    }
>    foreach($hookObjectsArr as $hookObj) {
>     if (method_exists($hookObj, 'prevdelArt')) {
>      $this->basket = $hookObj->prevdelArt($this->basket,$this);
>      }
>    }
> 
> I call it prevdelArt for previous delivery article
> 
> in the test : if($this->piVars['delArt']){ you got a hook called postdelart 
> that allow you to inpact the delivery article after it has been changed. 
> 
> 

The hook is fine with me. Could you send a patch to 
team(-at-)typo3-commerce.org


Thank you

ingo
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