[TYPO3-commerce] New Hook in tx_commerce_pi2

Luc Muller l.mul-nospam-ler at ameos.com
Wed Apr 4 14:29:55 CEST 2007


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. 




More information about the TYPO3-project-commerce mailing list